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")))
10 void
male_indirect_jump(long offset)11 male_indirect_jump (long offset)
12 {
13 dispatch[offset](offset);
14 }
15
16 /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*dispatch" { target *-*-linux* } } } */
17 /* { dg-final { scan-assembler {movq[ \t]*_dispatch} { target { lp64 && *-*-darwin* } } } } */
18 /* { dg-final { scan-assembler {movl[ \t]*[Ll]_dispatch\$non_lazy_ptr-L[0-9]+\$pb} { target { ia32 && *-*-darwin* } } } } */
19 /* { dg-final { scan-assembler "jmp\[ \t\]*_?__x86_indirect_thunk_(r|e)ax" } } */
20 /* { dg-final { scan-assembler {jmp[ \t]*\.?LIND} } } */
21 /* { dg-final { scan-assembler {call[ \t]*\.?LIND} } } */
22 /* { dg-final { scan-assembler {\tpause} } } */
23 /* { dg-final { scan-assembler {\tlfence} } } */
24