1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep " } */
3 /* { dg-additional-options "-fno-pic" { target { ! *-*-darwin* } } } */
4
5 typedef void (*dispatch_t)(long offset);
6
7 dispatch_t dispatch[256];
8
9 __attribute__ ((indirect_branch("thunk-inline")))
10 int
male_indirect_jump(long offset)11 male_indirect_jump (long offset)
12 {
13 dispatch[offset](offset);
14 return 0;
15 }
16
17 /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */
18 /* { dg-final { scan-assembler {leaq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */
19 /* { dg-final { scan-assembler {movl[ \t]*_dispatch-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */
20 /* { dg-final { scan-assembler-times {jmp[ \t]*\.?LIND} 2 } } */
21 /* { dg-final { scan-assembler-times {call[ \t]*\.?LIND} 2 } } */
22 /* { dg-final { scan-assembler {\tpause} } } */
23 /* { dg-final { scan-assembler {\tlfence} } } */
24 /* { dg-final { scan-assembler-not "_?__x86_indirect_thunk" } } */
25