public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, function-specific, committed] Merge up to 137298
@ 2008-07-01  4:02 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2008-07-01  4:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: gnu

I merged up the function specific branch to trunk version 137298.

I needed to add the following patch:

2008-06-30  Michael Meissner  <gnu@the-meissners.org>

	* gcc/config/i386/i386.c (ix86_init_builtins): Restore code added
	in the merge, but now always call ix86_init_mmx_sse_builtins.
	(ix86_expand_builtin): Allow for ix86_builtins_isa being 0 which
	means we don't have to check for a specific ISA.

	* tree.c (build_target_optimization_node): Cast void * to tree.
	(build_target_option_node): Ditto.

Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 137298)
+++ gcc/tree.c	(working copy)
@@ -8932,7 +8969,7 @@ build_optimization_node (void)
   cl_optimization_save (TREE_OPTIMIZATION (cl_optimization_node));
 
   slot = htab_find_slot (cl_option_hash_table, cl_optimization_node, INSERT);
-  t = *slot;
+  t = (tree) *slot;
   if (!t)
     {
       /* Insert this one into the hash table.  */
@@ -8959,7 +8996,7 @@ build_target_option_node (void)
   cl_target_option_save (TREE_TARGET_OPTION (cl_target_option_node));
 
   slot = htab_find_slot (cl_option_hash_table, cl_target_option_node, INSERT);
-  t = *slot;
+  t = (tree) *slot;
   if (!t)
     {
       /* Insert this one into the hash table.  */
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 137298)
+++ gcc/config/i386/i386.c	(working copy)
@@ -19970,11 +19956,12 @@ static const struct builtin_description 
   { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3,      "__builtin_ia32_pcomtrueuq", IX86_BUILTIN_PCOMTRUEUQ, PCOM_TRUE,    (int)MULTI_ARG_2_DI_TF },
 };
 
-/* Set up all the MMX/SSE builtins.  This is not called if TARGET_MMX
-   is zero.  Otherwise, if TARGET_SSE is not set, only expand the MMX
-   builtins.  */
+/* Set up all the MMX/SSE builtins, even builtins for instructions that are not
+   in the current target ISA to allow the user to compile particular modules
+   with different target specific options that differ from the command line
+   options.  */
 static void
-ix86_init_builtins (void)
+ix86_init_mmx_sse_builtins (void)
 {
   const struct builtin_description * d;
   size_t i;
@@ -21111,6 +21057,58 @@ ix86_init_builtins (void)
     }
 }
 
+static void
+ix86_init_builtins (void)
+{
+  tree float128_type_node = make_node (REAL_TYPE);
+  tree ftype, decl;
+
+  /* The __float80 type.  */
+  if (TYPE_MODE (long_double_type_node) == XFmode)
+    (*lang_hooks.types.register_builtin_type) (long_double_type_node,
+					       "__float80");
+  else
+    {
+      /* The __float80 type.  */
+      tree float80_type_node = make_node (REAL_TYPE);
+
+      TYPE_PRECISION (float80_type_node) = 80;
+      layout_type (float80_type_node);
+      (*lang_hooks.types.register_builtin_type) (float80_type_node,
+						 "__float80");
+    }
+
+  /* The __float128 type.  */
+  TYPE_PRECISION (float128_type_node) = 128;
+  layout_type (float128_type_node);
+  (*lang_hooks.types.register_builtin_type) (float128_type_node,
+					     "__float128");
+
+  /* TFmode support builtins.  */
+  ftype = build_function_type (float128_type_node, void_list_node);
+  decl = add_builtin_function ("__builtin_infq", ftype,
+			       IX86_BUILTIN_INFQ, BUILT_IN_MD,
+			       NULL, NULL_TREE);
+  ix86_builtins[(int) IX86_BUILTIN_INFQ] = decl;
+
+  if (HOST_BITS_PER_WIDE_INT >= 64)
+    {
+      /* Those builtins need TImode to compile.  */
+      ftype = build_function_type_list (float128_type_node,
+					float128_type_node,
+					NULL_TREE);
+      def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ);
+
+      ftype = build_function_type_list (float128_type_node,
+					float128_type_node,
+					float128_type_node,
+					NULL_TREE);
+      def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_copysignq", ftype, IX86_BUILTIN_COPYSIGNQ);
+    }
+
+  ix86_init_mmx_sse_builtins ();
+}
+
 /* Errors in the source file can cause expand_expr to return const0_rtx
    where we expect a vector.  To avoid crashing, use one of the vector
    clear instructions.  */
@@ -22325,16 +22323,22 @@ ix86_expand_builtin (tree exp, rtx targe
   /* Determine whether the builtin function is available under the current ISA.
      Originally the builtin was not created if it wasn't applicable to the
      current ISA based on the command line switches.  With function specific
-     options, we need to check in the context of the function making the
-     call whether it is supported.  */
-  if (!(ix86_builtins_isa[fcode] & ix86_isa_flags))
+     options, we need to check in the context of the function making the call
+     whether it is supported.  */
+  if (ix86_builtins_isa[fcode]
+      && !(ix86_builtins_isa[fcode] & ix86_isa_flags))
     {
       char *opts = ix86_target_string (ix86_builtins_isa[fcode], 0, NULL,
 				       NULL, NULL, false);
 
-      gcc_assert (opts != NULL);
-      error ("%qE needs isa option %s", fndecl, opts);
-      free (opts);
+      if (!opts)
+	error ("%qE needs unknown isa option", fndecl);
+      else
+	{
+	  gcc_assert (opts != NULL);
+	  error ("%qE needs isa option %s", fndecl, opts);
+	  free (opts);
+	}
       return const0_rtx;
     }
 

-- 
Michael Meissner
email: gnu@the-meissners.org
http://www.the-meissners.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-01  3:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-01  4:02 [PATCH, function-specific, committed] Merge up to 137298 Michael Meissner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).