From patchwork Tue Aug 2 14:32:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 654894 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s3dwj451wz9s3v for ; Wed, 3 Aug 2016 00:33:25 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=jkFQcHjj; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=oCTMooQ02H+GtGBnUb+8ICmm7bjOLY+Rmk+jp1WSW/+LZB+Pl795v c61ZRNZUJS37KjW5RwqtU1nSLFmSkQRs0gLQ5VpYYNnHBk6+kEHeNlxy5BCVPL63 x9dqUI2hMxl7LFL2IilZFB5eA5WIJ8hJJqOZhVpLJ5pqqr6UZ1/4s4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=7SbCQ1tv4eO52FIxNFItHLtzPPU=; b=jkFQcHjjllEq6gxjGvWW j/mmEBIKgdzgVc7M/fq2qhsWpP7emWeBS10+lSh4JeULFaX/mNxQIrh9mxjXCs5m W8lfqyybuSp3q41wjD+hWL1EKiAGfXJJgkX8NHJaNGtw7RTOjVnLsAPHp50xqfsr RwFCtWlV+19AeCR72ozCba4= Received: (qmail 48698 invoked by alias); 2 Aug 2016 14:33:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 48687 invoked by uid 89); 2 Aug 2016 14:33:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=virtue, poke X-HELO: mail-pa0-f65.google.com Received: from mail-pa0-f65.google.com (HELO mail-pa0-f65.google.com) (209.85.220.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 02 Aug 2016 14:33:01 +0000 Received: by mail-pa0-f65.google.com with SMTP id hh10so12132315pac.1 for ; Tue, 02 Aug 2016 07:33:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=im7hXwUO1J6k1oRc95QcnFIumHtWk7Kf7k2g7m3Pp40=; b=mTPpQ4DXhzSnoui1o6Soe/C9upQ7LyppsPj0wggdiSe22s3Cksv4KtAJGa7BJZsxYa Kdi+OVzZr4lFwP5dmv4Yc0/JvOUCs5PWmCcOCOutzi4X9lo3JrAmWGMOmOWT5TqDmS1D ZANR7E+f8EfkCBpWND9c71bszZhzlZ4TSjveqXYwhtkh5ws0LTftoo4CN0uf8hBCa0Tm 9iet+yQSjhmwPgnzQo0Svmvid5LHsSdA+8ah/ASg9OhBHk5l9ohdWsttPrlyfwW+ptix OlgdUfXMMDb8lS7tAqtFF0GqDDPK8s81sd8LwsEbkp+Cm96GDjsXDK1mHHS8kv+l3+6K gghQ== X-Gm-Message-State: AEkoouvA+9lVRWSD8AFfbol8B5UzSLFu9FFB3IZZy6fDTfhQS+U5NZXoOQjpM5q2Rbdajg== X-Received: by 10.66.181.16 with SMTP id ds16mr107199474pac.102.1470148379004; Tue, 02 Aug 2016 07:32:59 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-146-233.sa.bigpond.net.au. [58.160.146.233]) by smtp.gmail.com with ESMTPSA id l128sm5450206pfl.21.2016.08.02.07.32.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Aug 2016 07:32:58 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id F3A0AC1986; Wed, 3 Aug 2016 00:02:54 +0930 (ACST) Date: Wed, 3 Aug 2016 00:02:54 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org Subject: [RS6000] Force source of fix_truncsi2 to reg Message-ID: <20160802143254.GF20904@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes This is a hack I tried to avoid having to poke at lra code for pr71680.. The idea of adding force_reg here was that it removes subregs from fix_trunc, emitting the subreg mode conversion in a separate set insn. That avoids the underlying lra issue, by virtue of combine merging the SF subreg with the SI mem load, at least for -m64. For -m32 combine rejects the combination due to the mem address being a lo_sum which is a mode dependent address. Of course even for -m64, combine probably shouldn't allow this combination, and wouldn't if the rs6000 rtx_costs function said that SLOW_UNALIGNED_ACCESS mems actually cost more. So this patch isn't a particularly good solution to pr71680, but a) force_reg for an operand that must be a reg is 100% safe, and b) it's good to expose more combine opportunities. Bootstrapped and regression tested powerpc64le-linux and powerpc64-linux. * config/rs6000/rs6000.md (fix_truncsi2): Force source operand to a reg. Localize vars. diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 5afae92..45ad661 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -5357,15 +5357,15 @@ { if (!) { - rtx tmp, stack; + rtx src = force_reg (SFmode, operands[1]); if (TARGET_STFIWX) - emit_insn (gen_fix_truncsi2_stfiwx (operands[0], operands[1])); + emit_insn (gen_fix_truncsi2_stfiwx (operands[0], src)); else { - tmp = gen_reg_rtx (DImode); - stack = rs6000_allocate_stack_temp (DImode, true, false); - emit_insn (gen_fix_truncsi2_internal (operands[0], operands[1], + rtx tmp = gen_reg_rtx (DImode); + rtx stack = rs6000_allocate_stack_temp (DImode, true, false); + emit_insn (gen_fix_truncsi2_internal (operands[0], src, tmp, stack)); } DONE;