From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47626 invoked by alias); 19 Aug 2019 16:44:59 -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 47613 invoked by uid 89); 19 Aug 2019 16:44:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Aug 2019 16:44:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 84D39360; Mon, 19 Aug 2019 09:44:55 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B78EF3F718; Mon, 19 Aug 2019 09:44:54 -0700 (PDT) Date: Mon, 19 Aug 2019 18:34:00 -0000 From: James Greenhalgh To: Prathamesh Kulkarni Cc: gcc Patches , Richard Sandiford , Kyrill Tkachov , nd@arm.com Subject: Re: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a Message-ID: <20190819164452.GC1042@arm.com> References: <4e27950d-43fa-7ab3-a27f-169f91dbdabc@foss.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg01329.txt.bz2 On Thu, Aug 15, 2019 at 02:11:25PM +0100, Prathamesh Kulkarni wrote: > On Thu, 8 Aug 2019 at 11:22, Prathamesh Kulkarni > wrote: > > > > On Thu, 1 Aug 2019 at 15:34, Prathamesh Kulkarni > > wrote: > > > > > > On Thu, 25 Jul 2019 at 11:56, Prathamesh Kulkarni > > > wrote: > > > > > > > > On Wed, 17 Jul 2019 at 18:15, Prathamesh Kulkarni > > > > wrote: > > > > > > > > > > On Wed, 17 Jul 2019 at 13:45, Kyrill Tkachov > > > > > wrote: > > > > > > > > > > > > Hi Prathamesh > > > > > > > > > > > > On 7/10/19 12:24 PM, Prathamesh Kulkarni wrote: > > > > > > > Hi, > > > > > > > For following test-case, > > > > > > > static long long AL[24]; > > > > > > > > > > > > > > int > > > > > > > check_ok (void) > > > > > > > { > > > > > > > return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, > > > > > > > 0x1234567890ll)); > > > > > > > } > > > > > > > > > > > > > > Compiling with -O2 -march=armv8.2-a results in: > > > > > > > pr90724.c: In function ‘check_ok’: > > > > > > > pr90724.c:7:1: error: unrecognizable insn: > > > > > > > 7 | } > > > > > > > | ^ > > > > > > > (insn 11 10 12 2 (set (reg:CC 66 cc) > > > > > > > (compare:CC (reg:DI 95) > > > > > > > (const_int 8589934595 [0x200000003]))) "pr90724.c":6:11 -1 > > > > > > > (nil)) > > > > > > > > > > > > > > IIUC, the issue is that 0x200000003 falls outside the range of > > > > > > > allowable immediate in cmp ? If it's replaced by a small constant then > > > > > > > it works. > > > > > > > > > > > > > > The ICE results with -march=armv8.2-a because, we enter if > > > > > > > (TARGET_LSE) { ... } condition > > > > > > > in aarch64_expand_compare_and_swap, while with -march=armv8.a it goes > > > > > > > into else, > > > > > > > which forces oldval into register if the predicate fails to match. > > > > > > > > > > > > > > The attached patch checks if y (oldval) satisfies aarch64_plus_operand > > > > > > > predicate and if not, forces it to be in register, which resolves ICE. > > > > > > > Does it look OK ? > > > > > > > > > > > > > > Bootstrap+testing in progress on aarch64-linux-gnu. > > > > > > > > > > > > > > PS: The issue has nothing to do with SVE, which I incorrectly > > > > > > > mentioned in bug report. > > > > > > > > > > > > > This looks ok to me (but you'll need maintainer approval). > > > > > > > > > > > > Does this fail on the branches as well? > > > > > Hi Kyrill, > > > > > Thanks for the review. The test also fails on gcc-9-branch (but not on gcc-8). > > > > Hi James, > > > > Is the patch OK to commit ? > > > > https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00793.html > > > ping * 3: https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00793.html > > ping * 4: https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00793.html > ping * 5: https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00793.html Hi, Sorry, this missed my filters as it didn't mention AArch64 in the subject line. Thais is good for trunk, thanks for waiting. James