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