1 /* { dg-do run } */
2 /* { dg-options "-O3 -march=z10 -mzarch --save-temps -mindirect-branch-jump=thunk-inline -mindirect-branch-table" } */
3 
4 /* case-values-threshold will be set to 20 by the back-end when jump
5    thunk are requested.  */
6 
foo1(void)7 int __attribute__((noinline,noclone)) foo1 (void) { return 1; }
foo2(void)8 int __attribute__((noinline,noclone)) foo2 (void) { return 2; }
foo3(void)9 int __attribute__((noinline,noclone)) foo3 (void) { return 3; }
foo4(void)10 int __attribute__((noinline,noclone)) foo4 (void) { return 4; }
foo5(void)11 int __attribute__((noinline,noclone)) foo5 (void) { return 5; }
foo6(void)12 int __attribute__((noinline,noclone)) foo6 (void) { return 6; }
foo7(void)13 int __attribute__((noinline,noclone)) foo7 (void) { return 7; }
foo8(void)14 int __attribute__((noinline,noclone)) foo8 (void) { return 8; }
foo9(void)15 int __attribute__((noinline,noclone)) foo9 (void) { return 9; }
foo10(void)16 int __attribute__((noinline,noclone)) foo10 (void) { return 10; }
foo11(void)17 int __attribute__((noinline,noclone)) foo11 (void) { return 11; }
foo12(void)18 int __attribute__((noinline,noclone)) foo12 (void) { return 12; }
foo13(void)19 int __attribute__((noinline,noclone)) foo13 (void) { return 13; }
foo14(void)20 int __attribute__((noinline,noclone)) foo14 (void) { return 14; }
foo15(void)21 int __attribute__((noinline,noclone)) foo15 (void) { return 15; }
foo16(void)22 int __attribute__((noinline,noclone)) foo16 (void) { return 16; }
foo17(void)23 int __attribute__((noinline,noclone)) foo17 (void) { return 17; }
foo18(void)24 int __attribute__((noinline,noclone)) foo18 (void) { return 18; }
foo19(void)25 int __attribute__((noinline,noclone)) foo19 (void) { return 19; }
foo20(void)26 int __attribute__((noinline,noclone)) foo20 (void) { return 20; }
27 
28 
29 int __attribute__((noinline,noclone))
bar(int a)30 bar (int a)
31 {
32   int ret = 0;
33 
34   switch (a)
35     {
36     case 1: ret = foo1 (); break;
37     case 2: ret = foo2 (); break;
38     case 3: ret = foo3 (); break;
39     case 4: ret = foo4 (); break;
40     case 5: ret = foo5 (); break;
41     case 6: ret = foo6 (); break;
42     case 7: ret = foo7 (); break;
43     case 8: ret = foo8 (); break;
44     case 9: ret = foo9 (); break;
45     case 10: ret = foo10 (); break;
46     case 11: ret = foo11 (); break;
47     case 12: ret = foo12 (); break;
48     case 13: ret = foo13 (); break;
49     case 14: ret = foo14 (); break;
50     case 15: ret = foo15 (); break;
51     case 16: ret = foo16 (); break;
52     case 17: ret = foo17 (); break;
53     case 18: ret = foo18 (); break;
54     case 19: ret = foo19 (); break;
55     case 20: ret = foo20 (); break;
56     default:
57       __builtin_abort ();
58     }
59 
60   return ret;
61 }
62 
63 int
main()64 main ()
65 {
66   if (bar (3) != 3)
67     __builtin_abort ();
68 
69   return 0;
70 }
71 
72 /* 1 x bar
73 /* { dg-final { scan-assembler-times "exrl" 1 } } */
74 
75 /* { dg-final { scan-assembler     "section\t.s390_indirect_jump" } } */
76 /* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
77 /* { dg-final { scan-assembler-not "section\t.s390_return_fromreg" } } */
78 /* { dg-final { scan-assembler-not "section\t.s390_return_frommem" } } */
79