[gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Disable unnecessary initialization for new support

William Schmidt wschmidt@gcc.gnu.org
Mon Nov 2 22:08:17 GMT 2020


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

commit de3d42f873e8bcceca4f881e104396d5a0bce0bd
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Mon Nov 2 10:21:55 2020 -0500

    rs6000: Disable unnecessary initialization for new support
    
    2020-11-02  Bill Schmidt  <wschmidt@linux.ibm.com>
    
            * config/rs6000/rs6000-call.c (rs6000-init_builtins): Gate special
            cases with !new_builtins_are_live.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 227 +++++++++++++++++++++-------------------
 1 file changed, 121 insertions(+), 106 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 04b1745ee4e..4154a1eb099 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -13478,114 +13478,129 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
-  /* Create Altivec, VSX and MMA builtins on machines with at least the
-     general purpose extensions (970 and newer) to allow the use of
-     the target attribute.  */
-  if (TARGET_EXTRA_BUILTINS)
+  if (!new_builtins_are_live)
     {
-      altivec_init_builtins ();
-      mma_init_builtins ();
-    }
-  if (TARGET_HTM)
-    htm_init_builtins ();
-
-  if (TARGET_EXTRA_BUILTINS)
-    rs6000_common_init_builtins ();
-
-  ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
-				 RS6000_BUILTIN_RECIP, "__builtin_recipdiv");
-  def_builtin ("__builtin_recipdiv", ftype, RS6000_BUILTIN_RECIP);
-
-  ftype = builtin_function_type (SFmode, SFmode, SFmode, VOIDmode,
-				 RS6000_BUILTIN_RECIPF, "__builtin_recipdivf");
-  def_builtin ("__builtin_recipdivf", ftype, RS6000_BUILTIN_RECIPF);
-
-  ftype = builtin_function_type (DFmode, DFmode, VOIDmode, VOIDmode,
-				 RS6000_BUILTIN_RSQRT, "__builtin_rsqrt");
-  def_builtin ("__builtin_rsqrt", ftype, RS6000_BUILTIN_RSQRT);
-
-  ftype = builtin_function_type (SFmode, SFmode, VOIDmode, VOIDmode,
-				 RS6000_BUILTIN_RSQRTF, "__builtin_rsqrtf");
-  def_builtin ("__builtin_rsqrtf", ftype, RS6000_BUILTIN_RSQRTF);
-
-  mode = (TARGET_64BIT) ? DImode : SImode;
-  ftype = builtin_function_type (mode, mode, mode, VOIDmode,
-				 POWER7_BUILTIN_BPERMD, "__builtin_bpermd");
-  def_builtin ("__builtin_bpermd", ftype, POWER7_BUILTIN_BPERMD);
-
-  ftype = build_function_type_list (unsigned_intDI_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_ppc_get_timebase", ftype, RS6000_BUILTIN_GET_TB);
-
-  if (TARGET_64BIT)
-    ftype = build_function_type_list (unsigned_intDI_type_node,
-				      NULL_TREE);
-  else
-    ftype = build_function_type_list (unsigned_intSI_type_node,
-				      NULL_TREE);
-  def_builtin ("__builtin_ppc_mftb", ftype, RS6000_BUILTIN_MFTB);
-
-  ftype = build_function_type_list (double_type_node, NULL_TREE);
-  def_builtin ("__builtin_mffs", ftype, RS6000_BUILTIN_MFFS);
-
-  ftype = build_function_type_list (double_type_node, NULL_TREE);
-  def_builtin ("__builtin_mffsl", ftype, RS6000_BUILTIN_MFFSL);
-
-  ftype = build_function_type_list (void_type_node,
-				    intSI_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_mtfsb0", ftype, RS6000_BUILTIN_MTFSB0);
-
-  ftype = build_function_type_list (void_type_node,
-				    intSI_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_mtfsb1", ftype, RS6000_BUILTIN_MTFSB1);
-
-  ftype = build_function_type_list (void_type_node,
-				    intDI_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_set_fpscr_rn", ftype, RS6000_BUILTIN_SET_FPSCR_RN);
-
-  ftype = build_function_type_list (void_type_node,
-				    intDI_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_set_fpscr_drn", ftype, RS6000_BUILTIN_SET_FPSCR_DRN);
-
-  ftype = build_function_type_list (void_type_node,
-				    intSI_type_node, double_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_mtfsf", ftype, RS6000_BUILTIN_MTFSF);
-
-  ftype = build_function_type_list (void_type_node, NULL_TREE);
-  def_builtin ("__builtin_cpu_init", ftype, RS6000_BUILTIN_CPU_INIT);
-  def_builtin ("__builtin_ppc_speculation_barrier", ftype,
-	       MISC_BUILTIN_SPEC_BARRIER);
-
-  ftype = build_function_type_list (bool_int_type_node, const_ptr_type_node,
-				    NULL_TREE);
-  def_builtin ("__builtin_cpu_is", ftype, RS6000_BUILTIN_CPU_IS);
-  def_builtin ("__builtin_cpu_supports", ftype, RS6000_BUILTIN_CPU_SUPPORTS);
-
-  if (TARGET_XCOFF)
-    {
-      /* AIX libm provides clog as __clog.  */
-      if ((tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
-	set_user_assembler_name (tdecl, "__clog");
-
-      /* When long double is 64 bit, some long double builtins of libc
-	 functions (like __builtin_frexpl) must call the double version
-	 (frexp) not the long double version (frexpl) that expects a 128 bit
-	 argument.  */
-      if (! TARGET_LONG_DOUBLE_128)
+      /* Create Altivec, VSX and MMA builtins on machines with at least the
+	 general purpose extensions (970 and newer) to allow the use of
+	 the target attribute.  */
+      if (TARGET_EXTRA_BUILTINS)
 	{
-	  if ((tdecl = builtin_decl_explicit (BUILT_IN_FMODL)) != NULL_TREE)
-	    set_user_assembler_name (tdecl, "fmod");
-	  if ((tdecl = builtin_decl_explicit (BUILT_IN_FREXPL)) != NULL_TREE)
-	    set_user_assembler_name (tdecl, "frexp");
-	  if ((tdecl = builtin_decl_explicit (BUILT_IN_LDEXPL)) != NULL_TREE)
-	    set_user_assembler_name (tdecl, "ldexp");
-	  if ((tdecl = builtin_decl_explicit (BUILT_IN_MODFL)) != NULL_TREE)
-	    set_user_assembler_name (tdecl, "modf");
+	  altivec_init_builtins ();
+	  mma_init_builtins ();
+	}
+      if (TARGET_HTM)
+	htm_init_builtins ();
+
+      if (TARGET_EXTRA_BUILTINS)
+	rs6000_common_init_builtins ();
+
+      ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
+				     RS6000_BUILTIN_RECIP,
+				     "__builtin_recipdiv");
+      def_builtin ("__builtin_recipdiv", ftype, RS6000_BUILTIN_RECIP);
+
+      ftype = builtin_function_type (SFmode, SFmode, SFmode, VOIDmode,
+				     RS6000_BUILTIN_RECIPF,
+				     "__builtin_recipdivf");
+      def_builtin ("__builtin_recipdivf", ftype, RS6000_BUILTIN_RECIPF);
+
+      ftype = builtin_function_type (DFmode, DFmode, VOIDmode, VOIDmode,
+				     RS6000_BUILTIN_RSQRT, "__builtin_rsqrt");
+      def_builtin ("__builtin_rsqrt", ftype, RS6000_BUILTIN_RSQRT);
+
+      ftype = builtin_function_type (SFmode, SFmode, VOIDmode, VOIDmode,
+				     RS6000_BUILTIN_RSQRTF,
+				     "__builtin_rsqrtf");
+      def_builtin ("__builtin_rsqrtf", ftype, RS6000_BUILTIN_RSQRTF);
+
+      mode = (TARGET_64BIT) ? DImode : SImode;
+      ftype = builtin_function_type (mode, mode, mode, VOIDmode,
+				     POWER7_BUILTIN_BPERMD,
+				     "__builtin_bpermd");
+      def_builtin ("__builtin_bpermd", ftype, POWER7_BUILTIN_BPERMD);
+
+      ftype = build_function_type_list (unsigned_intDI_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_ppc_get_timebase", ftype, RS6000_BUILTIN_GET_TB);
+
+      if (TARGET_64BIT)
+	ftype = build_function_type_list (unsigned_intDI_type_node,
+					  NULL_TREE);
+      else
+	ftype = build_function_type_list (unsigned_intSI_type_node,
+					  NULL_TREE);
+      def_builtin ("__builtin_ppc_mftb", ftype, RS6000_BUILTIN_MFTB);
+
+      ftype = build_function_type_list (double_type_node, NULL_TREE);
+      def_builtin ("__builtin_mffs", ftype, RS6000_BUILTIN_MFFS);
+
+      ftype = build_function_type_list (double_type_node, NULL_TREE);
+      def_builtin ("__builtin_mffsl", ftype, RS6000_BUILTIN_MFFSL);
+
+      ftype = build_function_type_list (void_type_node,
+					intSI_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_mtfsb0", ftype, RS6000_BUILTIN_MTFSB0);
+
+      ftype = build_function_type_list (void_type_node,
+					intSI_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_mtfsb1", ftype, RS6000_BUILTIN_MTFSB1);
+
+      ftype = build_function_type_list (void_type_node,
+					intDI_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_set_fpscr_rn", ftype,
+		   RS6000_BUILTIN_SET_FPSCR_RN);
+
+      ftype = build_function_type_list (void_type_node,
+					intDI_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_set_fpscr_drn", ftype,
+		   RS6000_BUILTIN_SET_FPSCR_DRN);
+
+      ftype = build_function_type_list (void_type_node,
+					intSI_type_node, double_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_mtfsf", ftype, RS6000_BUILTIN_MTFSF);
+
+      ftype = build_function_type_list (void_type_node, NULL_TREE);
+      def_builtin ("__builtin_cpu_init", ftype, RS6000_BUILTIN_CPU_INIT);
+      def_builtin ("__builtin_ppc_speculation_barrier", ftype,
+		   MISC_BUILTIN_SPEC_BARRIER);
+
+      ftype = build_function_type_list (bool_int_type_node,
+					const_ptr_type_node,
+					NULL_TREE);
+      def_builtin ("__builtin_cpu_is", ftype, RS6000_BUILTIN_CPU_IS);
+      def_builtin ("__builtin_cpu_supports", ftype,
+		   RS6000_BUILTIN_CPU_SUPPORTS);
+
+      if (TARGET_XCOFF)
+	{
+	  /* AIX libm provides clog as __clog.  */
+	  if ((tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
+	    set_user_assembler_name (tdecl, "__clog");
+
+	  /* When long double is 64 bit, some long double builtins of libc
+	     functions (like __builtin_frexpl) must call the double version
+	     (frexp) not the long double version (frexpl) that expects a
+	     128-bit argument.  */
+	  if (! TARGET_LONG_DOUBLE_128)
+	    {
+	      if ((tdecl = builtin_decl_explicit (BUILT_IN_FMODL))
+		  != NULL_TREE)
+		set_user_assembler_name (tdecl, "fmod");
+	      if ((tdecl = builtin_decl_explicit (BUILT_IN_FREXPL))
+		  != NULL_TREE)
+		set_user_assembler_name (tdecl, "frexp");
+	      if ((tdecl = builtin_decl_explicit (BUILT_IN_LDEXPL))
+		  != NULL_TREE)
+		set_user_assembler_name (tdecl, "ldexp");
+	      if ((tdecl = builtin_decl_explicit (BUILT_IN_MODFL))
+		  != NULL_TREE)
+		set_user_assembler_name (tdecl, "modf");
+	    }
 	}
     }


More information about the Gcc-cvs mailing list