mips.c (mips_init_builtins): Simplify.
authorRichard Sandiford <rsandifo@redhat.com>
Sun, 29 Aug 2004 11:25:19 +0000 (11:25 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 29 Aug 2004 11:25:19 +0000 (11:25 +0000)
* config/mips/mips.c (mips_init_builtins): Simplify.  Only create
V2SF_type_node if it will be needed.

From-SVN: r86718

gcc/ChangeLog
gcc/config/mips/mips.c

index 38f35be3da87f6fdf21d07ea29d1ca3ae0391e5c..d2eb213cf45121e3f76cf21a9734b584d327b471 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-29  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mips/mips.c (mips_init_builtins): Simplify.  Only create
+       V2SF_type_node if it will be needed.
+
 2004-08-29  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.h (MIPS_CMP_MOVT, MIPS_CMP_MOVF): Delete.
index 1ee3743a54fbc47d5a6871eba3a9a22bcb183bf2..3f2cb41249ed9be5c1707b43609255a06bc69f89 100644 (file)
@@ -10449,175 +10449,76 @@ void
 mips_init_builtins (void)
 {
   const struct builtin_description *d;
-  size_t i;
-  tree v2sf_ftype_v2sf_v2sf;
-  tree v2sf_ftype_sf_sf;
-  tree sf_ftype_v2sf;
-  tree v2sf_ftype_v2sf;
-  tree int_ftype_v2sf_v2sf;
-  tree int_ftype_v2sf_v2sf_v2sf_v2sf;
-  tree v2sf_ftype_v2sf_v2sf_int;
-  tree int_ftype_sf_sf;
-  tree int_ftype_df_df;
-  tree sf_ftype_sf;
-  tree df_ftype_df;
-  tree sf_ftype_sf_sf;
-  tree df_ftype_df_df;
-  tree v2sf_ftype_v2sf_v2sf_v2sf_v2sf;
-  tree V2SF_type_node = build_vector_type_for_mode (float_type_node, V2SFmode);
+  tree types[(int) MIPS_MAX_FTYPE_MAX];
+  tree V2SF_type_node;
 
   /* We have only builtins for -mpaired-single and -mips3d.  */
   if (!TARGET_PAIRED_SINGLE_FLOAT)
     return;
 
-  int_ftype_sf_sf
-    = build_function_type_list (integer_type_node, 
-                               float_type_node, float_type_node, 
-                               NULL_TREE);
+  V2SF_type_node = build_vector_type_for_mode (float_type_node, V2SFmode);
 
-  int_ftype_df_df 
-    = build_function_type_list (integer_type_node, 
-                               double_type_node, double_type_node, 
-                               NULL_TREE);
+  types[MIPS_V2SF_FTYPE_V2SF]
+    = build_function_type_list (V2SF_type_node, V2SF_type_node, NULL_TREE);
 
-  v2sf_ftype_v2sf_v2sf 
-    = build_function_type_list (V2SF_type_node, 
+  types[MIPS_V2SF_FTYPE_V2SF_V2SF]
+    = build_function_type_list (V2SF_type_node,
                                V2SF_type_node, V2SF_type_node, NULL_TREE);
 
-  v2sf_ftype_sf_sf 
-    = build_function_type_list (V2SF_type_node, 
-                               float_type_node, float_type_node, 
-                               NULL_TREE);
+  types[MIPS_V2SF_FTYPE_V2SF_V2SF_INT]
+    = build_function_type_list (V2SF_type_node,
+                               V2SF_type_node, V2SF_type_node,
+                               integer_type_node, NULL_TREE);
 
-  sf_ftype_v2sf 
-    = build_function_type_list (float_type_node, V2SF_type_node, NULL_TREE);
+  types[MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF]
+    = build_function_type_list (V2SF_type_node,
+                               V2SF_type_node, V2SF_type_node,
+                               V2SF_type_node, V2SF_type_node, NULL_TREE);
 
-  v2sf_ftype_v2sf 
-    = build_function_type_list (V2SF_type_node, V2SF_type_node, NULL_TREE);
+  types[MIPS_V2SF_FTYPE_SF_SF]
+    = build_function_type_list (V2SF_type_node,
+                               float_type_node, float_type_node, NULL_TREE);
 
-  int_ftype_v2sf_v2sf 
+  types[MIPS_INT_FTYPE_V2SF_V2SF]
     = build_function_type_list (integer_type_node,
                                V2SF_type_node, V2SF_type_node, NULL_TREE);
 
-  int_ftype_v2sf_v2sf_v2sf_v2sf
+  types[MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF]
     = build_function_type_list (integer_type_node,
                                V2SF_type_node, V2SF_type_node,
                                V2SF_type_node, V2SF_type_node, NULL_TREE);
 
-  v2sf_ftype_v2sf_v2sf_v2sf_v2sf
-    = build_function_type_list (V2SF_type_node,
-                               V2SF_type_node, V2SF_type_node, 
-                               V2SF_type_node, V2SF_type_node, NULL_TREE);
-
-  v2sf_ftype_v2sf_v2sf_int
-    = build_function_type_list (V2SF_type_node, 
-                               V2SF_type_node, V2SF_type_node, 
-                               integer_type_node, NULL_TREE);
-
-  sf_ftype_sf
-    = build_function_type_list (float_type_node, 
-                               float_type_node, NULL_TREE);
-
-  df_ftype_df
-    = build_function_type_list (double_type_node, 
-                               double_type_node, NULL_TREE);
-
-  sf_ftype_sf_sf
-    = build_function_type_list (float_type_node, 
-                               float_type_node, float_type_node, 
-                               NULL_TREE);
-
-  df_ftype_df_df
-    = build_function_type_list (double_type_node, 
-                               double_type_node, double_type_node, 
-                               NULL_TREE);
-
-  for (i = 0, d = mips_bdesc; i < ARRAY_SIZE (mips_bdesc); i++, d++)
-    {
-      if ((d->target_flags & MASK_PAIRED_SINGLE)
-         && !TARGET_PAIRED_SINGLE_FLOAT)
-       continue;
-
-      if ((d->target_flags & MASK_MIPS3D) 
-         && !TARGET_MIPS3D)
-       continue;
-
-      switch (d->ftype)
-       {
-       case MIPS_V2SF_FTYPE_V2SF_V2SF:
-         lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf_v2sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_V2SF_FTYPE_SF_SF:
-         lang_hooks.builtin_function (d->name, v2sf_ftype_sf_sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_SF_FTYPE_V2SF:
-         lang_hooks.builtin_function (d->name, sf_ftype_v2sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_V2SF_FTYPE_V2SF:
-         lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_INT_FTYPE_V2SF_V2SF:
-         lang_hooks.builtin_function (d->name, int_ftype_v2sf_v2sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF:
-         lang_hooks.builtin_function (d->name, int_ftype_v2sf_v2sf_v2sf_v2sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_V2SF_FTYPE_V2SF_V2SF_INT:
-         lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf_v2sf_int,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
-
-       case MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF:
-         lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf_v2sf_v2sf_v2sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_INT_FTYPE_SF_SF]
+    = build_function_type_list (integer_type_node,
+                               float_type_node, float_type_node, NULL_TREE);
 
-       case MIPS_SF_FTYPE_SF:
-         lang_hooks.builtin_function (d->name, sf_ftype_sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_INT_FTYPE_DF_DF]
+    = build_function_type_list (integer_type_node,
+                               double_type_node, double_type_node, NULL_TREE);
 
-       case MIPS_DF_FTYPE_DF:
-         lang_hooks.builtin_function (d->name, df_ftype_df,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_SF_FTYPE_V2SF]
+    = build_function_type_list (float_type_node, V2SF_type_node, NULL_TREE);
 
-       case MIPS_INT_FTYPE_SF_SF:
-         lang_hooks.builtin_function (d->name, int_ftype_sf_sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_SF_FTYPE_SF]
+    = build_function_type_list (float_type_node,
+                               float_type_node, NULL_TREE);
 
-       case MIPS_INT_FTYPE_DF_DF:
-         lang_hooks.builtin_function (d->name, int_ftype_df_df,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_SF_FTYPE_SF_SF]
+    = build_function_type_list (float_type_node,
+                               float_type_node, float_type_node, NULL_TREE);
 
-       case MIPS_SF_FTYPE_SF_SF:
-         lang_hooks.builtin_function (d->name, sf_ftype_sf_sf,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_DF_FTYPE_DF]
+    = build_function_type_list (double_type_node,
+                               double_type_node, NULL_TREE);
 
-       case MIPS_DF_FTYPE_DF_DF:
-         lang_hooks.builtin_function (d->name, df_ftype_df_df,
-                                      d->code, BUILT_IN_MD, NULL, NULL_TREE);
-         break;
+  types[MIPS_DF_FTYPE_DF_DF]
+    = build_function_type_list (double_type_node,
+                               double_type_node, double_type_node, NULL_TREE);
 
-       default:
-         break;
-       }
-    }
+  for (d = mips_bdesc; d < &mips_bdesc[ARRAY_SIZE (mips_bdesc)]; d++)
+    if ((d->target_flags & target_flags) == d->target_flags)
+      lang_hooks.builtin_function (d->name, types[d->ftype],
+                                  d->code, BUILT_IN_MD, NULL, NULL_TREE);
 }
 
 /* Expand a __builtin_mips_movt_*_ps() or __builtin_mips_movf_*_ps()