[gcc(refs/users/meissner/heads/work042)] Make xxsplt* insns prefixed.

Michael Meissner meissner@gcc.gnu.org
Fri Mar 19 00:04:49 GMT 2021


https://gcc.gnu.org/g:a5b2f3da85f4b5eb4f1368e73cd458dbd689b71a

commit a5b2f3da85f4b5eb4f1368e73cd458dbd689b71a
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Thu Mar 18 20:04:08 2021 -0400

    Make xxsplt* insns prefixed.
    
    The XXSPLTIW, XXSPLTIDP, and XXSPLTI32DX are prefixed instructions, but they
    don't use an initial 'p' in the instruction.  This patch marks these
    instructions as prefixed.
    
    A new attribute (prefixed_prepend_p) is added to control whether a prefixed
    instruction prepends a leading 'p'.  The XXSPLT instructions set this attribute
    to not prepend the 'p'.
    
    gcc/
    2021-03-18  Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/altivec.md (xxspltiw_v4si): Set prefixed and
            prefixed_prepend_p attributes.
            (xxspltiw_v4sf): Set prefixed and prefixed_prepend_p attributes.
            (xxspltidp_v2df): Set prefixed and prefixed_prepend_p attributes.
            (xxsplti32dx_v4si): Set prefixed and prefixed_prepend_p
            attributes.
            (xxsplti32dx_v4sf): Set prefixed and prefixed_prepend_p
            attributes.
            * config/rs6000/rs6000.c (rs6000_final_prescan_insn): If the
            prefixed_prepend_p attribute is no, do not add a leading 'p'.
            * config/rs6000/rs6000.md (prefixed_prepend_p): New attribute.

Diff:
---
 gcc/config/rs6000/altivec.md | 20 +++++++++++++++-----
 gcc/config/rs6000/rs6000.c   |  5 ++++-
 gcc/config/rs6000/rs6000.md  |  4 ++++
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 27a269b9e72..4799560e2c3 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -826,7 +826,9 @@
 		     UNSPEC_XXSPLTIW))]
  "TARGET_POWER10"
  "xxspltiw %x0,%1"
- [(set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")
+  (set_attr "prefixed" "yes")
+  (set_attr "prefixed_prepend_p" "no")])
 
 (define_expand "xxspltiw_v4sf"
   [(set (match_operand:V4SF 0 "register_operand" "=wa")
@@ -845,7 +847,9 @@
 		     UNSPEC_XXSPLTIW))]
  "TARGET_POWER10"
  "xxspltiw %x0,%1"
- [(set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")
+  (set_attr "prefixed" "yes")
+  (set_attr "prefixed_prepend_p" "no")])
 
 (define_expand "xxspltidp_v2df"
   [(set (match_operand:V2DF 0 "register_operand" )
@@ -864,7 +868,9 @@
 		     UNSPEC_XXSPLTID))]
   "TARGET_POWER10"
   "xxspltidp %x0,%1"
-  [(set_attr "type" "vecsimple")])
+  [(set_attr "type" "vecsimple")
+  (set_attr "prefixed" "yes")
+  (set_attr "prefixed_prepend_p" "no")])
 
 (define_expand "xxsplti32dx_v4si"
   [(set (match_operand:V4SI 0 "register_operand" "=wa")
@@ -893,7 +899,9 @@
 		     UNSPEC_XXSPLTI32DX))]
   "TARGET_POWER10"
   "xxsplti32dx %x0,%2,%3"
-  [(set_attr "type" "vecsimple")])
+  [(set_attr "type" "vecsimple")
+   (set_attr "prefixed" "yes")
+   (set_attr "prefixed_prepend_p" "no")])
 
 (define_expand "xxsplti32dx_v4sf"
   [(set (match_operand:V4SF 0 "register_operand" "=wa")
@@ -921,7 +929,9 @@
 		     UNSPEC_XXSPLTI32DX))]
   "TARGET_POWER10"
   "xxsplti32dx %x0,%2,%3"
-  [(set_attr "type" "vecsimple")])
+  [(set_attr "type" "vecsimple")
+   (set_attr "prefixed" "yes")
+   (set_attr "prefixed_prepend_p" "no")])
 
 (define_insn "xxblend_<mode>"
   [(set (match_operand:VM3 0 "register_operand" "=wa")
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c424cd5c45a..f3ee3a7ea22 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -26288,7 +26288,10 @@ static bool prepend_p_to_next_insn;
 void
 rs6000_final_prescan_insn (rtx_insn *insn, rtx [], int)
 {
-  prepend_p_to_next_insn = (get_attr_prefixed (insn) != PREFIXED_NO);
+  prepend_p_to_next_insn
+    = (get_attr_prefixed (insn) != PREFIXED_NO
+       && get_attr_prefixed_prepend_p (insn) != PREFIXED_PREPEND_P_NO);
+
   return;
 }
 
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index ceeacd61fed..aaefce38af3 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -292,6 +292,10 @@
 
 	(const_string "no")))
 
+;; Whether we need to prepend a 'p' to the next insn if the insn is prefixed.
+(define_attr "prefixed_prepend_p" "no,yes"
+  (const_string "yes"))
+
 ;; Whether an insn loads an external address for the PCREL_OPT optimizaton.
 (define_attr "loads_external_address" "no,yes"
   (const_string "no"))


More information about the Gcc-cvs mailing list