1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-options "-O2 --param case-values-threshold=2" } */
4 /* { dg-final { scan-assembler "mtctr" } } */
5 /* { dg-final { scan-assembler "bctr" } } */
6 
7 /* Force using a dispatch table even though by default we would generate
8    ifs.  */
9 
10 extern long call (long);
11 
12 long
test_switch(long a,long b)13 test_switch (long a, long b)
14 {
15   long c;
16 
17   switch (a)
18     {
19     case 0:  c = -b;	break;
20     case 1:  c = ~b;	break;
21     case 2:  c = b+1;	break;
22     default: c = b & 9;	break;
23     }
24 
25   return call (c) + 1;
26 }
27