From: Martin Liska Date: Thu, 18 Jan 2018 13:13:23 +0000 (+0100) Subject: Small retpoline clean-up. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82a7bb2dff8f2055e64f14cff0e3e29d0c83c195;p=gcc.git Small retpoline clean-up. 2018-01-18 Martin Liska * config/i386/i386.c (indirect_thunk_name): Document that also lfence is emitted. (output_indirect_thunk): Document why both instructions (pause and lfence) are generated. 2018-01-18 Martin Liska * gcc.target/i386/indirect-thunk-3.c: Remove duplicate options. * gcc.target/i386/indirect-thunk-4.c: Likewise. * gcc.target/i386/indirect-thunk-6.c: Likewise. * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise. * gcc.target/i386/ret-thunk-10.c: Likewise. * gcc.target/i386/ret-thunk-11.c: Likewise. * gcc.target/i386/ret-thunk-12.c: Likewise. * gcc.target/i386/ret-thunk-15.c: Likewise. * gcc.target/i386/ret-thunk-9.c: Likewise. From-SVN: r256846 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61b003a138f..5eb37fa6f96 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-01-18 Martin Liska + + * config/i386/i386.c (indirect_thunk_name): Document that also + lfence is emitted. + (output_indirect_thunk): Document why both instructions + (pause and lfence) are generated. + 2018-01-18 Richard Biener PR tree-optimization/83887 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index cb0f4ed5e6a..72d25ae4f72 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -10826,6 +10826,7 @@ indirect_thunk_name (char name[32], unsigned int regno, call L2 L1: pause + lfence jmp L1 L2: mov %REG, (%sp) @@ -10837,6 +10838,7 @@ indirect_thunk_name (char name[32], unsigned int regno, call L2 L1: pause + lfence jmp L1 L2: lea WORD_SIZE(%sp), %sp @@ -10864,7 +10866,8 @@ output_indirect_thunk (bool need_bnd_p, unsigned int regno) ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1); - /* Pause + lfence. */ + /* AMD and Intel CPUs prefer each a different instruction as loop filler. + Usage of both pause + lfence is compromise solution. */ fprintf (asm_out_file, "\tpause\n\tlfence\n"); /* Jump. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 73a7b0c2148..f20400de97b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2018-01-18 Martin Liska + + * gcc.target/i386/indirect-thunk-3.c: Remove duplicate options. + * gcc.target/i386/indirect-thunk-4.c: Likewise. + * gcc.target/i386/indirect-thunk-6.c: Likewise. + * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise. + * gcc.target/i386/ret-thunk-10.c: Likewise. + * gcc.target/i386/ret-thunk-11.c: Likewise. + * gcc.target/i386/ret-thunk-12.c: Likewise. + * gcc.target/i386/ret-thunk-15.c: Likewise. + * gcc.target/i386/ret-thunk-9.c: Likewise. + 2018-01-18 Christophe Lyon * gcc.target/arm/xor-and.c: Fix dg-options and dg-add-options diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c index 9e24a385387..dab7ac2ef25 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ typedef void (*dispatch_t)(long offset); diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c index 127b5d94523..44cc5f52f45 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ typedef void (*dispatch_t)(long offset); diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c index e4649283d10..1490f5336ca 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c @@ -1,5 +1,5 @@ /* { dg-do compile { target *-*-linux* } } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ extern void bar (void); diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c index 0e19830de4d..a5fc4a23351 100644 --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ void bar (char *); char buf[10]; diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c index e6fea84a4d9..6de9b8c9f4f 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */ extern void (*bar) (void); diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c index e239ec4542f..36598037541 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */ extern void (*bar) (void); diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c index fa3181303c9..5fb1a4de776 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ extern void (*bar) (void); diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c index 75e45e226b8..2038644aa59 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */ extern void (*bar) (void); diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c index d1db41cc128..d34dd4e6dc7 100644 --- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */ +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */ extern void (*bar) (void);