This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SH] PR 55146 - Add testcase


Hi,

The attached patch adds the testcase as it was originally reported in
the PR.  Although it's not a problem on 4.8, I think it would be better
to have this in the test suite.
Tested with
make -k check-gcc RUNTESTFLAGS="sh.exp=pr55146.c --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

OK for trunk?

Cheers,
Oleg

testsuite/ChangeLog:

	PR target/55146:
	* gcc.target/sh/pr55146.c: New.
Index: gcc/testsuite/gcc.target/sh/pr55146.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr55146.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr55146.c	(revision 0)
@@ -0,0 +1,50 @@
+/* Check that the 'extu.b' instruction is generated for short jump tables.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-Os" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */
+/* { dg-final { scan-assembler "extu.b" } } */
+
+int
+test (int arg)
+{
+  int rc;
+  switch (arg)
+    {
+    case 0:
+      asm ("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "mov r4,%0"
+	   : "=r" (rc)
+	   : "r" (arg));
+      break;
+    case 1:
+      asm ("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "mov r5,%0"
+	   : "=r" (rc)
+	   : "r" (arg));
+      break;
+    case 2:
+      asm ("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "mov r6,%0"
+	   : "=r" (rc)
+	   : "r" (arg));
+      break;
+    case 3:
+      asm ("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "mov r7,%0"
+	   : "=r" (rc)
+	   : "r" (arg));
+      break;
+    case 4:
+      asm ("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
+	   "mov r8,%0"
+	   : "=r" (rc)
+	   : "r" (arg));
+      break;
+    }
+  return rc;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]