diff mbox series

rs6000: Fix PR92661, Do not define DFP builtin functions, if DFP has been disabled

Message ID 0df05268-7351-0317-9c07-4f9bd7b1d0c3@bergner.org
State New
Headers show
Series rs6000: Fix PR92661, Do not define DFP builtin functions, if DFP has been disabled | expand

Commit Message

Peter Bergner Nov. 27, 2019, 9:27 p.m. UTC
This patch fixes the bootstrap breakage in the rs6000 port caused by the
recent patch from Joseph that disables adding the _Decimal* types when
DFP has been disabled.  It's based on Joseph's suggestion from the
bugzilla.

This passed bootstrap and regtesting on powerpc64*-linux and Iain
confirmed this fixes his Darwin build as well.  Segher preapproved
this patch, so I have committed it now to get bootstrap working
again.

We still have some testsuite fallout due to builtin functions that overload
builtins that have been disabled due to the decimal types being disabled.
I'm still working on resolving that.

Peter

	PR bootstrap/92661
	* config/rs6000/rs6000-call.c: (def_builtin): Do not define the
	builtin if we don't have an actual type.
	(builtin_function_type): If the builtin function uses a DFP type
	and decimal float has been disabled, then return NULL_TREE.
diff mbox series

Patch

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 NULL_TREE.  */
+  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 NULL_TREE.  */
+      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 "