OSDN Git Service

gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 2 Oct 2011 17:45:10 +0000 (17:45 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 2 Oct 2011 17:45:10 +0000 (17:45 +0000)
PR target/49696
* config/mips/sync.md (sync_<optab>_12): Allow zero operands.
(sync_old_<optab>_12, sync_new_<optab>_12, sync_nand_12): Likewise.
(sync_old_nand_12, sync_new_nand_12, test_and_set_12): Likewise.

gcc/testsuite/
* gcc.dg/pr49696.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179431 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mips/sync.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr49696.c [new file with mode: 0644]

index 4aa277a..b8197fa 100644 (file)
@@ -1,3 +1,10 @@
+2011-10-02  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR target/49696
+       * config/mips/sync.md (sync_<optab>_12): Allow zero operands.
+       (sync_old_<optab>_12, sync_new_<optab>_12, sync_nand_12): Likewise.
+       (sync_old_nand_12, sync_new_nand_12, test_and_set_12): Likewise.
+
 2011-10-02  Jan Hubicka  <jh@suse.cz>
 
        * cgraphunit.c (verify_edge_count_and_frequency): Bounds check.
index b3098b4..1b4097e 100644 (file)
           [(match_operand:SI 1 "register_operand" "d")
           (match_operand:SI 2 "register_operand" "d")
           (atomic_hiqi_op:SI (match_dup 0)
-                             (match_operand:SI 3 "register_operand" "dJ"))]
+                             (match_operand:SI 3 "reg_or_0_operand" "dJ"))]
          UNSPEC_SYNC_OLD_OP_12))
    (clobber (match_scratch:SI 4 "=&d"))]
   "GENERATE_LL_SC"
           [(match_operand:SI 2 "register_operand" "d")
           (match_operand:SI 3 "register_operand" "d")
           (atomic_hiqi_op:SI (match_dup 0)
-                             (match_operand:SI 4 "register_operand" "dJ"))]
+                             (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
          UNSPEC_SYNC_OLD_OP_12))
    (clobber (match_scratch:SI 5 "=&d"))]
   "GENERATE_LL_SC"
           (match_operand:SI 2 "register_operand" "d")
           (match_operand:SI 3 "register_operand" "d")
           (atomic_hiqi_op:SI (match_dup 0)
-                             (match_operand:SI 4 "register_operand" "dJ"))]
+                             (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
          UNSPEC_SYNC_NEW_OP_12))
    (set (match_dup 1)
        (unspec_volatile:SI
           [(match_operand:SI 1 "register_operand" "d")
           (match_operand:SI 2 "register_operand" "d")
           (match_dup 0)
-          (match_operand:SI 3 "register_operand" "dJ")]
+          (match_operand:SI 3 "reg_or_0_operand" "dJ")]
          UNSPEC_SYNC_OLD_OP_12))
    (clobber (match_scratch:SI 4 "=&d"))]
   "GENERATE_LL_SC"
        (unspec_volatile:SI
           [(match_operand:SI 2 "register_operand" "d")
           (match_operand:SI 3 "register_operand" "d")
-          (match_operand:SI 4 "register_operand" "dJ")]
+          (match_operand:SI 4 "reg_or_0_operand" "dJ")]
          UNSPEC_SYNC_OLD_OP_12))
    (clobber (match_scratch:SI 5 "=&d"))]
   "GENERATE_LL_SC"
           [(match_operand:SI 1 "memory_operand" "+R")
           (match_operand:SI 2 "register_operand" "d")
           (match_operand:SI 3 "register_operand" "d")
-          (match_operand:SI 4 "register_operand" "dJ")]
+          (match_operand:SI 4 "reg_or_0_operand" "dJ")]
          UNSPEC_SYNC_NEW_OP_12))
    (set (match_dup 1)
        (unspec_volatile:SI
    (set (match_dup 1)
        (unspec_volatile:SI [(match_operand:SI 2 "register_operand" "d")
                             (match_operand:SI 3 "register_operand" "d")
-                            (match_operand:SI 4 "arith_operand" "dJ")]
+                            (match_operand:SI 4 "reg_or_0_operand" "dJ")]
          UNSPEC_SYNC_EXCHANGE_12))]
   "GENERATE_LL_SC"
   { return mips_output_sync_loop (insn, operands); }
index 37a71e5..56a9cc1 100644 (file)
@@ -1,3 +1,7 @@
+2011-10-02  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * gcc.dg/pr49696.c: New test.
+
 2011-10-02  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/ipa/ctor-empty-1.c: Update dump file.
diff --git a/gcc/testsuite/gcc.dg/pr49696.c b/gcc/testsuite/gcc.dg/pr49696.c
new file mode 100644 (file)
index 0000000..8e5a018
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-require-effective-target sync_char_short } */
+
+/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
+
+void
+foo (short *x)
+{
+  __sync_val_compare_and_swap (x, 1, 0);
+  __sync_bool_compare_and_swap (x, 1, 0);
+  __sync_lock_test_and_set (x, 0);
+
+  __sync_fetch_and_add (x, 0);
+  __sync_fetch_and_add (x, 0);
+  __sync_fetch_and_add (x, 0);
+  __sync_fetch_and_sub (x, 0);
+  __sync_fetch_and_and (x, 0);
+  __sync_fetch_and_or (x, 0);
+  __sync_fetch_and_xor (x, 0);
+  __sync_fetch_and_nand (x, 0);
+
+  __sync_add_and_fetch (x, 0);
+  __sync_add_and_fetch (x, 0);
+  __sync_add_and_fetch (x, 0);
+  __sync_sub_and_fetch (x, 0);
+  __sync_and_and_fetch (x, 0);
+  __sync_or_and_fetch (x, 0);
+  __sync_xor_and_fetch (x, 0);
+  __sync_nand_and_fetch (x, 0);
+}