[11/11] rs6000 - add speculation_barrier pattern

Message ID 1532684275-13041-12-git-send-email-Richard.Earnshaw@arm.com
State New
Headers show
Series
  • (v2) Mitigation against unsafe data speculation (CVE-2017-5753)
Related show

Commit Message

Richard Earnshaw (lists) July 27, 2018, 9:37 a.m.
This patch reworks the existing rs6000_speculation_barrier pattern to
work with the new __builtin_sepculation_safe_value() intrinsic.  The
change is trivial as it simply requires renaming the existing speculation
barrier pattern.

So the total patch is to delete 14 characters!

	* config/rs6000/rs6000.md (speculation_barrier): Renamed from
	rs6000_speculation_barrier.
	* config/rs6000/rs6000.c (rs6000_expand_builtin): Adjust for
	new barrier pattern name.
---
 gcc/config/rs6000/rs6000.c  | 2 +-
 gcc/config/rs6000/rs6000.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Bill Schmidt July 31, 2018, 10:01 p.m. | #1
Hi Richard,

I can't ack the patch, but I am happy with it.  Thank you for this work!

-- Bill

Bill Schmidt, Ph.D.
STSM, GCC Architect for Linux on Power
IBM Linux Technology Center
wschmidt@linux.vnet.ibm.com

> On Jul 27, 2018, at 4:37 AM, Richard Earnshaw <richard.earnshaw@arm.com> wrote:

> 

> 

> This patch reworks the existing rs6000_speculation_barrier pattern to

> work with the new __builtin_sepculation_safe_value() intrinsic.  The

> change is trivial as it simply requires renaming the existing speculation

> barrier pattern.

> 

> So the total patch is to delete 14 characters!

> 

> 	* config/rs6000/rs6000.md (speculation_barrier): Renamed from

> 	rs6000_speculation_barrier.

> 	* config/rs6000/rs6000.c (rs6000_expand_builtin): Adjust for

> 	new barrier pattern name.

> ---

> gcc/config/rs6000/rs6000.c  | 2 +-

> gcc/config/rs6000/rs6000.md | 2 +-

> 2 files changed, 2 insertions(+), 2 deletions(-)

> 

> <0011-rs6000-add-speculation_barrier-pattern.patch>
Segher Boessenkool July 31, 2018, 11:30 p.m. | #2
On Tue, Jul 31, 2018 at 05:01:02PM -0500, Bill Schmidt wrote:
> > On Jul 27, 2018, at 4:37 AM, Richard Earnshaw <richard.earnshaw@arm.com> wrote:

> > This patch reworks the existing rs6000_speculation_barrier pattern to

> > work with the new __builtin_sepculation_safe_value() intrinsic.  The

> > change is trivial as it simply requires renaming the existing speculation

> > barrier pattern.

> > 

> > So the total patch is to delete 14 characters!


> I can't ack the patch, but I am happy with it.  Thank you for this work!


Looks fine to me, too.  I'm sure someone has tested it by now, too ;-)
Okay for trunk.  Thanks!


Segher


> > 	* config/rs6000/rs6000.md (speculation_barrier): Renamed from

> > 	rs6000_speculation_barrier.

> > 	* config/rs6000/rs6000.c (rs6000_expand_builtin): Adjust for

> > 	new barrier pattern name.

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 1976072..46c6838 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16179,7 +16179,7 @@  rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
 
     case MISC_BUILTIN_SPEC_BARRIER:
       {
-	emit_insn (gen_rs6000_speculation_barrier ());
+	emit_insn (gen_speculation_barrier ());
 	return NULL_RTX;
       }
 
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 44d32d9..03870e9 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -12614,7 +12614,7 @@  (define_insn "group_ending_nop"
   return "ori 2,2,0";
 })
 
-(define_insn "rs6000_speculation_barrier"
+(define_insn "speculation_barrier"
   [(unspec_volatile:BLK [(const_int 0)] UNSPECV_SPEC_BARRIER)]
   ""
   "ori 31,31,0")