[gcc(refs/users/wschmidt/heads/builtins2)] Bugs with RES_RANGE recognition; more builtins.

William Schmidt wschmidt@gcc.gnu.org
Thu Mar 26 14:59:33 GMT 2020


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

commit bc4e2e40b9f3e02ea94b252744486ece28441b0b
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Mar 26 09:58:58 2020 -0500

    Bugs with RES_RANGE recognition; more builtins.
    
    2020-03-26  Bill Schmidt  <wschmidt@linux.ibm.com>
    
            * gcc/config/rs6000/rs6000-builtin-new.def: More builtins.
            * gcc/config/rs6000/rs6000-builtin.def: One more comment.
            * gcc/config/rs6000/rs6000-call.c: One more comment.
            * gcc/config/rs6000/rs6000-gen-builtins.c
            (match_to_right_bracket): Fix typo in error message.
            (match_const_restriction): Adjust pos after commas.
            (match_type): Recognize start of a RES_RANGE sequence.

Diff:
---
 gcc/config/rs6000/rs6000-builtin-new.def | 141 +++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-builtin.def     |   1 +
 gcc/config/rs6000/rs6000-call.c          |   1 +
 gcc/config/rs6000/rs6000-gen-builtins.c  |   6 +-
 4 files changed, 147 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-builtin-new.def b/gcc/config/rs6000/rs6000-builtin-new.def
index d96d8367512..7e58e5db405 100644
--- a/gcc/config/rs6000/rs6000-builtin-new.def
+++ b/gcc/config/rs6000/rs6000-builtin-new.def
@@ -2282,6 +2282,24 @@
   const vull __builtin_altivec_vbpermd (vull, vuc);
     VBPERMD altivec_vbpermd {}
 
+  const unsigned char __builtin_altivec_vextublx (unsigned int, vuc);
+    VEXTUBLX vextublx {}
+
+  const unsigned char __builtin_altivec_vextubrx (unsigned int, vuc);
+    VEXTUBRX vextubrx {}
+
+  const unsigned short __builtin_altivec_vextuhlx (unsigned int, vus);
+    VEXTUHLX vextuhlx {}
+
+  const unsigned short __builtin_altivec_vextuhrx (unsigned int, vus);
+    VEXTUHRX vextuhrx {}
+
+  const unsigned int __builtin_altivec_vextuwlx (unsigned int, vui);
+    VEXTUWLX vextuwlx {}
+
+  const unsigned int __builtin_altivec_vextuwrx (unsigned int, vui);
+    VEXTUWRX vextuwrx {}
+
   const vull __builtiin_altivec_vrldmi (vull, vull, vull);
     VRLDMI altivec_vrldmi {}
 
@@ -2300,6 +2318,84 @@
   const vuc __builtin_altivec_vsrv (vuc, vuc);
     VSRV vsrv {}
 
+  const vull __builtin_vsx_extract_exp_dp (vd);
+    VEEDP xvxexpdp {}
+
+  const vui __builtin_vsx_extract_exp_sp (vf);
+    VEESP xvxexpsp {}
+
+  const vull __builtin_vsx_extract_sig_dp (vd);
+    VESDP xvxsigdp {}
+
+  const vui __builtin_vsx_extract_sig_sp (vf);
+    VESSP xvxsigsp {}
+
+  const vuc __builtin_vsx_insert4b (vsi, vuc, const int[0,12]);
+    INSERT4B insert4b {}
+
+  const vd __builtin_vsx_insert_exp_dp (vop, vull);
+    VIEDP xviexpdp {}
+
+  const vf __builtin_vsx_insert_exp_sp (vop, vull);
+    VIESP xviexpsp {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_dp_eq (double, double);
+    VSCEDPEQ xscmpexpdp_eq {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_dp_gt (double, double);
+    VSCEDPGT xscmpexpdp_gt {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_dp_lt (double, double);
+    VSCEDPLT xscmpexpdp_lt {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_dp_unordered (double, double);
+    VSCEDPUO xscmpexpdp_unordered {}
+
+  const unsigned int __builtin_vsx_scalar_test_data_class_dp (double, signed int);
+    VSTDCDP xststdcdp {}
+
+  const unsigned int __builtin_vsx_scalar_test_data_class_sp (float, signed int);
+    VSTDCSP xststdcsp {}
+
+  const unsigned int __builtin_vsx_scalar_test_neg_dp (double);
+    VSTDCNDP xststdcnegdp {}
+
+  const unsigned int __builtin_vsx_scalar_test_neg_sp (float);
+    VSTDCNSP xststdcnegsp {}
+
+  const unsigned long long __builtin_vsx_test_data_class_dp (vd, signed int);
+    VTDCDP xvtstdcdp {}
+
+  const unsigned int __builtin_vsx_test_data_class_sp (vf, signed int);
+    VTDCSP xvtstdcsp {}
+
+  const vf __builtin_vsx_vextract_fp_from_shorth (vus);
+    VEXTRACT_FP_FROM_SHORTH vextract_fp_from_shorth {}
+
+  const vf __builtin_vsx_vextract_fp_from_shortl (vus);
+    VEXTRACT_FP_FROM_SHORTL vextract_fp_from_shortl {}
+
+  const vd __builtin_vsx_xxbrd_v2df (vd);
+    XXBRD_V2DF p9_xxbrd_v2df {}
+
+  const vsll __builtin_vsx_xxbrd_v2di (vsll);
+    XXBRD_V2DI p9_xxbrd_v2di {}
+
+  const vss __builtin_vsx_xxbrh_v8hi (vss);
+    XXBRH_V8HI p9_xxbrh_v8hi {}
+
+  const vsc __builtin_vsx_xxbrq_v16qi (vsc);
+    XXBRQ_V16QI p9_xxbrq_v16qi {}
+
+  const vsq __builtin_vsx_xxbrq_v1ti (vsq);
+    XXBRQ_V1TI p9_xxbrq_v1ti {}
+
+  const vf __builtin_vsx_xxbrw_v4sf (vf);
+    XXBRW_V4SF p9_xxbrw_v4sf {}
+
+  const vsi __builtin_vsx_xxbrw_v4si (vsi);
+    XXBRW_V4SI p9_xxbrw_v4si {}
+
 
 ; These things need some review to see whether they really require
 ; MASK_POWERPC64.  For xsxexpdp, this seems to be fine for 32-bit,
@@ -2309,8 +2405,53 @@
 ; 32 bits, and the return value is DImode, so it seems that
 ; TARGET_64BIT (actually TARGET_POWERPC64) is justified.  TBD. ####
 [(MASK_P9_VECTOR | MASK_POWERPC64)]
+  pure vop __builtin_vsx_lxvl (void *, unsigned long long);
+    LXVL lxvl {}
+
   const unsigned int __builtin_vsx_scalar_extract_exp (double);
     VSEEDP xsxexpdp {}
 
   const unsigned long long __builtin_vsx_scalar_extract_sig (double);
     VSESDP xsxsigdp {}
+
+  const double __builtin_vsx_scalar_insert_exp (unsigned long long, unsigned long long);
+    VSIEDP xsiexpdp {}
+
+  const double __builtin_vsx_scalar_insert_exp_dp (double, unsigned long long);
+    VSIEDPF xsiexpdpf {}
+
+  pure vuc __builtin_vsx_xl_len_r (void *, unsigned long long);
+    XL_LEN_R xl_len_r {}
+
+
+; Builtins requiring hardware support for IEEE-128 floating-point.
+[MASK_FLOAT128_HW]
+  const unsigned long long __builtin_vsx_scalar_extract_expq (_Float128);
+    VSEEQP xsxexpqp_kf {}
+
+  const unsigned __int128 __builtin_vsx_scalar_extract_sigq (_Float128);
+    VSESQP xsxsigqp_kf {}
+
+  const signed int __buiiltin_vsx_scalar_cmp_exp_qp_eq (_Float128, _Float128);
+    VSCEQPEQ xscmpexpqp_eq_kf {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_gt (_Float128, _Float128);
+    VSCEQPGT xscmpexpqp_gt_kf {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_lt (_Float128, _Float128);
+    VSCEQPLT xscmpexpqp_lt_kf {}
+
+  const signed int __builtin_vsx_scalar_cmp_exp_qp_unordered (_Float128, _Float128);
+    VSCEQPUO xscmpexpqp_unordered_kf {}
+
+  const _Float128 __builtin_vsx_scalar_insert_exp_q (unsigned __int128, unsigned long long);
+    VSIEQP xsiexpqp_kf {}
+
+  const _Float128 __builtin_vsx_scalar_insert_exp_qp (_Float128, unsigned long long);
+    VSIEQPF xsiexpqpf_kf {}
+
+  const unsigned int __builtin_vsx_scalar_test_data_class_qp (_Float128, signed int);
+    VSTDCQP xststdcqp_kf {}
+
+  const unsigned int __builtin_vsx_scalar_test_neg_qp (_Float128);
+    VSTDCNQP xststdcnegqp_kf {}
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index b5797f9f657..f9f8a4db0c6 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -2191,6 +2191,7 @@ BU_P9V_VSX_2 (VSCEDPLT,	"scalar_cmp_exp_dp_lt",	CONST,	xscmpexpdp_lt)
 BU_P9V_VSX_2 (VSCEDPEQ,	"scalar_cmp_exp_dp_eq",	CONST,	xscmpexpdp_eq)
 BU_P9V_VSX_2 (VSCEDPUO,	"scalar_cmp_exp_dp_unordered",	CONST,	xscmpexpdp_unordered)
 
+/* Shouldn't these be BU_FLOAT128_HW_VSX_2?  */
 BU_P9V_VSX_2 (VSCEQPGT,	"scalar_cmp_exp_qp_gt",	CONST,	xscmpexpqp_gt_kf)
 BU_P9V_VSX_2 (VSCEQPLT,	"scalar_cmp_exp_qp_lt",	CONST,	xscmpexpqp_lt_kf)
 BU_P9V_VSX_2 (VSCEQPEQ,	"scalar_cmp_exp_qp_eq",	CONST,	xscmpexpqp_eq_kf)
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 19218ab49f2..480445ce804 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -5181,6 +5181,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
   { P9V_BUILTIN_VEC_VEXTRACT_FP_FROM_SHORTL, P9V_BUILTIN_VEXTRACT_FP_FROM_SHORTL,
     RS6000_BTI_V4SF, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
+  /* Following ones have rules violations for scalar types.  */
   { P9V_BUILTIN_VEC_VEXTULX, P9V_BUILTIN_VEXTUBLX,
     RS6000_BTI_INTQI, RS6000_BTI_UINTSI,
     RS6000_BTI_V16QI, 0 },
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index fb2c437ace0..f3ce43e4fc9 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -505,7 +505,7 @@ match_to_right_bracket ()
   while (linebuf[lastpos + 1] != ']')
     if (++lastpos >= LINELEN - 1)
       {
-	(*diag) ("linie length overrun.\n");
+	(*diag) ("line length overrun.\n");
 	exit (EC_INTERR);
       }
 
@@ -659,6 +659,7 @@ match_const_restriction (typeinfo *typedata)
 	  (*diag) ("missing comma at column %d.\n", pos + 1);
 	  return 0;
 	}
+      safe_inc_pos ();
       consume_whitespace ();
       oldpos = pos;
       int y = match_integer ();
@@ -696,6 +697,7 @@ match_const_restriction (typeinfo *typedata)
 	  (*diag) ("missing comma at column %d.\n", pos + 1);
 	  return 0;
 	}
+      safe_inc_pos ();
       consume_whitespace ();
       oldpos = pos;
       int y = match_integer ();
@@ -995,7 +997,7 @@ match_type (typeinfo *typedata, int voidok)
       typedata->base = BT_INT;
 
       consume_whitespace ();
-      if (linebuf[pos] == '<' || linebuf[pos] == '{')
+      if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
 	return match_const_restriction (typedata);
 
       return 1;


More information about the Gcc-cvs mailing list