[Bug bootstrap/92661] [10 Regression] AIX bootstrap failure with builtin-types.def change

2019-11-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92661

Richard Biener  changed:

   What|Removed |Added

Version|unknown |10.0
   Target Milestone|--- |10.0

[Bug bootstrap/92661] [10 Regression] AIX bootstrap failure with builtin-types.def change

2019-11-25 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92661

--- Comment #5 from Peter Bergner  ---
(In reply to jos...@codesourcery.com from comment #4)
> My suggestion for the target-specific built-in functions would be:
> 
> * builtin_function_type in rs6000-call.c should detect the case of a 
> DECIMAL_FLOAT_MODE_P mode and NULL_TREE ret_type and return NULL_TREE in 
> place of the existing error in that case.
> 
> * rs6000_common_init_builtins should then accept a NULL_TREE type as 
> indicating not to call def_builtin (or def_builtin could accept it as 
> indicating to return early).

The following implements that idea, although, we have to test the arguments for
similar issues as the return type.  It fixes my powerpc64le-linux
--disable-decimal-float build.

David, can you test this on AIX?



Index: gcc/config/rs6000/rs6000-call.c
===
--- gcc/config/rs6000/rs6000-call.c (revision 278692)
+++ gcc/config/rs6000/rs6000-call.c (working copy)
@@ -2935,6 +2935,10 @@ def_builtin (const char *name, tree type
   unsigned classify = rs6000_builtin_info[(int)code].attr;
   const char *attr_string = "";

+  /* Don't define the builtin if it doesn't have a type.  See PR92661.  */
+  if (type == NULL_TREE)
+return;
+
   gcc_assert (name != NULL);
   gcc_assert (IN_RANGE ((int)code, 0, (int)RS6000_BUILTIN_COUNT));

@@ -7702,6 +7706,11 @@ builtin_function_type (machine_mode mode
   if (!ret_type && h.uns_p[0])
 ret_type = builtin_mode_to_type[h.mode[0]][0];

+  /* If the required decimal float type has been disabled, then return
+ without an error.  */
+  if (!ret_type && DECIMAL_FLOAT_MODE_P (h.mode[0]))
+return NULL_TREE;
+
   if (!ret_type)
 fatal_error (input_location,
 "internal error: builtin function %qs had an unexpected "
@@ -7719,6 +7728,11 @@ builtin_function_type (machine_mode mode
   if (!arg_type[i] && uns_p)
arg_type[i] = builtin_mode_to_type[m][0];

+  /* If the required decimal float type has been disabled, then return
+without an error.  */
+  if (!arg_type[i] && DECIMAL_FLOAT_MODE_P (m))
+   return NULL_TREE;
+
   if (!arg_type[i])
fatal_error (input_location,
 "internal error: builtin function %qs, argument %d "

[Bug bootstrap/92661] [10 Regression] AIX bootstrap failure with builtin-types.def change

2019-11-25 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92661

--- Comment #4 from joseph at codesourcery dot com  ---
The design in the target-independent compiler is that the functions that 
get called when processing builtins.def notice that the type involved is 
error_mark_node (which in turn gets set when processing builtin-types.def) 
and refrain from defining the built-in function.  The goal is that the DFP 
types are never created in the compiler when DFP is unsupported, which 
means that no built-in functions using those types can be declared.

My suggestion for the target-specific built-in functions would be:

* builtin_function_type in rs6000-call.c should detect the case of a 
DECIMAL_FLOAT_MODE_P mode and NULL_TREE ret_type and return NULL_TREE in 
place of the existing error in that case.

* rs6000_common_init_builtins should then accept a NULL_TREE type as 
indicating not to call def_builtin (or def_builtin could accept it as 
indicating to return early).

[Bug bootstrap/92661] [10 Regression] AIX bootstrap failure with builtin-types.def change

2019-11-25 Thread dje at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92661

--- Comment #3 from David Edelsohn  ---
An alternate work-around is

Index: tree.c
===
--- tree.c  (revision 278691)
+++ tree.c  (working copy)
@@ -10334,7 +10334,7 @@
   uint64_type_node = make_or_reuse_type (64, 1);

   /* Decimal float types. */
-  if (targetm.decimal_float_supported_p ())
+  if (1)
 {
   dfloat32_type_node = make_node (REAL_TYPE);
   TYPE_PRECISION (dfloat32_type_node) = DECIMAL32_TYPE_SIZE;

[Bug bootstrap/92661] [10 Regression] AIX bootstrap failure with builtin-types.def change

2019-11-25 Thread dje at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92661

--- Comment #2 from David Edelsohn  ---
A crude work-around to allow GCC to bootstrap and show the extent of the
problem, I need the following patches to comment out all decimal builtins.

Index: rs6000-call.c
===
--- rs6000-call.c   (revision 278691)
+++ rs6000-call.c   (working copy)
@@ -7653,7 +7653,7 @@
 /* signed args, unsigned return.  */
 case VSX_BUILTIN_XVCVDPUXDS_UNS:
 case ALTIVEC_BUILTIN_FIXUNS_V4SF_V4SI:
-case MISC_BUILTIN_UNPACK_TD:
+/* case MISC_BUILTIN_UNPACK_TD: */
 case MISC_BUILTIN_UNPACK_V1TI:
   h.uns_p[0] = 1;
   break;
@@ -7676,7 +7676,7 @@
   break;

 /* unsigned arguments for 128-bit pack instructions.  */
-case MISC_BUILTIN_PACK_TD:
+/* case MISC_BUILTIN_PACK_TD: */
 case MISC_BUILTIN_PACK_V1TI:
   h.uns_p[1] = 1;
   h.uns_p[2] = 1;
Index: rs6000-c.c
===
--- rs6000-c.c  (revision 278691)
+++ rs6000-c.c  (working copy)
@@ -4884,6 +4884,7 @@
   { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD,
 RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },

+#if 0
   { P9_BUILTIN_DFP_TSTSFI_LT, MISC_BUILTIN_TSTSFI_LT_TD,
 RS6000_BTI_INTSI, RS6000_BTI_UINTSI, RS6000_BTI_dfloat128, 0 },
   { P9_BUILTIN_DFP_TSTSFI_LT, MISC_BUILTIN_TSTSFI_LT_DD,
@@ -4923,6 +4924,7 @@
 RS6000_BTI_INTSI, RS6000_BTI_UINTSI, RS6000_BTI_dfloat128, 0 },
   { P9_BUILTIN_DFP_TSTSFI_OV_DD, MISC_BUILTIN_TSTSFI_OV_DD,
 RS6000_BTI_INTSI, RS6000_BTI_UINTSI, RS6000_BTI_dfloat64, 0 },
+#endif

   { P9V_BUILTIN_VEC_VCTZ, P9V_BUILTIN_VCTZB,
 RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
Index: rs6000-builtin.def
===
--- rs6000-builtin.def  (revision 278691)
+++ rs6000-builtin.def  (working copy)
@@ -2298,6 +2298,7 @@
 BU_P7_POWERPC64_MISC_2 (DIVDE, "divde",CONST,  dive_di)
 BU_P7_POWERPC64_MISC_2 (DIVDEU,"divdeu",   CONST,  diveu_di)

+#if 0
 /* 1 argument DFP (decimal floating point) functions added in ISA 2.05.  */
 BU_DFP_MISC_1 (DXEX,   "dxex", CONST,  dfp_dxex_dd)
 BU_DFP_MISC_1 (DXEXQ,  "dxexq",CONST,  dfp_dxex_td)
@@ -2313,6 +2314,7 @@
 BU_DFP_MISC_2 (DSCLIQ, "dscliq",   CONST,  dfp_dscli_td)
 BU_DFP_MISC_2 (DSCRI,  "dscri",CONST,  dfp_dscri_dd)
 BU_DFP_MISC_2 (DSCRIQ, "dscriq",   CONST,  dfp_dscri_td)
+#endif

 /* 0 argument void function that we pretend was added in ISA 2.06.
It's a special nop recognized by 2018+ firmware for P7 and up,
@@ -2338,9 +2340,11 @@
 BU_P8V_MISC_3 (BCDSUB_GT,  "bcdsub_gt",CONST,  bcdsub_gt)
 BU_P8V_MISC_3 (BCDSUB_OV,  "bcdsub_ov",CONST,  bcdsub_unordered)

+#if 0
 /* 2 argument pack/unpack 128-bit floating point types.  */
 BU_DFP_MISC_2 (PACK_TD,"pack_dec128",  CONST,  packtd)
 BU_DFP_MISC_2 (UNPACK_TD,  "unpack_dec128",CONST,  unpacktd)
+#endif 

 /* 0 argument general-purpose register functions added in ISA 3.0 (power9). 
*/
 BU_P9_MISC_0 (DARN_32, "darn_32",  MISC, darn_32)
@@ -2356,6 +2360,7 @@
 BU_P7_MISC_2 (PACK_V1TI,   "pack_vector_int128",   CONST,  packv1ti)
 BU_P7_MISC_2 (UNPACK_V1TI, "unpack_vector_int128", CONST,  unpackv1ti)

+#if 0
 /* 2 argument DFP (Decimal Floating Point) functions added in ISA 3.0.  */
 BU_P9_DFP_MISC_2 (TSTSFI_LT_DD, "dtstsfi_lt_dd", CONST, dfptstsfi_lt_dd)
 BU_P9_DFP_MISC_2 (TSTSFI_LT_TD, "dtstsfi_lt_td", CONST, dfptstsfi_lt_td)
@@ -2385,6 +2390,7 @@
 BU_P9_DFP_OVERLOAD_2 (TSTSFI_OV,   "dtstsfi_ov")
 BU_P9_DFP_OVERLOAD_2 (TSTSFI_OV_DD,"dtstsfi_ov_dd")
 BU_P9_DFP_OVERLOAD_2 (TSTSFI_OV_TD,"dtstsfi_ov_td")
+#endif

 /* 1 argument vector functions added in ISA 3.0 (power9).  */
 BU_P9V_AV_1 (VCTZB,"vctzb",CONST,  ctzv16qi2)

[Bug bootstrap/92661] [10 Regression] AIX bootstrap failure with builtin-types.def change

2019-11-25 Thread dje at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92661

David Edelsohn  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-11-25
 Ever confirmed|0   |1

--- Comment #1 from David Edelsohn  ---
Confirmed.