From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24041 invoked by alias); 21 Aug 2019 18:36:31 -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 24033 invoked by uid 89); 21 Aug 2019 18:36:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.6 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:800a, gcc8, forces X-HELO: mail-lj1-f176.google.com Received: from mail-lj1-f176.google.com (HELO mail-lj1-f176.google.com) (209.85.208.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 18:36:29 +0000 Received: by mail-lj1-f176.google.com with SMTP id h15so3077133ljg.10 for ; Wed, 21 Aug 2019 11:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=QFko50H9WqycxQE/Gu9FzpxPsefH4YkF7BPpBW83K8M=; b=d+/eA/BGAyNXAKs8UspGVTkQL7Mp8fxYt/h9znZ4yUQtq0zdJg2zYqAokynrrRKEpR RjLDVR8GHigBjgg6cytup/7MecdhLlcUU8g1Rc9FJ67uy5rVE2fcFr/LNuLvBPNZZ8sM 51cfpGfWvU6anziIYsjsKbQh/NCtrezKq3J/Z7lh0l1VUeVBzBnRyZHpisrrMBhmyb+C rZKRhf/x2dT7kVTXSTwpW/wg3wAIJps4zUbVwB5AFO7YCvrGUgfGtZk/0pQtmz5une9M x8dVtSeV/y7kN02ZKjlsvh5aPmt7kntiuDNFnRduBi08aUFF0/E/amkhZBU0t6myIJWN +p5A== MIME-Version: 1.0 References: <4e27950d-43fa-7ab3-a27f-169f91dbdabc@foss.arm.com> <20190819164452.GC1042@arm.com> In-Reply-To: <20190819164452.GC1042@arm.com> From: Prathamesh Kulkarni Date: Wed, 21 Aug 2019 20:48:00 -0000 Message-ID: Subject: Re: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a To: James Greenhalgh Cc: gcc Patches , Richard Sandiford , Kyrill Tkachov , nd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg01516.txt.bz2 On Mon, 19 Aug 2019 at 22:14, James Greenhalgh w= rote: > > 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=3Darmv8.2-a results in: > > > > > > > > pr90724.c: In function =E2=80=98check_ok=E2=80=99: > > > > > > > > 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 co= nstant then > > > > > > > > it works. > > > > > > > > > > > > > > > > The ICE results with -march=3Darmv8.2-a because, we enter if > > > > > > > > (TARGET_LSE) { ... } condition > > > > > > > > in aarch64_expand_compare_and_swap, while with -march=3Darm= v8.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_p= lus_operand > > > > > > > > predicate and if not, forces it to be in register, which re= solves ICE. > > > > > > > > Does it look OK ? > > > > > > > > > > > > > > > > Bootstrap+testing in progress on aarch64-linux-gnu. > > > > > > > > > > > > > > > > PS: The issue has nothing to do with SVE, which I incorrect= ly > > > > > > > > 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. Thanks, committed to trunk in r274805. Is this OK to backport to gcc-9-branch ? Thanks, Prathamesh > > James >