re PR target/67143 (ICE (could not split insn) on aarch64-linux-gnu)
authorMatthew Wahab <matthew.wahab@arm.com>
Fri, 14 Aug 2015 15:05:42 +0000 (15:05 +0000)
committerMatthew Wahab <mwahab@gcc.gnu.org>
Fri, 14 Aug 2015 15:05:42 +0000 (15:05 +0000)
gcc/
2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>

PR target/67143
* config/aarch64/atomics.md (atomic_<optab><mode>): Replace
'lconst_atomic' with 'const_atomic'.
(atomic_fetch_<optab><mode>): Likewise.
(atomic_<optab>_fetch<mode>): Likewise.
* config/aarch64/iterators.md (lconst-atomic): Move below
'const_atomic'.
(const_atomic): New.

gcc/testsuite/
2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>
    Matthias Klose  <doko@debian.org>

PR target/67143
* gcc.c-torture/compile/pr67143.c: New
* gcc.target/aarch64/atomic-op-imm.c
(atomic_fetch_add_negative_RELAXED): New.
(atomic_fetch_sub_negative_ACQUIRE): New.

Co-Authored-By: Matthias Klose <doko@debian.org>
From-SVN: r226895

gcc/ChangeLog
gcc/config/aarch64/atomics.md
gcc/config/aarch64/iterators.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr67143.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c

index 154c0778c536cd7f9dcc435afbc64675b066a1dd..afade5dfea4bc946be0bb5a3c9e50ac494f3320f 100644 (file)
@@ -1,3 +1,14 @@
+2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>
+
+       PR target/67143
+       * config/aarch64/atomics.md (atomic_<optab><mode>): Replace
+       'lconst_atomic' with 'const_atomic'.
+       (atomic_fetch_<optab><mode>): Likewise.
+       (atomic_<optab>_fetch<mode>): Likewise.
+       * config/aarch64/iterators.md (lconst-atomic): Move below
+       'const_atomic'.
+       (const_atomic): New.
+
 2015-08-14  Thomas Schwinge  <thomas@codesourcery.com>
            Bernd Schmidt  <bernds@codesourcery.com>
 
index 7082f619696852ad28b0ad06335996efec2259a9..65d2cc911be244e6bdd79767d841b827455c449b 100644 (file)
   [(set (match_operand:ALLI 0 "aarch64_sync_memory_operand" "+Q")
     (unspec_volatile:ALLI
       [(atomic_op:ALLI (match_dup 0)
-       (match_operand:ALLI 1 "<atomic_op_operand>" "r<lconst_atomic>"))
+       (match_operand:ALLI 1 "<atomic_op_operand>" "r<const_atomic>"))
        (match_operand:SI 2 "const_int_operand")]               ;; model
       UNSPECV_ATOMIC_OP))
        (clobber (reg:CC CC_REGNUM))
    (set (match_dup 1)
     (unspec_volatile:ALLI
       [(atomic_op:ALLI (match_dup 1)
-       (match_operand:ALLI 2 "<atomic_op_operand>" "r<lconst_atomic>"))
+       (match_operand:ALLI 2 "<atomic_op_operand>" "r<const_atomic>"))
        (match_operand:SI 3 "const_int_operand")]               ;; model
       UNSPECV_ATOMIC_OP))
    (clobber (reg:CC CC_REGNUM))
   [(set (match_operand:ALLI 0 "register_operand" "=&r")
     (atomic_op:ALLI
       (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q")
-      (match_operand:ALLI 2 "<atomic_op_operand>" "r<lconst_atomic>")))
+      (match_operand:ALLI 2 "<atomic_op_operand>" "r<const_atomic>")))
    (set (match_dup 1)
     (unspec_volatile:ALLI
       [(match_dup 1) (match_dup 2)
index 5d7966d7adf49a1824ddc41cd34b04c6f179b09a..b8a45d1d6ed8bbcfcb9a2b37edd0e24ba171649f 100644 (file)
 ;; Attribute to describe constants acceptable in logical operations
 (define_mode_attr lconst [(SI "K") (DI "L")])
 
-;; Attribute to describe constants acceptable in atomic logical operations
-(define_mode_attr lconst_atomic [(QI "K") (HI "K") (SI "K") (DI "L")])
-
 ;; Map a mode to a specific constraint character.
 (define_mode_attr cmode [(QI "q") (HI "h") (SI "s") (DI "d")])
 
    (plus "aarch64_plus_operand")
    (minus "aarch64_plus_operand")])
 
+;; Constants acceptable for atomic operations.
+;; This definition must appear in this file before the iterators it refers to.
+(define_code_attr const_atomic
+ [(plus "IJ") (minus "IJ")
+  (xor "<lconst_atomic>") (ior "<lconst_atomic>")
+  (and "<lconst_atomic>")])
+
+;; Attribute to describe constants acceptable in atomic logical operations
+(define_mode_attr lconst_atomic [(QI "K") (HI "K") (SI "K") (DI "L")])
+
 ;; -------------------------------------------------------------------
 ;; Int Iterators.
 ;; -------------------------------------------------------------------
index c4dc432d951b911b4b0323bb11b537b5a2dd7b57..9a4cd14860feb3be8cf3f2d3acc224dbcbf20773 100644 (file)
@@ -1,3 +1,12 @@
+2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>
+           Matthias Klose  <doko@debian.org>
+
+       PR target/67143
+       * gcc.c-torture/compile/pr67143.c: New
+       * gcc.target/aarch64/atomic-op-imm.c
+       (atomic_fetch_add_negative_RELAXED): New.
+       (atomic_fetch_sub_negative_ACQUIRE): New.
+
 2015-08-14  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.target/aarch64/target_attr_5.c: Add static modifier to bar.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr67143.c b/gcc/testsuite/gcc.c-torture/compile/pr67143.c
new file mode 100644 (file)
index 0000000..62c4186
--- /dev/null
@@ -0,0 +1,21 @@
+long a, c;
+int b;
+int d;
+void ut_dbg_assertion_failed() __attribute__((noreturn));
+long dict_index_is_spatial(int *);
+void btr_block_get_func(char *);
+long btr_page_get_level_low(unsigned char *);
+void btr_validate_level(long p1) {
+  unsigned char *e;
+  while (p1 != btr_page_get_level_low(e)) {
+    if (__builtin_expect(b, 0))
+      ut_dbg_assertion_failed();
+    if (dict_index_is_spatial(&d))
+      while (c != 5535) {
+        __sync_add_and_fetch(&a, 536870912);
+        btr_block_get_func("");
+      }
+  }
+  for (long i; i; ++i)
+    btr_validate_level(-i);
+}
index 6c6f7e16dfefa92027cd678e4eb8df7849bd7cf8..47d7a96aa12668455fcf5c95ad847b3f61393543 100644 (file)
@@ -15,6 +15,18 @@ atomic_fetch_sub_ACQUIRE ()
   return __atomic_fetch_sub (&v, 4096, __ATOMIC_ACQUIRE);
 }
 
+int
+atomic_fetch_add_negative_RELAXED ()
+{
+  return __atomic_fetch_add (&v, -4096, __ATOMIC_RELAXED);
+}
+
+int
+atomic_fetch_sub_negative_ACQUIRE ()
+{
+  return __atomic_fetch_sub (&v, -4096, __ATOMIC_ACQUIRE);
+}
+
 int
 atomic_fetch_and_SEQ_CST ()
 {
@@ -75,4 +87,4 @@ atomic_or_fetch_CONSUME ()
   return __atomic_or_fetch (&v, 4096, __ATOMIC_CONSUME);
 }
 
-/* { dg-final { scan-assembler-times "\tw\[0-9\]+, w\[0-9\]+, #*4096" 12 } } */
+/* { dg-final { scan-assembler-times "\tw\[0-9\]+, w\[0-9\]+, #*4096" 14 } } */