Small retpoline clean-up.
authorMartin Liska <mliska@suse.cz>
Thu, 18 Jan 2018 13:13:23 +0000 (14:13 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 18 Jan 2018 13:13:23 +0000 (13:13 +0000)
2018-01-18  Martin Liska  <mliska@suse.cz>

* 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  <mliska@suse.cz>

* 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

12 files changed:
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
gcc/testsuite/gcc.target/i386/ret-thunk-10.c
gcc/testsuite/gcc.target/i386/ret-thunk-11.c
gcc/testsuite/gcc.target/i386/ret-thunk-12.c
gcc/testsuite/gcc.target/i386/ret-thunk-15.c
gcc/testsuite/gcc.target/i386/ret-thunk-9.c

index 61b003a138f7b4dda0d41c47ec81642755d74e96..5eb37fa6f969d7617c5491b8e4941a3ab6ff129a 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-18  Martin Liska  <mliska@suse.cz>
+
+       * 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  <rguenther@suse.de>
 
        PR tree-optimization/83887
index cb0f4ed5e6a3be1ec33afdcbe927fc0ab522db98..72d25ae4f72240088cdf3c309fc812ffc7cd6769 100644 (file)
@@ -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.  */
index 73a7b0c21482807e3ae0ae24f301bb645d7f1e35..f20400de97b68374bba6d1ed09bac57eea47b53b 100644 (file)
@@ -1,3 +1,15 @@
+2018-01-18  Martin Liska  <mliska@suse.cz>
+
+       * 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  <christophe.lyon@linaro.org>
 
        * gcc.target/arm/xor-and.c: Fix dg-options and dg-add-options
index 9e24a385387bec721f06183c9c5b68d861a83486..dab7ac2ef2563c51cf665efd13304dd19b84800c 100644 (file)
@@ -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);
 
index 127b5d94523466ba3d815005f7699d1a29492aa5..44cc5f52f45181d9b967e041f30e34cd48af64a4 100644 (file)
@@ -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);
 
index e4649283d100df2aadb65e4e2c90612cf1041861..1490f5336cae963f7e76569d5def7d8803f627b8 100644 (file)
@@ -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);
 
index 0e19830de4dc53d94f40bfacb364a463001307ec..a5fc4a23351922db67215660faf78690d435d3de 100644 (file)
@@ -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];
index e6fea84a4d93584455d4dcd1ce873b274f4e59da..6de9b8c9f4fe56c074fa84174860fd06e0815a18 100644 (file)
@@ -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);
 
index e239ec4542fed44f02d8e01db230e7b73711b8fa..3659803754159c3805f7372ed2d7298c3302cbbc 100644 (file)
@@ -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);
 
index fa3181303c9617e01338491d65f16b8298520f8f..5fb1a4de7768874226be49b6f0adaaf2429d1c59 100644 (file)
@@ -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);
 
index 75e45e226b8bd2218f32e1499a1b7e1355a027e2..2038644aa59465776d72a7d942df0966d12ea007 100644 (file)
@@ -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);
 
index d1db41cc128d9d1e8ff3966cebd8c991a7452a97..d34dd4e6dc7f10270fd3092698d19eaa036df5b7 100644 (file)
@@ -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);