diff mbox series

[72/77] Pass scalar_mode to scalar_mode_supported_p

Message ID 87iniwbtdm.fsf@linaro.org
State New
Headers show
Series Add wrapper classes for machine_modes | expand

Commit Message

Richard Sandiford July 13, 2017, 9:04 a.m. UTC
This patch makes the scalar_mode_supported_p target hook take a
scalar_mode rather than a machine_mode.

2017-07-13  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.

Comments

Jeff Law Aug. 25, 2017, 4:44 p.m. UTC | #1
On 07/13/2017 03:04 AM, Richard Sandiford wrote:
> This patch makes the scalar_mode_supported_p target hook take a

> scalar_mode rather than a machine_mode.

> 

> 2017-07-13  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.

> 

OK.
jeff
diff mbox series

Patch

Index: gcc/target.def
===================================================================
--- gcc/target.def	2017-07-13 09:18:51.667770394 +0100
+++ gcc/target.def	2017-07-13 09:18:57.574337591 +0100
@@ -3304,7 +3304,7 @@  The default version of this hook returns
 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: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	2017-07-13 09:18:51.668770318 +0100
+++ gcc/targhooks.h	2017-07-13 09:18:57.575337520 +0100
@@ -71,7 +71,7 @@  extern void default_print_operand_addres
 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);
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	2017-07-13 09:18:51.667770394 +0100
+++ gcc/targhooks.c	2017-07-13 09:18:57.574337591 +0100
@@ -394,7 +394,7 @@  default_mangle_assembler_name (const cha
    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: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c	2017-07-13 09:18:51.583776726 +0100
+++ gcc/config/aarch64/aarch64.c	2017-07-13 09:18:57.498343016 +0100
@@ -15053,7 +15053,7 @@  aarch64_libgcc_floating_mode_supported_p
    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: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	2017-07-13 09:18:51.585776575 +0100
+++ gcc/config/alpha/alpha.c	2017-07-13 09:18:57.499342945 +0100
@@ -688,7 +688,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: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	2017-07-13 09:18:30.892502525 +0100
+++ gcc/config/arm/arm.c	2017-07-13 09:18:57.510342160 +0100
@@ -256,7 +256,7 @@  static bool arm_output_addr_const_extra
 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 *);
@@ -23598,7 +23598,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: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c	2017-07-13 09:18:55.158511776 +0100
+++ gcc/config/avr/avr.c	2017-07-13 09:18:57.511342088 +0100
@@ -882,7 +882,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: gcc/config/c6x/c6x.c
===================================================================
--- gcc/config/c6x/c6x.c	2017-07-13 09:18:22.915279989 +0100
+++ gcc/config/c6x/c6x.c	2017-07-13 09:18:57.512342017 +0100
@@ -6255,7 +6255,7 @@  c6x_preferred_simd_mode (machine_mode mo
 /* 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: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	2017-07-13 09:18:30.896502154 +0100
+++ gcc/config/i386/i386.c	2017-07-13 09:18:57.530340732 +0100
@@ -45064,7 +45064,7 @@  ix86_expand_reduc (rtx (*fn) (rtx, rtx,
 
 /* 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: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	2017-07-13 09:18:51.593775972 +0100
+++ gcc/config/ia64/ia64.c	2017-07-13 09:18:57.531340661 +0100
@@ -309,7 +309,7 @@  static tree ia64_handle_version_id_attri
 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);
@@ -10963,7 +10963,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: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2017-07-13 09:18:51.603775218 +0100
+++ gcc/config/mips/mips.c	2017-07-13 09:18:57.535340375 +0100
@@ -13312,7 +13312,7 @@  mips_vector_mode_supported_p (machine_mo
 /* 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: gcc/config/msp430/msp430.c
===================================================================
--- gcc/config/msp430/msp430.c	2017-07-13 09:18:51.603775218 +0100
+++ gcc/config/msp430/msp430.c	2017-07-13 09:18:57.535340375 +0100
@@ -870,7 +870,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: gcc/config/pa/pa.c
===================================================================
--- gcc/config/pa/pa.c	2017-07-13 09:18:19.085698082 +0100
+++ gcc/config/pa/pa.c	2017-07-13 09:18:57.536340304 +0100
@@ -142,7 +142,7 @@  static rtx pa_expand_builtin (tree, rtx,
 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;
@@ -6424,7 +6424,7 @@  hppa_gimplify_va_arg_expr (tree valist,
    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: gcc/config/pdp11/pdp11.c
===================================================================
--- gcc/config/pdp11/pdp11.c	2017-02-23 19:54:22.000000000 +0000
+++ gcc/config/pdp11/pdp11.c	2017-07-13 09:18:57.537340232 +0100
@@ -160,7 +160,7 @@  static void pdp11_function_arg_advance (
 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
@@ -1909,7 +1909,7 @@  pdp11_legitimate_constant_p (machine_mod
 /* 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: gcc/config/powerpcspe/powerpcspe.c
===================================================================
--- gcc/config/powerpcspe/powerpcspe.c	2017-07-13 09:18:51.616774238 +0100
+++ gcc/config/powerpcspe/powerpcspe.c	2017-07-13 09:18:57.550339304 +0100
@@ -39158,7 +39158,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: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	2017-07-13 09:18:51.625773559 +0100
+++ gcc/config/rs6000/rs6000.c	2017-07-13 09:18:57.559338662 +0100
@@ -36162,7 +36162,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: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c	2017-07-13 09:18:51.628773334 +0100
+++ gcc/config/s390/s390.c	2017-07-13 09:18:57.563338376 +0100
@@ -1225,7 +1225,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: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c	2017-07-13 09:18:51.630773183 +0100
+++ gcc/config/spu/spu.c	2017-07-13 09:18:57.565338234 +0100
@@ -287,7 +287,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: gcc/config/tilegx/tilegx.c
===================================================================
--- gcc/config/tilegx/tilegx.c	2017-07-13 09:18:51.632773032 +0100
+++ gcc/config/tilegx/tilegx.c	2017-07-13 09:18:57.566338162 +0100
@@ -106,7 +106,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: gcc/config/tilepro/tilepro.c
===================================================================
--- gcc/config/tilepro/tilepro.c	2017-07-13 09:18:19.139692095 +0100
+++ gcc/config/tilepro/tilepro.c	2017-07-13 09:18:57.568338020 +0100
@@ -83,7 +83,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: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	2017-07-13 09:18:51.636772730 +0100
+++ gcc/doc/tm.texi	2017-07-13 09:18:57.571337806 +0100
@@ -4213,7 +4213,7 @@  hook returns true for both @code{ptr_mod
 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: gcc/c-family/c-attribs.c
===================================================================
--- gcc/c-family/c-attribs.c	2017-07-13 09:18:37.622901759 +0100
+++ gcc/c-family/c-attribs.c	2017-07-13 09:18:57.494343302 +0100
@@ -1308,7 +1308,6 @@  handle_destructor_attribute (tree *node,
 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
@@ -1323,14 +1322,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));
 }
 
 
@@ -1406,7 +1403,8 @@  handle_mode_attribute (tree *node, tree
 	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: