[arm] Use arm_active_target when configuring builtins
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 15 Dec 2016 15:46:41 +0000 (15:46 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Thu, 15 Dec 2016 15:46:41 +0000 (15:46 +0000)
This patch uses the new ISA data structure to determine which builtins
to add.  It entirely eliminates the need for insn_flags to be a global
variable, but we're about to delete that in the following patches, so
for now we leave it as a global.

* arm-builtins.c: Include sbitmap.h.
(def_mbuiltin): Change first parameter to a flag bit.  Use it to test
available features in the current target.
(struct builtin_description): Change type of feature field.
(IWMMXT_BUILTIN): Use the isa_features types.
(IWMMXT2_BUILTIN): Likewise.
(IWMMXT_BUILTIN2): Likewise.
(IWMMXT2_BUILTIN2): Likewise.
(CRC32_BUILTIN): Likewise.
(CRYPTO_BUILTIN): Likewise.
(iwmmx_builtin): Likewise.
(iwmmx2_builtin): Likewise.
(arm_iwmmxt_builtin): Check for specific feature bits.

From-SVN: r243702

gcc/ChangeLog
gcc/config/arm/arm-builtins.c

index 659439c85c369ac54f7df5f10a12a6866503a434..51b14260f883e21e1a389ef0c8cd8c2903b21a7c 100644 (file)
@@ -1,3 +1,19 @@
+2016-12-15  Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm-builtins.c: Include sbitmap.h.
+       (def_mbuiltin): Change first parameter to a flag bit.  Use it to test
+       available features in the current target.
+       (struct builtin_description): Change type of feature field.
+       (IWMMXT_BUILTIN): Use the isa_features types.
+       (IWMMXT2_BUILTIN): Likewise.
+       (IWMMXT_BUILTIN2): Likewise.
+       (IWMMXT2_BUILTIN2): Likewise.
+       (CRC32_BUILTIN): Likewise.
+       (CRYPTO_BUILTIN): Likewise.
+       (iwmmx_builtin): Likewise.
+       (iwmmx2_builtin): Likewise.
+       (arm_iwmmxt_builtin): Check for specific feature bits.
+
 2016-12-15  Richard Earnshaw  <rearnsha@arm.com>
 
        * arm-isa.h (enum isa_feature): Add isa_quirk_cm3_ldrd.
index 14444206814fb95268ba5ba008245513b0dc94f1..80d3b673e4b3a138f14c3c0b37b3178eac3f594a 100644 (file)
@@ -37,6 +37,7 @@
 #include "expr.h"
 #include "langhooks.h"
 #include "case-cfn-macros.h"
+#include "sbitmap.h"
 
 #define SIMD_MAX_BUILTIN_ARGS 5
 
@@ -1154,11 +1155,11 @@ arm_init_crypto_builtins (void)
 #undef NUM_DREG_TYPES
 #undef NUM_QREG_TYPES
 
-#define def_mbuiltin(FLAGS, NAME, TYPE, CODE)                          \
+#define def_mbuiltin(FLAG, NAME, TYPE, CODE)                           \
   do                                                                   \
     {                                                                  \
-      const arm_feature_set flags = FLAGS;                             \
-      if (ARM_FSET_CPU_SUBSET (flags, insn_flags))                     \
+      if (FLAG == isa_nobit                                            \
+         || bitmap_bit_p (arm_active_target.isa, FLAG))                \
        {                                                               \
          tree bdecl;                                                   \
          bdecl = add_builtin_function ((NAME), (TYPE), (CODE),         \
@@ -1170,7 +1171,7 @@ arm_init_crypto_builtins (void)
 
 struct builtin_description
 {
-  const arm_feature_set    features;
+  const enum isa_feature   feature;
   const enum insn_code     icode;
   const char * const       name;
   const enum arm_builtins  code;
@@ -1181,12 +1182,12 @@ struct builtin_description
 static const struct builtin_description bdesc_2arg[] =
 {
 #define IWMMXT_BUILTIN(code, string, builtin) \
-  { ARM_FSET_MAKE_CPU1 (FL_IWMMXT), CODE_FOR_##code, \
+  { isa_bit_iwmmxt, CODE_FOR_##code, \
     "__builtin_arm_" string,                        \
     ARM_BUILTIN_##builtin, UNKNOWN, 0 },
 
 #define IWMMXT2_BUILTIN(code, string, builtin) \
-  { ARM_FSET_MAKE_CPU1 (FL_IWMMXT2), CODE_FOR_##code, \
+  { isa_bit_iwmmxt2, CODE_FOR_##code, \
     "__builtin_arm_" string,                         \
     ARM_BUILTIN_##builtin, UNKNOWN, 0 },
 
@@ -1270,11 +1271,11 @@ static const struct builtin_description bdesc_2arg[] =
   IWMMXT_BUILTIN (iwmmxt_walignr3, "walignr3", WALIGNR3)
 
 #define IWMMXT_BUILTIN2(code, builtin) \
-  { ARM_FSET_MAKE_CPU1 (FL_IWMMXT), CODE_FOR_##code, NULL, \
+  { isa_bit_iwmmxt, CODE_FOR_##code, NULL, \
     ARM_BUILTIN_##builtin, UNKNOWN, 0 },
 
 #define IWMMXT2_BUILTIN2(code, builtin) \
-  { ARM_FSET_MAKE_CPU2 (FL_IWMMXT2), CODE_FOR_##code, NULL, \
+  { isa_bit_iwmmxt2, CODE_FOR_##code, NULL, \
     ARM_BUILTIN_##builtin, UNKNOWN, 0 },
 
   IWMMXT2_BUILTIN2 (iwmmxt_waddbhusm, WADDBHUSM)
@@ -1290,7 +1291,7 @@ static const struct builtin_description bdesc_2arg[] =
 
 
 #define FP_BUILTIN(L, U) \
-  {ARM_FSET_EMPTY, CODE_FOR_##L, "__builtin_arm_"#L, ARM_BUILTIN_##U, \
+  {isa_nobit, CODE_FOR_##L, "__builtin_arm_"#L, ARM_BUILTIN_##U, \
    UNKNOWN, 0},
 
   FP_BUILTIN (get_fpscr, GET_FPSCR)
@@ -1298,7 +1299,7 @@ static const struct builtin_description bdesc_2arg[] =
 #undef FP_BUILTIN
 
 #define CRC32_BUILTIN(L, U) \
-  {ARM_FSET_EMPTY, CODE_FOR_##L, "__builtin_arm_"#L, \
+  {isa_nobit, CODE_FOR_##L, "__builtin_arm_"#L, \
    ARM_BUILTIN_##U, UNKNOWN, 0},
    CRC32_BUILTIN (crc32b, CRC32B)
    CRC32_BUILTIN (crc32h, CRC32H)
@@ -1310,7 +1311,7 @@ static const struct builtin_description bdesc_2arg[] =
 
 
 #define CRYPTO_BUILTIN(L, U)                                      \
-  {ARM_FSET_EMPTY, CODE_FOR_crypto_##L,        "__builtin_arm_crypto_"#L, \
+  {isa_nobit, CODE_FOR_crypto_##L,     "__builtin_arm_crypto_"#L, \
    ARM_BUILTIN_CRYPTO_##U, UNKNOWN, 0},
 #undef CRYPTO1
 #undef CRYPTO2
@@ -1567,9 +1568,9 @@ arm_init_iwmmxt_builtins (void)
       machine_mode mode;
       tree type;
 
-      if (d->name == 0 ||
-         !(ARM_FSET_HAS_CPU1 (d->features, FL_IWMMXT) ||
-           ARM_FSET_HAS_CPU1 (d->features, FL_IWMMXT2)))
+      if (d->name == 0
+         || !(d->feature == isa_bit_iwmmxt
+              || d->feature == isa_bit_iwmmxt2))
        continue;
 
       mode = insn_data[d->icode].operand[1].mode;
@@ -1593,16 +1594,16 @@ arm_init_iwmmxt_builtins (void)
          gcc_unreachable ();
        }
 
-      def_mbuiltin (d->features, d->name, type, d->code);
+      def_mbuiltin (d->feature, d->name, type, d->code);
     }
 
   /* Add the remaining MMX insns with somewhat more complicated types.  */
 #define iwmmx_mbuiltin(NAME, TYPE, CODE)                       \
-  def_mbuiltin (ARM_FSET_MAKE_CPU1 (FL_IWMMXT), "__builtin_arm_" NAME, \
+  def_mbuiltin (isa_bit_iwmmxt, "__builtin_arm_" NAME, \
                (TYPE), ARM_BUILTIN_ ## CODE)
 
 #define iwmmx2_mbuiltin(NAME, TYPE, CODE)                      \
-  def_mbuiltin (ARM_FSET_MAKE_CPU1 (FL_IWMMXT2), "__builtin_arm_" NAME, \
+  def_mbuiltin (isa_bit_iwmmxt2, "__builtin_arm_" NAME, \
                (TYPE), ARM_BUILTIN_ ## CODE)
 
   iwmmx_mbuiltin ("wzero", di_ftype_void, WZERO);