diff mbox

[SH] PR 55146 - Add testcase

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

Commit Message

Oleg Endo Feb. 3, 2013, 8:54 p.m. UTC
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.

Comments

Kaz Kojima Feb. 3, 2013, 11:02 p.m. UTC | #1
Oleg Endo <oleg.endo@t-online.de> wrote:
> 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?

OK.

Regards,
	kaz
diff mbox

Patch

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;
+}