This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a
- From: JiangNing OS <jiangning at os dot amperecomputing dot com>
- To: JiangNing OS <jiangning at os dot amperecomputing dot com>, Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, James Greenhalgh <james dot greenhalgh at arm dot com>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>, Richard Sandiford <Richard dot Sandiford at arm dot com>, Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>, nd <nd at arm dot com>
- Date: Thu, 22 Aug 2019 00:30:17 +0000
- Subject: RE: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yVTpeQwaOUSbha1Co/pt4sWORtKSrOxLdF91enIoln0=; b=enO85M0Wex1VOB8YzdFVgS8Hq3JBMCzTj4TQ64pdkM6wEXFPr1jPboNYSFVxWDzXMa8YyG20ipVEb0f22Sr1NwrRnEgkBerG6vHln7Rnh0k4/puKYHm8GrMIq6m0lc0LaZtVuY8zeu0XDJxFNhXyPXi8vbChoev+pq+Ord3cKYnUbtT3BTBTaTdjEEUmipjk8wh7rY/XPv7VDWhNaI7I+Osz2P6t8ulhIM/pChiqQmGg00ilMz+xXyjEXigjxzAaYuKpSeL25eWsLirSv9pZB/7ODUJCo5tMqgLFJ1OB08GgTNaC9IwmNLtEE36doNKdFPUVRWhNl3v/KjEP1UgBeA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jSIqviRZlLow6xUCM1gRWL5f8mpi3OXUhvIge1tzLgwzd0qiUk7VmR8pI800OxmNdb2zj85vJbBvn+HKtkiTWKFoo/k06eeQr6lVhkDHZ3g7Xr0zaag8+/VaPZ6RGQALtVXhW8zR0WQKCPz2OkZLJeBNDAeMRXfo8GkufqsyImw9JDcVEsXHXVFioSwc7JlD7Z3HBXw0gVJ+COb/y4Hr67bYgSnpbPfVfXcwP0STtS1674FT+oE58gyl0TziD/bLOs5JgIoK79ZUkt4Gdo7+GW1y+VIcPqo4ncuuotKppS6LrYR03MLIBe7g+DJmDuTWSX2oJJKeDtwZSgSxgj74dQ==
- References: <CAAgBjMnMqXAnbtnTT4Q_0GDFw9X3mRfbActR1bMkU73Cg_x6Yg@mail.gmail.com> <4e27950d-43fa-7ab3-a27f-169f91dbdabc@foss.arm.com> <CAAgBjMnygOhqMeEL6FhXKTB20ktpkoyLm3ALNowH9HUH4rRZ_Q@mail.gmail.com> <CAAgBjMk6UxiRGjNDGT5EKN=T8AEwU1y4jYe7OihwODY+nOqQeA@mail.gmail.com> <CAAgBjMk624y+hbZUV5jbyX6sLvDWmqJr9jzLAQyeYM+sq8_4+w@mail.gmail.com> <CAAgBjMnhBYna7+yYy6esi=O=CK2fhmFHnCy7RSFJu__YDe7bcg@mail.gmail.com> <CAAgBjMkcmf43VK4yZghqKaNicukLvAM7Kko2DeX8jcETnuhxpA@mail.gmail.com> <20190819164452.GC1042@arm.com> <CAAgBjMmBQ+rE_WrzdOyg5w4tdmdyah=AhSG84LRD04i4+PO3iw@mail.gmail.com> <MN2PR01MB54241EFBFA91B91BBF5202A89CA50@MN2PR01MB5424.prod.exchangelabs.com>
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org <gcc-patches-owner@gcc.gnu.org> On
> Behalf Of JiangNing OS
> Sent: Thursday, August 22, 2019 8:24 AM
> To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>; James Greenhalgh
> <james.greenhalgh@arm.com>
> Cc: gcc Patches <gcc-patches@gcc.gnu.org>; Richard Sandiford
> <Richard.Sandiford@arm.com>; Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>;
> nd <nd@arm.com>
> Subject: RE: PR90724 - ICE with __sync_bool_compare_and_swap with -
> march=armv8.2-a
>
> > -----Original Message-----
> > From: gcc-patches-owner@gcc.gnu.org <gcc-patches-owner@gcc.gnu.org> On
> > Behalf Of Prathamesh Kulkarni
> > Sent: Thursday, August 22, 2019 2:36 AM
> > To: James Greenhalgh <james.greenhalgh@arm.com>
> > Cc: gcc Patches <gcc-patches@gcc.gnu.org>; Richard Sandiford
> > <Richard.Sandiford@arm.com>; Kyrill Tkachov
> > <kyrylo.tkachov@foss.arm.com>; nd <nd@arm.com>
> > Subject: Re: PR90724 - ICE with __sync_bool_compare_and_swap with -
> > march=armv8.2-a
> >
> > On Mon, 19 Aug 2019 at 22:14, James Greenhalgh
> > <james.greenhalgh@arm.com> wrote:
> > >
> > > On Thu, Aug 15, 2019 at 02:11:25PM +0100, Prathamesh Kulkarni wrote:
> > > > On Thu, 8 Aug 2019 at 11:22, Prathamesh Kulkarni
> > > > <prathamesh.kulkarni@linaro.org> wrote:
> > > > >
> > > > > On Thu, 1 Aug 2019 at 15:34, Prathamesh Kulkarni
> > > > > <prathamesh.kulkarni@linaro.org> wrote:
> > > > > >
> > > > > > On Thu, 25 Jul 2019 at 11:56, Prathamesh Kulkarni
> > > > > > <prathamesh.kulkarni@linaro.org> wrote:
> > > > > > >
> > > > > > > On Wed, 17 Jul 2019 at 18:15, Prathamesh Kulkarni
> > > > > > > <prathamesh.kulkarni@linaro.org> wrote:
> > > > > > > >
> > > > > > > > On Wed, 17 Jul 2019 at 13:45, Kyrill Tkachov
> > > > > > > > <kyrylo.tkachov@foss.arm.com> 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.
> > Thanks, committed to trunk in r274805.
>
> Trunk aarch64 build failure is exposed by this commit.
>
> ../../gcc/gcc/config/aarch64/aarch64.c: In function bool
> aarch64_evpc_sel(expand_vec_perm_d*) :
> ../../gcc/gcc/config/aarch64/aarch64.c:18018:75: error: gen_vcond_mask
> was not declared in this scope
> emit_insn (gen_vcond_mask (vmode, vmode, d->target, d->op1, d->op0,
> pred));
> ^
> make[3]: *** [aarch64.o] Error 1
> make[3]: Leaving directory `/home/amptest/gcc/build/gcc'
Oh. It is caused by a different commit 274810 rather than 274805.
>
> > Is this OK to backport to gcc-9-branch ?
> >
> > Thanks,
> > Prathamesh
> > >
> > > James
> > >