re PR target/61142 ([SH] QImode/HImode @(R0,Rm),Rn does not load to Rn = R0)
authorOleg Endo <olegendo@gcc.gnu.org>
Sun, 1 Mar 2015 18:47:38 +0000 (18:47 +0000)
committerOleg Endo <olegendo@gcc.gnu.org>
Sun, 1 Mar 2015 18:47:38 +0000 (18:47 +0000)
gcc/testsuite/
PR target/61142
* gcc.target/sh/sh/pr61142.c: New.

From-SVN: r221089

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/pr61142.c [new file with mode: 0644]

index 33d69b01adf1e647886cb5fe9cd2ce47cbe45837..d8f5180059c1433cf85ff1434f9ad3b02b17a2e1 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-01  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/61142
+       * gcc.target/sh/sh/pr61142.c: New.
+
 2015-03-01  Eric Botcazou  <ebotcazou@adacore.com>
 
        * g++.dg/other/dump-ada-spec-3.C: New test.
diff --git a/gcc/testsuite/gcc.target/sh/pr61142.c b/gcc/testsuite/gcc.target/sh/pr61142.c
new file mode 100644 (file)
index 0000000..4f48b05
--- /dev/null
@@ -0,0 +1,30 @@
+/* Check that @(r0,rm),rn insns load into r0.  */
+/* { dg-do compile }  */
+/* { dg-options "-O2" }  */
+/* { dg-final { scan-assembler-times "mov.b\t@\\(r0,r\[0123456789\]\\),r0" 1 } }  */
+/* { dg-final { scan-assembler-times "mov.w\t@\\(r0,r\[0123456789\]\\),r0" 1 } }  */
+/* { dg-final { scan-assembler-times "mov.l\t@\\(r0,r\[0123456789\]\\),r0" 1 } }  */
+
+int
+test_00 (const char* x, int a, int b, int c)
+{
+  if (x[a] == 92)
+    return b;
+  return c;
+}
+
+int
+test_01 (const short* x, int a, int b, int c)
+{
+  if (x[a] == 92)
+    return b;
+  return c;
+}
+
+int
+test_02 (const int* x, int a, int b, int c)
+{
+  if (x[a] == 92)
+    return b;
+  return c;
+}