From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116182 invoked by alias); 27 Nov 2015 14:02:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 116167 invoked by uid 89); 27 Nov 2015 14:02:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f172.google.com Received: from mail-yk0-f172.google.com (HELO mail-yk0-f172.google.com) (209.85.160.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 27 Nov 2015 14:02:31 +0000 Received: by ykdr82 with SMTP id r82so118540963ykd.3 for ; Fri, 27 Nov 2015 06:02:29 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.129.70.65 with SMTP id t62mr40937466ywa.240.1448632949336; Fri, 27 Nov 2015 06:02:29 -0800 (PST) Received: by 10.37.93.11 with HTTP; Fri, 27 Nov 2015 06:02:29 -0800 (PST) In-Reply-To: <1448629261-29938-1-git-send-email-james.greenhalgh@arm.com> References: <5656E50A.3040903@redhat.com> <1448629261-29938-1-git-send-email-james.greenhalgh@arm.com> Date: Fri, 27 Nov 2015 14:02:00 -0000 Message-ID: Subject: Re: [Patch AArch64] Reinstate CANNOT_CHANGE_MODE_CLASS to fix pr67609 From: Richard Biener To: James Greenhalgh Cc: GCC Patches , Richard Henderson , Marcus Shawcroft , Richard Earnshaw Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg03367.txt.bz2 On Fri, Nov 27, 2015 at 2:01 PM, James Greenhalgh wrote: > > Hi, > > This patch follow Richard Henderson's advice to tighten up > CANNOT_CHANGE_MODE_CLASS for AArch64 to avoid a simplification bug in > the middle-end. > > There is nothing AArch64-specific about the testcase which triggers this, > so I'll put it in the testcase for other targets. If you see a regression, > the explanation in the PR is much more thorough and correct than I can > reproduce here, so I'd recommend starting there. In short, target > maintainers need to: > >> forbid BITS_PER_WORD (64-bit) subregs of hard registers > >> BITS_PER_WORD. See the verbiage I added to the i386 backend for this. > > We removed the CANNOT_CHANGE_MODE_CLASS macro back in January 2015. Before > then, we used it to workaround bugs in big-endian vector support > ( https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01216.html ). Ideally, > we'd not need to bring this macro back, but if we can't fix the middle-end > bug this exposes, we need the workaround. > > For AArch64, doing this runs in to some trouble with two of our > instruction patterns - we end up with: > > (truncate:DI (reg:TF)) > > Which fails if it ever make it through to the simplify routines with > something nasty like: > > (and:DI (truncate:DI (reg:TF 32 v0 [ a ])) > (const_int 2305843009213693951 [0x1fffffffffffffff])) > > The simplify routines want to turn this around to look like: > > (truncate:DI (and:TF (reg:TF 32 v0 [ a ]) > (const_int 2305843009213693951 [0x1fffffffffffffff]))) > > Which then wants to further simplify the expression by first building > the constant in TF mode, and trunc_int_for_mode barfs: > > 0x7a38a5 trunc_int_for_mode(long, machine_mode) > .../gcc/explow.c:53 > > We can fix that by changing the patterns to use a zero_extract, which seems > more in line with what they actually express (extracting the two 64-bit > halves of a 128-bit value). > > Bootstrapped on aarch64-none-linux-gnu, and tested on aarch64-none-elf and > aarch64_be-none-elf without seeing any correctness regressions. > > OK? > > If so, we ought to get this backported to the release branches, the gcc-5 > backport applies clean (testing ongoing but looks OK so far) if the release > managers and AArch64 maintainers agree this is something that should be > backported this late in the 5.3 release cycle. Your call, the RC will be done on monday. Richard. > Thanks, > James > > --- > 2015-11-27 James Greenhalgh > > * config/aarch64/aarch64-protos.h > (aarch64_cannot_change_mode_class): Bring back. > * config/aarch64/aarch64.c > (aarch64_cannot_change_mode_class): Likewise. > * config/aarch64/aarch64.h (CANNOT_CHANGE_MODE_CLASS): Likewise. > * config/aarch64/aarch64.md (aarch64_movdi_low): Use > zero_extract rather than truncate. > (aarch64_movdi_high): Likewise. > > 2015-11-27 James Greenhalgh > > * gcc.dg/torture/pr67609.c: New. >