1 /* { dg-do run } */
2 /* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table" } */
3
4 /* We have to generate different thunks for indirect branches
5 depending on whether the code is compiled for pre z10 machines or
6 later. This testcase makes sure this works within the same compile
7 unit. */
8
9 int __attribute__((noinline,noclone,target("arch=z10")))
bar(int a)10 bar (int a)
11 {
12 return a + 2;
13 }
14
15 int __attribute__((noinline,noclone,target("arch=z9-ec")))
foo(int a)16 foo (int a)
17 {
18 return a + 3;
19 }
20
21 int
main()22 main ()
23 {
24 if (bar (42) != 44)
25 __builtin_abort ();
26
27 if (foo (42) != 45)
28 __builtin_abort ();
29
30 return 0;
31 }
32
33 /* 1 x bar, 1 x foo */
34 /* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
35 /* 1 x foo */
36 /* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump_r1use" 1 } } */
37
38 /* { dg-final { scan-assembler-times "ex\t" 1 } } */
39 /* { dg-final { scan-assembler-times "exrl\t" 1 } } */
40
41 /* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
42 /* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
43 /* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
44 /* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
45