diff mbox

[SH,committed] Add test case for PR 61142

Message ID 1425235741.16721.67.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo March 1, 2015, 6:49 p.m. UTC
Hi,

This adds a test case for PR 61142.
Tested with
make -k check-gcc RUNTESTFLAGS="sh.exp=pr61142.c --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

Committed as r221089.

Cheers,
Oleg

gcc/testsuite/ChangeLog:
	PR target/61142
	* gcc.target/sh/sh/pr61142.c: New.
diff mbox

Patch

Index: gcc/testsuite/gcc.target/sh/pr61142.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr61142.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr61142.c	(revision 0)
@@ -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;
+}