blob: fad7dc4e54de2af6d34b4f3300f7d11b63761257 (
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
|
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-options "-O2 --param case-values-threshold=20" } */
/* { dg-final { scan-assembler-not "mtctr" } } */
/* { dg-final { scan-assembler-not "bctr" } } */
/* Force using if tests, instead of a dispatch table. */
extern long call (long);
long
test_switch (long a, long b)
{
long c;
switch (a)
{
case 0: c = -b; break;
case 1: c = ~b; break;
case 2: c = b+1; break;
case 3: c = b-2; break;
case 4: c = b*3; break;
case 5: c = b/4; break;
case 6: c = b<<5; break;
case 7: c = b>>6; break;
case 8: c = b|7; break;
case 9: c = b^8; break;
default: c = b&9; break;
}
return call (c) + 1;
}
|