x86: Add -mindirect-branch-register
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / indirect-thunk-attr-6.c
blob4e33a6388629ccaf232bb59bf1853aea58ffda09
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
4 typedef void (*dispatch_t)(long offset);
6 dispatch_t dispatch[256];
8 __attribute__ ((indirect_branch("thunk-extern")))
9 int
10 male_indirect_jump (long offset)
12 dispatch[offset](offset);
13 return 0;
16 /* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
17 /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
18 /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
19 /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
20 /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
21 /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */