aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/pr55146.c
blob: 91f09359d1c723f7eb4650599589850d01cf8ba0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Check that the 'extu.b' instruction is generated for short jump tables.  */
/* { dg-do compile }  */
/* { 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;
}