From f3877b2f7077963f9c688a4116e6d8abd0d212a6 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 5 Feb 2017 09:47:48 +0000 Subject: [PATCH] re PR target/79353 (ICE in curr_insn_transform, at lra-constraints.c:3773) PR target/79353 * config/sparc/sync.md (atomic_loaddi_1): Replace 'U' constraint with 'r', 'm' constraint with 'T' and !TARGET_ARCH64 with TARGET_ARCH32. (atomic_storedi_1): Likewise. From-SVN: r245188 --- gcc/ChangeLog | 7 ++++ gcc/config/sparc/sync.md | 12 +++---- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.target/sparc/20170205-1.c | 39 +++++++++++++++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/sparc/20170205-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3be3f745994..9e751381511 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-02-05 Eric Botcazou + + PR target/79353 + * config/sparc/sync.md (atomic_loaddi_1): Replace 'U' constraint with + 'r', 'm' constraint with 'T' and !TARGET_ARCH64 with TARGET_ARCH32. + (atomic_storedi_1): Likewise. + 2017-02-04 Jakub Jelinek PR tree-optimization/79338 diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md index 8db2d15b79b..1593bdeb903 100644 --- a/gcc/config/sparc/sync.md +++ b/gcc/config/sparc/sync.md @@ -133,10 +133,10 @@ }) (define_insn "atomic_loaddi_1" - [(set (match_operand:DI 0 "register_operand" "=U,?*f") - (unspec:DI [(match_operand:DI 1 "memory_operand" "m,m")] + [(set (match_operand:DI 0 "register_operand" "=r,?*f") + (unspec:DI [(match_operand:DI 1 "memory_operand" "T,T")] UNSPEC_ATOMIC))] - "!TARGET_ARCH64" + "TARGET_ARCH32" "ldd\t%1, %0" [(set_attr "type" "load,fpload")]) @@ -160,11 +160,11 @@ }) (define_insn "atomic_storedi_1" - [(set (match_operand:DI 0 "memory_operand" "=m,m,m") + [(set (match_operand:DI 0 "memory_operand" "=T,T,T") (unspec:DI - [(match_operand:DI 1 "register_or_v9_zero_operand" "J,U,?*f")] + [(match_operand:DI 1 "register_or_v9_zero_operand" "J,r,?*f")] UNSPEC_ATOMIC))] - "!TARGET_ARCH64" + "TARGET_ARCH32" "@ stx\t%r1, %0 std\t%1, %0 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f8cd36a0338..77aba28d51e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-02-05 Eric Botcazou + + * gcc.target/sparc/20170205-1.c: New test. + 2017-02-03 John David Anglin * gfortran.dg/coarray_43.f90: Add "-latomic" option if diff --git a/gcc/testsuite/gcc.target/sparc/20170205-1.c b/gcc/testsuite/gcc.target/sparc/20170205-1.c new file mode 100644 index 00000000000..b2e4d3f1f08 --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/20170205-1.c @@ -0,0 +1,39 @@ +/* PR target/79363 */ +/* Reported by John Paul Adrian Glaubitz */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fPIC -mcpu=v8" } */ + +struct d { long long h; }; + +struct c { struct d *e; }; + +int f, g; + +extern void bar (long long *); +extern int baz (long long *, int); + +void foo (struct c *desc) +{ + int begin, end, j; + long long k, l, h; + for (;;) { + for (;;) + break; + for (;;) { + j++; + l = desc->e[j].h; + for (;;) { + bar(&l); + end = h = begin / 2; + if (baz(&h, g)) + begin = f; + break; + } + if (end) { + __atomic_store_n(&k, end, 5); + break; + } + } + } +} -- 2.30.2