s390: Streamline NNPA builtins with POP mnemonics

Message ID 20240301151831.1785057-1-stefansf@linux.ibm.com
State Unresolved
Headers
Series s390: Streamline NNPA builtins with POP mnemonics |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Stefan Schulze Frielinghaus March 1, 2024, 3:18 p.m. UTC
  At the moment there are no extended mnemonics for vclfn(h,l) and vcrnf
defined in the Principles of Operation.  Thus, remove the suffix "s"
from the builtins and expanders and introduce a further operand for the
data type.

gcc/ChangeLog:

	* config/s390/s390-builtin-types.def: Update to reflect latest
	changes.
	* config/s390/s390-builtins.def: Remove suffix s from
	s390_vclfn(h,l)s and s390_vcrnfs.
	* config/s390/s390.md: Similar, remove suffix s from unspec
	definitions.
	* config/s390/vecintrin.h (vec_extend_to_fp32_hi): Redefine.
	(vec_extend_to_fp32_lo): Redefine.
	(vec_round_from_fp32): Redefine.
	* config/s390/vx-builtins.md (vclfnhs_v8hi): Remove suffix s.
	(vclfnh_v8hi): Add with extra operand.
	(vclfnls_v8hi): Remove suffix s.
	(vclfnl_v8hi): Add with extra operand.
	(vcrnfs_v8hi): Remove suffix s.
	(vcrnf_v8hi): Add with extra operand.
---
OK for mainline?

 gcc/config/s390/s390-builtin-types.def |  4 ++--
 gcc/config/s390/s390-builtins.def      |  6 +++---
 gcc/config/s390/s390.md                |  6 +++---
 gcc/config/s390/vecintrin.h            |  6 +++---
 gcc/config/s390/vx-builtins.md         | 27 ++++++++++++++------------
 5 files changed, 26 insertions(+), 23 deletions(-)
  

Patch

diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def
index ce51ae8cd3f..c3d09b42835 100644
--- a/gcc/config/s390/s390-builtin-types.def
+++ b/gcc/config/s390/s390-builtin-types.def
@@ -273,7 +273,6 @@  DEF_FN_TYPE_2 (BT_FN_V2DI_V2DF_V2DF, BT_V2DI, BT_V2DF, BT_V2DF)
 DEF_FN_TYPE_2 (BT_FN_V2DI_V2DI_V2DI, BT_V2DI, BT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8HI, BT_V4SF, BT_V4SF, BT_UINT, BT_UINT)
 DEF_FN_TYPE_4 (BT_FN_VOID_UV2DI_UV2DI_ULONGLONGPTR_ULONGLONG, BT_VOID, BT_UV2DI, BT_UV2DI, BT_ULONGLONGPTR, BT_ULONGLONG)
 DEF_FN_TYPE_4 (BT_FN_VOID_UV4SI_UV4SI_UINTPTR_ULONGLONG, BT_VOID, BT_UV4SI, BT_UV4SI, BT_UINTPTR, BT_ULONGLONG)
 DEF_FN_TYPE_4 (BT_FN_VOID_V4SI_V4SI_INTPTR_ULONGLONG, BT_VOID, BT_V4SI, BT_V4SI, BT_INTPTR, BT_ULONGLONG)
diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def
index 02ff516c677..0d4e20ea425 100644
--- a/gcc/config/s390/s390-builtins.def
+++ b/gcc/config/s390/s390-builtins.def
@@ -3025,10 +3025,10 @@  B_DEF      (s390_vstrszf,                vstrszv4si,        0,
 
 /* arch 14 builtins */
 
-B_DEF      (s390_vclfnhs,                vclfnhs_v8hi,      0,                  B_NNPA,             O2_U4,              BT_FN_V4SF_UV8HI_UINT)
-B_DEF      (s390_vclfnls,                vclfnls_v8hi,      0,                  B_NNPA,             O2_U4,              BT_FN_V4SF_UV8HI_UINT)
+B_DEF      (s390_vclfnh,                 vclfnh_v8hi,       0,                  B_NNPA,             O2_U4 | O3_U4,      BT_FN_V4SF_UV8HI_UINT_UINT)
+B_DEF      (s390_vclfnl,                 vclfnl_v8hi,       0,                  B_NNPA,             O2_U4 | O3_U4,      BT_FN_V4SF_UV8HI_UINT_UINT)
 
-B_DEF      (s390_vcrnfs,                 vcrnfs_v8hi,       0,                  B_NNPA,             O3_U4,              BT_FN_UV8HI_V4SF_V4SF_UINT)
+B_DEF      (s390_vcrnf,                  vcrnf_v8hi,        0,                  B_NNPA,             O3_U4 | O4_U4,      BT_FN_UV8HI_V4SF_V4SF_UINT_UINT)
 
 B_DEF      (s390_vcfn,                   vcfn_v8hi,         0,                  B_NNPA,             O2_U4,              BT_FN_UV8HI_UV8HI_UINT)
 B_DEF      (s390_vcnf,                   vcnf_v8hi,         0,                  B_NNPA,             O2_U4,              BT_FN_UV8HI_UV8HI_UINT)
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 8aa40ba5b7f..65d98163193 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -241,9 +241,9 @@ 
    UNSPEC_VEC_VFMIN
    UNSPEC_VEC_VFMAX
 
-   UNSPEC_NNPA_VCLFNHS_V8HI
-   UNSPEC_NNPA_VCLFNLS_V8HI
-   UNSPEC_NNPA_VCRNFS_V8HI
+   UNSPEC_NNPA_VCLFNH_V8HI
+   UNSPEC_NNPA_VCLFNL_V8HI
+   UNSPEC_NNPA_VCRNF_V8HI
 
    UNSPEC_NNPA_VCFN_V8HI
    UNSPEC_NNPA_VCNF_V8HI
diff --git a/gcc/config/s390/vecintrin.h b/gcc/config/s390/vecintrin.h
index 9abbd761067..c690c41d8e4 100644
--- a/gcc/config/s390/vecintrin.h
+++ b/gcc/config/s390/vecintrin.h
@@ -174,9 +174,9 @@  __lcbb(const void *ptr, int bndry)
 #define vec_vsterf_flt vec_vlerf_flt
 #define vec_vsterg_dbl vec_vlerg_dbl
 
-#define vec_extend_to_fp32_hi __builtin_s390_vclfnhs
-#define vec_extend_to_fp32_lo __builtin_s390_vclfnls
-#define vec_round_from_fp32 __builtin_s390_vcrnfs
+#define vec_extend_to_fp32_hi(X, Y) __builtin_s390_vclfnh((X), 2, (Y))
+#define vec_extend_to_fp32_lo(X, Y) __builtin_s390_vclfnl((X), 2, (Y))
+#define vec_round_from_fp32(X, Y, Z) __builtin_s390_vcrnf((X), (Y), (Z), 2)
 #define vec_convert_to_fp16 __builtin_s390_vcfn
 #define vec_convert_from_fp16 __builtin_s390_vcnf
 #define vec_gather_element __builtin_s390_vec_gather_element
diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md
index 432d81a719f..322756f6d36 100644
--- a/gcc/config/s390/vx-builtins.md
+++ b/gcc/config/s390/vx-builtins.md
@@ -2220,36 +2220,39 @@ 
 ;; NNPA Facility
 ;;
 
-(define_insn "vclfnhs_v8hi"
+(define_insn "vclfnh_v8hi"
   [(set (match_operand:V4SF                0 "register_operand"  "=v")
 	(unspec:V4SF [(vec_select:V4HI
 		       (match_operand:V8HI 1 "register_operand"   "v")
 		       (parallel [(const_int 0) (const_int 1) (const_int 2) (const_int 3)]))
-		      (match_operand:QI    2 "const_mask_operand" "C")]
-		     UNSPEC_NNPA_VCLFNHS_V8HI))]
+		      (match_operand:QI    2 "const_mask_operand" "C")
+		      (match_operand:QI    3 "const_mask_operand" "C")]
+		     UNSPEC_NNPA_VCLFNH_V8HI))]
   "TARGET_NNPA"
-  "vclfnh\t%v0,%v1,2,%2"
+  "vclfnh\t%v0,%v1,%2,%3"
   [(set_attr "op_type" "VRR")])
 
-(define_insn "vclfnls_v8hi"
+(define_insn "vclfnl_v8hi"
   [(set (match_operand:V4SF                0 "register_operand"   "=v")
 	(unspec:V4SF [(vec_select:V4HI
 		       (match_operand:V8HI 1 "register_operand"   "v")
 		       (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7)]))
-		      (match_operand:QI    2 "const_mask_operand"  "C")]
-		     UNSPEC_NNPA_VCLFNLS_V8HI))]
+		      (match_operand:QI    2 "const_mask_operand"  "C")
+		      (match_operand:QI    3 "const_mask_operand"  "C")]
+		     UNSPEC_NNPA_VCLFNL_V8HI))]
   "TARGET_NNPA"
-  "vclfnl\t%v0,%v1,2,%2"
+  "vclfnl\t%v0,%v1,%2,%3"
   [(set_attr "op_type" "VRR")])
 
-(define_insn "vcrnfs_v8hi"
+(define_insn "vcrnf_v8hi"
   [(set (match_operand:V8HI               0 "register_operand"   "=v")
 	(unspec:V8HI [(match_operand:V4SF 1 "register_operand"    "v")
 		      (match_operand:V4SF 2 "register_operand"    "v")
-		      (match_operand:QI   3 "const_mask_operand"  "C")]
-		     UNSPEC_NNPA_VCRNFS_V8HI))]
+		      (match_operand:QI   3 "const_mask_operand"  "C")
+		      (match_operand:QI   4 "const_mask_operand"  "C")]
+		     UNSPEC_NNPA_VCRNF_V8HI))]
   "TARGET_NNPA"
-  "vcrnf\t%v0,%v1,%v2,%3,2"
+  "vcrnf\t%v0,%v1,%v2,%3,%4"
   [(set_attr "op_type" "VRR")])
 
 (define_insn "vcfn_v8hi"