summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/sh-relax.c
blob: 3d7e1e5fc9801159ffe631aceed797836efe7826 (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
/* Check that -mrelax works.  */
/* { dg-do run { target sh-*-* sh?-*-* } } */
/* { dg-options "-O1 -mrelax" } */

extern int qwerty (int);

int
f (int i)
{
  return qwerty (i) + 1;
}

int
qwerty (int i)
{
  switch (i)
    {
    case 1:
      return 'q';
    case 2:
      return 'w';
    case 3:
      return 'e';
    case 4:
      return 'r';
    case 5:
      return 't';
    case 6:
      return 'y';
    }
}

int
main ()
{
  if (f (1) != 'q' + 1 || f (2) != 'w' + 1 || f (3) != 'e' + 1
      || f(4) != 'r' + 1 || f (5) != 't' + 1 || f (6) != 'y' + 1)
    abort ();
  return 0;
}