Test to cover LRA fix in r215119.
authorRobert Suchanek <robert.suchanek@imgtec.com>
Sun, 28 Sep 2014 08:54:36 +0000 (08:54 +0000)
committerMatthew Fortune <mpf@gcc.gnu.org>
Sun, 28 Sep 2014 08:54:36 +0000 (08:54 +0000)
gcc/testsuite/

* gcc.target/mips/20140928.c: New test.

From-SVN: r215663

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/20140928.c [new file with mode: 0644]

index 3089328..870ca0e 100644 (file)
@@ -1,3 +1,7 @@
+2014-09-28  Robert Suchanek  <robert.suchanek@imgtec.com>
+
+       * gcc.target/mips/20140928.c: New test.
+
 2014-09-27  Andi Kleen  <ak@linux.intel.com>
 
        * gcc.target/i386/nop-mcount.c: Only run on Linux.
diff --git a/gcc/testsuite/gcc.target/mips/20140928.c b/gcc/testsuite/gcc.target/mips/20140928.c
new file mode 100644 (file)
index 0000000..1b55bdd
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+NOMIPS16 int NoBarrier_AtomicIncrement(volatile int* ptr, int increment) {
+  int temp, temp2;
+  __asm__ __volatile__(".set push\n"
+                       ".set noreorder\n"
+                       "1:\n"
+                       "ll %0, 0(%3)\n"
+                       "addu %1, %0, %2\n"
+                       "sc %1, 0(%3)\n"
+                       "beqz %1, 1b\n"
+                       "nop\n"
+                       "addu %1, %0, %2\n"
+                       ".set pop\n"
+                       : "=&r" (temp), "=&r" (temp2)
+                       : "Ir" (increment), "r" (ptr)
+                       : "memory");
+
+  return temp2;
+}