]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[72/77] Pass scalar_mode to scalar_mode_supported_p
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 30 Aug 2017 11:20:30 +0000 (11:20 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 30 Aug 2017 11:20:30 +0000 (11:20 +0000)
This patch makes the scalar_mode_supported_p target hook take a
scalar_mode rather than a machine_mode.

2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* target.def (scalar_mode_supported_p): Take a scalar_mode
instead of a machine_mode.
* targhooks.h (default_scalar_mode_supported_p): Likewise.
* targhooks.c (default_scalar_mode_supported_p): Likewise.
* config/aarch64/aarch64.c (aarch64_scalar_mode_supported_p): Likewise.
* config/alpha/alpha.c (alpha_scalar_mode_supported_p): Likewise.
* config/arm/arm.c (arm_scalar_mode_supported_p): Likewise.
* config/avr/avr.c (avr_scalar_mode_supported_p): Likewise.
* config/c6x/c6x.c (c6x_scalar_mode_supported_p): Likewise.
* config/i386/i386.c (ix86_scalar_mode_supported_p): Likewise.
* config/ia64/ia64.c (ia64_scalar_mode_supported_p): Likewise.
* config/mips/mips.c (mips_scalar_mode_supported_p): Likewise.
* config/msp430/msp430.c (msp430_scalar_mode_supported_p): Likewise.
* config/pa/pa.c (pa_scalar_mode_supported_p): Likewise.
* config/pdp11/pdp11.c (pdp11_scalar_mode_supported_p): Likewise.
* config/powerpcspe/powerpcspe.c (rs6000_scalar_mode_supported_p):
Likewise.
* config/rs6000/rs6000.c (rs6000_scalar_mode_supported_p): Likewise.
* config/s390/s390.c (s390_scalar_mode_supported_p): Likewise.
* config/spu/spu.c (spu_scalar_mode_supported_p): Likewise.
* config/tilegx/tilegx.c (tilegx_scalar_mode_supported_p): Likewise.
* config/tilepro/tilepro.c (tilepro_scalar_mode_supported_p):
Likewise.
* doc/tm.texi: Regenerate.

gcc/c-family/
* c-attribs.c (vector_mode_valid_p) Fold GET_MODE_INNER call
into scalar_mode_supported_p call.
(handle_mode_attribute): Update call to scalar_mode_supported_p.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251523

24 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-attribs.c
gcc/config/aarch64/aarch64.c
gcc/config/alpha/alpha.c
gcc/config/arm/arm.c
gcc/config/avr/avr.c
gcc/config/c6x/c6x.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/config/mips/mips.c
gcc/config/msp430/msp430.c
gcc/config/pa/pa.c
gcc/config/pdp11/pdp11.c
gcc/config/powerpcspe/powerpcspe.c
gcc/config/rs6000/rs6000.c
gcc/config/s390/s390.c
gcc/config/spu/spu.c
gcc/config/tilegx/tilegx.c
gcc/config/tilepro/tilepro.c
gcc/doc/tm.texi
gcc/target.def
gcc/targhooks.c
gcc/targhooks.h

index 1f5302a704e122b43b635d536d7f012d07085c62..caaa95d7dcf47a2cc0449b748c4af7936ccfe113 100644 (file)
@@ -1,3 +1,32 @@
+2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * target.def (scalar_mode_supported_p): Take a scalar_mode
+       instead of a machine_mode.
+       * targhooks.h (default_scalar_mode_supported_p): Likewise.
+       * targhooks.c (default_scalar_mode_supported_p): Likewise.
+       * config/aarch64/aarch64.c (aarch64_scalar_mode_supported_p): Likewise.
+       * config/alpha/alpha.c (alpha_scalar_mode_supported_p): Likewise.
+       * config/arm/arm.c (arm_scalar_mode_supported_p): Likewise.
+       * config/avr/avr.c (avr_scalar_mode_supported_p): Likewise.
+       * config/c6x/c6x.c (c6x_scalar_mode_supported_p): Likewise.
+       * config/i386/i386.c (ix86_scalar_mode_supported_p): Likewise.
+       * config/ia64/ia64.c (ia64_scalar_mode_supported_p): Likewise.
+       * config/mips/mips.c (mips_scalar_mode_supported_p): Likewise.
+       * config/msp430/msp430.c (msp430_scalar_mode_supported_p): Likewise.
+       * config/pa/pa.c (pa_scalar_mode_supported_p): Likewise.
+       * config/pdp11/pdp11.c (pdp11_scalar_mode_supported_p): Likewise.
+       * config/powerpcspe/powerpcspe.c (rs6000_scalar_mode_supported_p):
+       Likewise.
+       * config/rs6000/rs6000.c (rs6000_scalar_mode_supported_p): Likewise.
+       * config/s390/s390.c (s390_scalar_mode_supported_p): Likewise.
+       * config/spu/spu.c (spu_scalar_mode_supported_p): Likewise.
+       * config/tilegx/tilegx.c (tilegx_scalar_mode_supported_p): Likewise.
+       * config/tilepro/tilepro.c (tilepro_scalar_mode_supported_p):
+       Likewise.
+       * doc/tm.texi: Regenerate.
+
 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index a294404ec2efcf1a331791b0e80706d5ad1576ee..9aba47fd6c2e989635bbcdeffd20140303d054c7 100644 (file)
@@ -1,3 +1,11 @@
+2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * c-attribs.c (vector_mode_valid_p) Fold GET_MODE_INNER call
+       into scalar_mode_supported_p call.
+       (handle_mode_attribute): Update call to scalar_mode_supported_p.
+
 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index e564c727e245aa4d064cb237a7e99944fd984d6b..4f6638fd99e0a816a307b5b92c884d4b418dcc4a 100644 (file)
@@ -1339,7 +1339,6 @@ static bool
 vector_mode_valid_p (machine_mode mode)
 {
   enum mode_class mclass = GET_MODE_CLASS (mode);
-  machine_mode innermode;
 
   /* Doh!  What's going on?  */
   if (mclass != MODE_VECTOR_INT
@@ -1354,14 +1353,12 @@ vector_mode_valid_p (machine_mode mode)
   if (targetm.vector_mode_supported_p (mode))
     return true;
 
-  innermode = GET_MODE_INNER (mode);
-
   /* We should probably return 1 if requesting V4DI and we have no DI,
      but we have V2DI, but this is probably very unlikely.  */
 
   /* If we have support for the inner mode, we can safely emulate it.
      We may not have V2DI, but me can emulate with a pair of DIs.  */
-  return targetm.scalar_mode_supported_p (innermode);
+  return targetm.scalar_mode_supported_p (GET_MODE_INNER (mode));
 }
 
 
@@ -1437,7 +1434,8 @@ handle_mode_attribute (tree *node, tree name, tree args,
        case MODE_UFRACT:
        case MODE_ACCUM:
        case MODE_UACCUM:
-         valid_mode = targetm.scalar_mode_supported_p (mode);
+         valid_mode
+           = targetm.scalar_mode_supported_p (as_a <scalar_mode> (mode));
          break;
 
        case MODE_COMPLEX_INT:
index 09f592718c64562aa6c4c3f95e22cdab2c6325d5..88e675b807b04d16b7235043925f03113f3777af 100644 (file)
@@ -15150,7 +15150,7 @@ aarch64_libgcc_floating_mode_supported_p (scalar_float_mode mode)
    if MODE is HFmode, and punt to the generic implementation otherwise.  */
 
 static bool
-aarch64_scalar_mode_supported_p (machine_mode mode)
+aarch64_scalar_mode_supported_p (scalar_mode mode)
 {
   return (mode == HFmode
          ? true
index dbfd29862fc25756bcd41db02b809ef4501fc7d8..c37a7e3631f904a4a420987ec8a64744363913aa 100644 (file)
@@ -691,7 +691,7 @@ resolve_reload_operand (rtx op)
    indicates only DFmode.  */
 
 static bool
-alpha_scalar_mode_supported_p (machine_mode mode)
+alpha_scalar_mode_supported_p (scalar_mode mode)
 {
   switch (mode)
     {
index e66cfa651b5304476ec9f016eab890ac9bd19755..7e0e9514d014e61233a82d104e3acab85340a797 100644 (file)
@@ -257,7 +257,7 @@ static bool arm_output_addr_const_extra (FILE *, rtx);
 static bool arm_allocate_stack_slots_for_args (void);
 static bool arm_warn_func_return (tree);
 static tree arm_promoted_type (const_tree t);
-static bool arm_scalar_mode_supported_p (machine_mode);
+static bool arm_scalar_mode_supported_p (scalar_mode);
 static bool arm_frame_pointer_required (void);
 static bool arm_can_eliminate (const int, const int);
 static void arm_asm_trampoline_template (FILE *);
@@ -23601,7 +23601,7 @@ arm_promoted_type (const_tree t)
    special-cased in the default hook.  */
 
 static bool
-arm_scalar_mode_supported_p (machine_mode mode)
+arm_scalar_mode_supported_p (scalar_mode mode)
 {
   if (mode == HFmode)
     return (arm_fp16_format != ARM_FP16_FORMAT_NONE);
index c1d27497d50bc36caee7d32f7414f064b91e472f..09bf5eedbde88dc53e2b5cae2a53bc95687e298d 100644 (file)
@@ -884,7 +884,7 @@ avr_regno_reg_class (int r)
 /* Implement `TARGET_SCALAR_MODE_SUPPORTED_P'.  */
 
 static bool
-avr_scalar_mode_supported_p (machine_mode mode)
+avr_scalar_mode_supported_p (scalar_mode mode)
 {
   if (ALL_FIXED_POINT_MODE_P (mode))
     return true;
index d92b8782c49d8fbc8938ef84049947347abdbd03..bf7ec7e4b008df0b92d060b7d7f61bfd4f9aa86e 100644 (file)
@@ -6256,7 +6256,7 @@ c6x_preferred_simd_mode (machine_mode mode)
 /* Implement TARGET_SCALAR_MODE_SUPPORTED_P.  */
 
 static bool
-c6x_scalar_mode_supported_p (machine_mode mode)
+c6x_scalar_mode_supported_p (scalar_mode mode)
 {
   if (ALL_FIXED_POINT_MODE_P (mode)
       && GET_MODE_PRECISION (mode) <= 2 * BITS_PER_WORD)
index be83381692efb28873a3a9651ab7b083baf2db29..7867372789a2e00c63c8b666c539684986af6780 100644 (file)
@@ -45279,7 +45279,7 @@ ix86_expand_reduc (rtx (*fn) (rtx, rtx, rtx), rtx dest, rtx in)
 \f
 /* Target hook for scalar_mode_supported_p.  */
 static bool
-ix86_scalar_mode_supported_p (machine_mode mode)
+ix86_scalar_mode_supported_p (scalar_mode mode)
 {
   if (DECIMAL_FLOAT_MODE_P (mode))
     return default_decimal_float_supported_p ();
index 579751605107e6191a0396deb8e95c0c8db86600..409977fadd8ff25cdd2234e321beddefd64a8646 100644 (file)
@@ -310,7 +310,7 @@ static tree ia64_handle_version_id_attribute (tree *, tree, tree, int, bool *);
 static void ia64_encode_section_info (tree, rtx, int);
 static rtx ia64_struct_value_rtx (tree, int);
 static tree ia64_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *);
-static bool ia64_scalar_mode_supported_p (machine_mode mode);
+static bool ia64_scalar_mode_supported_p (scalar_mode mode);
 static bool ia64_vector_mode_supported_p (machine_mode mode);
 static bool ia64_legitimate_constant_p (machine_mode, rtx);
 static bool ia64_legitimate_address_p (machine_mode, rtx, bool);
@@ -10964,7 +10964,7 @@ ia64_struct_value_rtx (tree fntype,
 }
 
 static bool
-ia64_scalar_mode_supported_p (machine_mode mode)
+ia64_scalar_mode_supported_p (scalar_mode mode)
 {
   switch (mode)
     {
index 1f42c5671499970f329aa1ab0ef12a288ce2e418..a810ba729fc1634248a7fed4a3ff822d145544ad 100644 (file)
@@ -13312,7 +13312,7 @@ mips_vector_mode_supported_p (machine_mode mode)
 /* Implement TARGET_SCALAR_MODE_SUPPORTED_P.  */
 
 static bool
-mips_scalar_mode_supported_p (machine_mode mode)
+mips_scalar_mode_supported_p (scalar_mode mode)
 {
   if (ALL_FIXED_POINT_MODE_P (mode)
       && GET_MODE_PRECISION (mode) <= 2 * BITS_PER_WORD)
index d597812ec3e455f7c91d787e14aa5dadb87a9e08..b8b21255c5539065e2942f59b5707cdab8536acb 100644 (file)
@@ -872,7 +872,7 @@ msp430_option_override (void)
 #define TARGET_SCALAR_MODE_SUPPORTED_P msp430_scalar_mode_supported_p
 
 static bool
-msp430_scalar_mode_supported_p (machine_mode m)
+msp430_scalar_mode_supported_p (scalar_mode m)
 {
   if (m == PSImode && msp430x)
     return true;
index c6af3736e7560efe59022cca9b613f3269865edd..95ad7cf8dcc73e0f551624941c326b3da3c8fa96 100644 (file)
@@ -143,7 +143,7 @@ static rtx pa_expand_builtin (tree, rtx, rtx, machine_mode mode, int);
 static rtx hppa_builtin_saveregs (void);
 static void hppa_va_start (tree, rtx);
 static tree hppa_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
-static bool pa_scalar_mode_supported_p (machine_mode);
+static bool pa_scalar_mode_supported_p (scalar_mode);
 static bool pa_commutative_p (const_rtx x, int outer_code);
 static void copy_fp_args (rtx_insn *) ATTRIBUTE_UNUSED;
 static int length_fp_args (rtx_insn *) ATTRIBUTE_UNUSED;
@@ -6416,7 +6416,7 @@ hppa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
    2 * BITS_PER_WORD isn't equal LONG_LONG_TYPE_SIZE.  */
 
 static bool
-pa_scalar_mode_supported_p (machine_mode mode)
+pa_scalar_mode_supported_p (scalar_mode mode)
 {
   int precision = GET_MODE_PRECISION (mode);
 
index fbbb34390f4fc7de4b7119f4f51c8027f15c473c..b4d54fc0a78563500ab6c2351779d0c6f3f38e91 100644 (file)
@@ -162,7 +162,7 @@ static void pdp11_function_arg_advance (cumulative_args_t,
 static void pdp11_conditional_register_usage (void);
 static bool pdp11_legitimate_constant_p (machine_mode, rtx);
 
-static bool pdp11_scalar_mode_supported_p (machine_mode);
+static bool pdp11_scalar_mode_supported_p (scalar_mode);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_BYTE_OP
@@ -1911,7 +1911,7 @@ pdp11_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
 /* Implement TARGET_SCALAR_MODE_SUPPORTED_P.  */
 
 static bool
-pdp11_scalar_mode_supported_p (machine_mode mode)
+pdp11_scalar_mode_supported_p (scalar_mode mode)
 {
   /* Support SFmode even with -mfloat64.  */
   if (mode == SFmode)
index 3f418b027fa9ea93b92f2c4f8a695227f533f068..0d8eda48dff2780eee3ac41d52025ea4ded91ff5 100644 (file)
@@ -39156,7 +39156,7 @@ rs6000_eh_return_filter_mode (void)
 
 /* Target hook for scalar_mode_supported_p.  */
 static bool
-rs6000_scalar_mode_supported_p (machine_mode mode)
+rs6000_scalar_mode_supported_p (scalar_mode mode)
 {
   /* -m32 does not support TImode.  This is the default, from
      default_scalar_mode_supported_p.  For -m32 -mpowerpc64 we want the
index 97a7005e2cdd89ef1d959817c087c282ad4b329a..51b7ec01ca2e324d5716397b9a4b69b6052e02df 100644 (file)
@@ -35913,7 +35913,7 @@ rs6000_eh_return_filter_mode (void)
 
 /* Target hook for scalar_mode_supported_p.  */
 static bool
-rs6000_scalar_mode_supported_p (machine_mode mode)
+rs6000_scalar_mode_supported_p (scalar_mode mode)
 {
   /* -m32 does not support TImode.  This is the default, from
      default_scalar_mode_supported_p.  For -m32 -mpowerpc64 we want the
index e013751c7ad65b9aa4894153dd9c293bb3b685e7..957cfcbbdfac883774a43afcef1bac8fa857cbab 100644 (file)
@@ -1229,7 +1229,7 @@ s390_unwind_word_mode (void)
 
 /* Return true if the back end supports mode MODE.  */
 static bool
-s390_scalar_mode_supported_p (machine_mode mode)
+s390_scalar_mode_supported_p (scalar_mode mode)
 {
   /* In contrast to the default implementation reject TImode constants on 31bit
      TARGET_ZARCH for ABI compliance.  */
index 20c88e6953d8a793c40c874a15de0fd6bc627487..5fabdd243d17a8f7a0160455e8629d34d1b9628c 100644 (file)
@@ -288,7 +288,7 @@ spu_option_override (void)
    be manipulated in non-trivial ways.  In particular, this means all
    the arithmetic is supported.  */
 static bool
-spu_scalar_mode_supported_p (machine_mode mode)
+spu_scalar_mode_supported_p (scalar_mode mode)
 {
   switch (mode)
     {
index 250bb34917ff2413acddeda5b8983f0f26ace855..2f00b7357414dac605d5fb5465185bf773bb40fc 100644 (file)
@@ -107,7 +107,7 @@ tilegx_option_override (void)
 
 /* Implement TARGET_SCALAR_MODE_SUPPORTED_P.  */
 static bool
-tilegx_scalar_mode_supported_p (machine_mode mode)
+tilegx_scalar_mode_supported_p (scalar_mode mode)
 {
   switch (mode)
     {
index b63fc57c9ea59718bcde8b960e5b121807769aa8..9b6c5f6057eb163def554b60f0bacf2201917491 100644 (file)
@@ -84,7 +84,7 @@ tilepro_option_override (void)
 
 /* Implement TARGET_SCALAR_MODE_SUPPORTED_P.  */
 static bool
-tilepro_scalar_mode_supported_p (machine_mode mode)
+tilepro_scalar_mode_supported_p (scalar_mode mode)
 {
   switch (mode)
     {
index b415bf82d771430401b319af4ec1eb8bb1f6101e..b1835af3bc07ae46bca214fba13e3d19c75a6063 100644 (file)
@@ -4213,7 +4213,7 @@ hook returns true for both @code{ptr_mode} and @code{Pmode}.
 Define this to return nonzero if the memory reference @var{ref}  may alias with the system C library errno location.  The default  version of this hook assumes the system C library errno location  is either a declaration of type int or accessed by dereferencing  a pointer to int.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_SCALAR_MODE_SUPPORTED_P (machine_mode @var{mode})
+@deftypefn {Target Hook} bool TARGET_SCALAR_MODE_SUPPORTED_P (scalar_mode @var{mode})
 Define this to return nonzero if the port is prepared to handle
 insns involving scalar mode @var{mode}.  For a scalar mode to be
 considered supported, all the basic arithmetic and comparisons
index b4f6cb4d617453a586522b12683d28279846a737..f8ef0d392ff5e2ea507c674e15c2c6e47af2c440 100644 (file)
@@ -3315,7 +3315,7 @@ The default version of this hook returns true for any mode\n\
 required to handle the basic C types (as defined by the port).\n\
 Included here are the double-word arithmetic supported by the\n\
 code in @file{optabs.c}.",
- bool, (machine_mode mode),
+ bool, (scalar_mode mode),
  default_scalar_mode_supported_p)
 
 /* Similarly for vector modes.  "Supported" here is less strict.  At
index 48a339f1db3aecc2c9df16c9ca2e1c7124c3c4d2..15c71cf34e8dbe3900d2b2a4644966f7287e5f9a 100644 (file)
@@ -395,7 +395,7 @@ default_mangle_assembler_name (const char *name ATTRIBUTE_UNUSED)
    supported by optabs.c.  */
 
 bool
-default_scalar_mode_supported_p (machine_mode mode)
+default_scalar_mode_supported_p (scalar_mode mode)
 {
   int precision = GET_MODE_PRECISION (mode);
 
index a1f55e52e9a168547d38e657dae0d4dc6ef01ab4..a9ae75f57f3bf80c5fb6076b0d9205c904976d80 100644 (file)
@@ -71,7 +71,7 @@ extern void default_print_operand_address (FILE *, machine_mode, rtx);
 extern bool default_print_operand_punct_valid_p (unsigned char);
 extern tree default_mangle_assembler_name (const char *);
 
-extern bool default_scalar_mode_supported_p (machine_mode);
+extern bool default_scalar_mode_supported_p (scalar_mode);
 extern bool default_libgcc_floating_mode_supported_p (scalar_float_mode);
 extern opt_scalar_float_mode default_floatn_mode (int, bool);
 extern bool targhook_words_big_endian (void);