From: Richard Sandiford Date: Wed, 30 Aug 2017 11:20:30 +0000 (+0000) Subject: [72/77] Pass scalar_mode to scalar_mode_supported_p X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=18e2a8b889d520fc3598f74e39e1dbf1ef06ebd1;p=gcc.git [72/77] Pass scalar_mode to scalar_mode_supported_p This patch makes the scalar_mode_supported_p target hook take a scalar_mode rather than a machine_mode. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood 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 Co-Authored-By: David Sherwood From-SVN: r251523 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1f5302a704e..caaa95d7dcf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2017-08-30 Richard Sandiford + Alan Hayward + David Sherwood + + * 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 Alan Hayward David Sherwood diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a294404ec2e..9aba47fd6c2 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2017-08-30 Richard Sandiford + Alan Hayward + David Sherwood + + * 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 Alan Hayward David Sherwood diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index e564c727e24..4f6638fd99e 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -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 (mode)); break; case MODE_COMPLEX_INT: diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 09f592718c6..88e675b807b 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -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 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index dbfd29862fc..c37a7e3631f 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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) { diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index e66cfa651b5..7e0e9514d01 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -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); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index c1d27497d50..09bf5eedbde 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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; diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index d92b8782c49..bf7ec7e4b00 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -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) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index be83381692e..7867372789a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -45279,7 +45279,7 @@ ix86_expand_reduc (rtx (*fn) (rtx, rtx, rtx), rtx dest, rtx in) /* 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 (); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 57975160510..409977fadd8 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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) { diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1f42c567149..a810ba729fc 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -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) diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index d597812ec3e..b8b21255c55 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -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; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index c6af3736e75..95ad7cf8dcc 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -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); diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index fbbb34390f4..b4d54fc0a78 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -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); /* 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) diff --git a/gcc/config/powerpcspe/powerpcspe.c b/gcc/config/powerpcspe/powerpcspe.c index 3f418b027fa..0d8eda48dff 100644 --- a/gcc/config/powerpcspe/powerpcspe.c +++ b/gcc/config/powerpcspe/powerpcspe.c @@ -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 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 97a7005e2cd..51b7ec01ca2 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index e013751c7ad..957cfcbbdfa 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -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. */ diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 20c88e6953d..5fabdd243d1 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -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) { diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index 250bb34917f..2f00b735741 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -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) { diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index b63fc57c9ea..9b6c5f6057e 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -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) { diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index b415bf82d77..b1835af3bc0 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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 diff --git a/gcc/target.def b/gcc/target.def index b4f6cb4d617..f8ef0d392ff 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -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 diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 48a339f1db3..15c71cf34e8 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -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); diff --git a/gcc/targhooks.h b/gcc/targhooks.h index a1f55e52e9a..a9ae75f57f3 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -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);