This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Move targetm.units_per_simd_word to largest_simd_mode


On Tue, 5 Oct 2010, Richard Henderson wrote:

> On 10/05/2010 09:02 AM, Richard Guenther wrote:
> > ! static unsigned int arm_largest_simd_mode (enum machine_mode);
> > ! static unsigned int sparc_largest_simd_mode (enum machine_mode);
> > ! static unsigned int rs6000_largest_simd_mode (enum machine_mode);
> 
> Bad prototypes.
> 
> > +   simd_mode = targetm.vectorize.largest_simd_mode (inner_mode);
> > + 
> >     /* FORNOW: Only a single vector size per mode
> >       (TARGET_VECTORIZE_UNITS_PER_SIMD_WORD) is expected.  */
> > !   nunits = GET_MODE_SIZE (simd_mode) / nbytes;
> > !   if (nunits <= 1)
> > !     return NULL_TREE;
> 
> I assume the wrongness of this comment is handled be one of the
> other two patches you mentioned?

Yes, I have moved a hunk into this one.

> > !   if (TARGET_ALTIVEC)
> > !     switch (mode)
> > !       {
> > !       case SFmode:
> > ! 	return V4SFmode;
> > !       default:;
> > !       }
> 
> Integer modes are missing for altivec.

Ok.  The following variant implements all suggested changes
and renames the hook to preferred_simd_mode (as that is what
it is really).

Bootstrapped and tested on x86_64-unknown-linux-gnu (together
with the other two patches, tobe posted in a final version
in a minute).  I have built cross-cc1 for arm-eabi, sparc-linux,
mips-linux and powerpc64-linux and verified I can build a
testcase with a loop at -O3.

Ok for trunk?

Thanks,
Richard.

2010-10-05  Richard Guenther  <rguenther@suse.de>

	* target.def (units_per_simd_word): Rename to ...
	(preferred_simd_mode): ... this.  Return mode instead of size.
	* targhooks.c (default_units_per_simd_word): Rename to ...
	(default_preferred_simd_mode): ... this.  Return word_mode.
	* targhooks.h (default_preferred_simd_mode): Declare.
	* config/arm/arm.c (arm_units_per_simd_word): Rename to ...
	(arm_preferred_simd_mode): ... this.  Re-implement.
	* config/i386/i386.c (ix86_units_per_simd_word): Rename to ...
	(ix86_preferred_simd_mode): ... this.  Re-implement.
	* config/sparc/sparc.c (sparc_units_per_simd_word): Rename to ...
	(sparc_preferred_simd_mode): ... this.  Re-implement.
	* config/mips/mips.c (mips_units_per_simd_word): Rename to ...
	(mips_preferred_simd_mode): ... this.  Re-implement.
	* config/rs6000/rs6000.c (rs6000_units_per_simd_word): Rename to ...
	(rs6000_preferred_simd_mode): ... this.  Re-implement.
	* tree-vect-stmts.c (get_vectype_for_scalar_type): Adjust.
	* doc/tm.texi.in (TARGET_VECTORIZE_UNITS_PER_SIMD_WORD): Remove.
	(TARGET_VECTORIZE_PREFERRED_SIMD_MODE): Document.
	* doc/tm.texi: Update.

Index: trunk/gcc/config/arm/arm.c
===================================================================
*** trunk.orig/gcc/config/arm/arm.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/config/arm/arm.c	2010-10-06 11:30:17.000000000 +0200
*************** static rtx arm_trampoline_adjust_address
*** 240,246 ****
  static rtx arm_pic_static_addr (rtx orig, rtx reg);
  static bool cortex_a9_sched_adjust_cost (rtx, rtx, rtx, int *);
  static bool xscale_sched_adjust_cost (rtx, rtx, rtx, int *);
! static unsigned int arm_units_per_simd_word (enum machine_mode);
  static bool arm_class_likely_spilled_p (reg_class_t);
  static bool arm_vector_alignment_reachable (const_tree type, bool is_packed);
  static bool arm_builtin_support_vector_misalignment (enum machine_mode mode,
--- 240,246 ----
  static rtx arm_pic_static_addr (rtx orig, rtx reg);
  static bool cortex_a9_sched_adjust_cost (rtx, rtx, rtx, int *);
  static bool xscale_sched_adjust_cost (rtx, rtx, rtx, int *);
! static enum machine_mode arm_preferred_simd_mode (enum machine_mode);
  static bool arm_class_likely_spilled_p (reg_class_t);
  static bool arm_vector_alignment_reachable (const_tree type, bool is_packed);
  static bool arm_builtin_support_vector_misalignment (enum machine_mode mode,
*************** static const struct attribute_spec arm_a
*** 381,388 ****
  #define TARGET_SHIFT_TRUNCATION_MASK arm_shift_truncation_mask
  #undef TARGET_VECTOR_MODE_SUPPORTED_P
  #define TARGET_VECTOR_MODE_SUPPORTED_P arm_vector_mode_supported_p
! #undef TARGET_VECTORIZE_UNITS_PER_SIMD_WORD
! #define TARGET_VECTORIZE_UNITS_PER_SIMD_WORD arm_units_per_simd_word
  
  #undef  TARGET_MACHINE_DEPENDENT_REORG
  #define TARGET_MACHINE_DEPENDENT_REORG arm_reorg
--- 381,388 ----
  #define TARGET_SHIFT_TRUNCATION_MASK arm_shift_truncation_mask
  #undef TARGET_VECTOR_MODE_SUPPORTED_P
  #define TARGET_VECTOR_MODE_SUPPORTED_P arm_vector_mode_supported_p
! #undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
! #define TARGET_VECTORIZE_PREFERRED_SIMD_MODE arm_preferred_simd_mode
  
  #undef  TARGET_MACHINE_DEPENDENT_REORG
  #define TARGET_MACHINE_DEPENDENT_REORG arm_reorg
*************** arm_vector_mode_supported_p (enum machin
*** 21998,22008 ****
     registers when autovectorizing for Neon, at least until multiple vector
     widths are supported properly by the middle-end.  */
  
! static unsigned int
! arm_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   return (TARGET_NEON
! 	  ? (TARGET_NEON_VECTORIZE_QUAD ? 16 : 8) : UNITS_PER_WORD);
  }
  
  /* Implement TARGET_CLASS_LIKELY_SPILLED_P.
--- 21998,22039 ----
     registers when autovectorizing for Neon, at least until multiple vector
     widths are supported properly by the middle-end.  */
  
! static enum machine_mode
! arm_preferred_simd_mode (enum machine_mode mode)
  {
!   if (TARGET_NEON)
!     switch (mode)
!       {
!       case SFmode:
! 	return TARGET_NEON_VECTORIZE_QUAD ? V4SFmode : V2SFmode;
!       case SImode:
! 	return TARGET_NEON_VECTORIZE_QUAD ? V4SImode : V2SImode;
!       case HImode:
! 	return TARGET_NEON_VECTORIZE_QUAD ? V8HImode : V4HImode;
!       case QImode:
! 	return TARGET_NEON_VECTORIZE_QUAD ? V16QImode : V8QImode;
!       case DImode:
! 	if (TARGET_NEON_VECTORIZE_QUAD)
! 	  return V2DImode;
! 	break;
! 
!       default:;
!       }
! 
!   if (TARGET_REALLY_IWMMXT)
!     switch (mode)
!       {
!       case SImode:
! 	return V2SImode;
!       case HImode:
! 	return V4HImode;
!       case QImode:
! 	return V8QImode;
! 
!       default:;
!       }
! 
!   return word_mode;
  }
  
  /* Implement TARGET_CLASS_LIKELY_SPILLED_P.
Index: trunk/gcc/config/i386/i386.c
===================================================================
*** trunk.orig/gcc/config/i386/i386.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/config/i386/i386.c	2010-10-06 13:30:50.000000000 +0200
*************** has_dispatch (rtx insn, int action)
*** 32962,32984 ****
  /* ??? No autovectorization into MMX or 3DNOW until we can reliably
     place emms and femms instructions.  */
  
! static unsigned int
! ix86_units_per_simd_word (enum machine_mode mode)
  {
    /* Disable double precision vectorizer if needed.  */
    if (mode == DFmode && !TARGET_VECTORIZE_DOUBLE)
!     return UNITS_PER_WORD;
  
! #if 0
!   /*  FIXME: AVX has 32byte floating point vector operations and 16byte
!       integer vector operations.  But vectorizer doesn't support
!       different sizes for integer and floating point vectors.  We limit
!       vector size to 16byte.  */
!   if (TARGET_AVX)
!     return (mode == DFmode || mode == SFmode) ? 32 : 16;
!   else
! #endif
!     return TARGET_SSE ? 16 : UNITS_PER_WORD;
  }
  
  /* Initialize the GCC target structure.  */
--- 32962,32996 ----
  /* ??? No autovectorization into MMX or 3DNOW until we can reliably
     place emms and femms instructions.  */
  
! static enum machine_mode
! ix86_preferred_simd_mode (enum machine_mode mode)
  {
    /* Disable double precision vectorizer if needed.  */
    if (mode == DFmode && !TARGET_VECTORIZE_DOUBLE)
!     return word_mode;
  
!   if (!TARGET_AVX && !TARGET_SSE)
!     return word_mode;
! 
!   switch (mode)
!     {
!     case SFmode:
!       return TARGET_AVX ? V8SFmode : V4SFmode;
!     case DFmode:
!       return TARGET_AVX ? V4DFmode : V2DFmode;
!     case DImode:
!       return V2DImode;
!     case SImode:
!       return V4SImode;
!     case HImode:
!       return V8HImode;
!     case QImode:
!       return V16QImode;
! 
!     default:;
!     }
! 
!   return word_mode;
  }
  
  /* Initialize the GCC target structure.  */
*************** ix86_units_per_simd_word (enum machine_m
*** 33238,33246 ****
  #undef TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK
  #define TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK \
    ix86_vectorize_builtin_vec_perm_ok
! #undef TARGET_VECTORIZE_UNITS_PER_SIMD_WORD
! #define TARGET_VECTORIZE_UNITS_PER_SIMD_WORD \
!   ix86_units_per_simd_word
  
  #undef TARGET_SET_CURRENT_FUNCTION
  #define TARGET_SET_CURRENT_FUNCTION ix86_set_current_function
--- 33250,33258 ----
  #undef TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK
  #define TARGET_VECTORIZE_BUILTIN_VEC_PERM_OK \
    ix86_vectorize_builtin_vec_perm_ok
! #undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
! #define TARGET_VECTORIZE_PREFERRED_SIMD_MODE \
!   ix86_preferred_simd_mode
  
  #undef TARGET_SET_CURRENT_FUNCTION
  #define TARGET_SET_CURRENT_FUNCTION ix86_set_current_function
Index: trunk/gcc/config/sparc/sparc.c
===================================================================
*** trunk.orig/gcc/config/sparc/sparc.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/config/sparc/sparc.c	2010-10-06 11:30:18.000000000 +0200
*************** static bool sparc_can_eliminate (const i
*** 435,441 ****
  static const char *sparc_mangle_type (const_tree);
  #endif
  static void sparc_trampoline_init (rtx, tree, rtx);
! static unsigned int sparc_units_per_simd_word (enum machine_mode);
  
  #ifdef SUBTARGET_ATTRIBUTE_TABLE
  /* Table of valid machine attributes.  */
--- 435,441 ----
  static const char *sparc_mangle_type (const_tree);
  #endif
  static void sparc_trampoline_init (rtx, tree, rtx);
! static enum machine_mode sparc_preferred_simd_mode (enum machine_mode);
  
  #ifdef SUBTARGET_ATTRIBUTE_TABLE
  /* Table of valid machine attributes.  */
*************** static bool fpu_option_set = false;
*** 573,580 ****
  #undef TARGET_VECTOR_MODE_SUPPORTED_P
  #define TARGET_VECTOR_MODE_SUPPORTED_P sparc_vector_mode_supported_p
  
! #undef TARGET_VECTORIZE_UNITS_PER_SIMD_WORD
! #define TARGET_VECTORIZE_UNITS_PER_SIMD_WORD sparc_units_per_simd_word
  
  #undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
  #define TARGET_DWARF_HANDLE_FRAME_UNSPEC sparc_dwarf_handle_frame_unspec
--- 573,580 ----
  #undef TARGET_VECTOR_MODE_SUPPORTED_P
  #define TARGET_VECTOR_MODE_SUPPORTED_P sparc_vector_mode_supported_p
  
! #undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
! #define TARGET_VECTORIZE_PREFERRED_SIMD_MODE sparc_preferred_simd_mode
  
  #undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
  #define TARGET_DWARF_HANDLE_FRAME_UNSPEC sparc_dwarf_handle_frame_unspec
*************** sparc_vector_mode_supported_p (enum mach
*** 6244,6255 ****
    return TARGET_VIS && VECTOR_MODE_P (mode) ? true : false;
  }
  
! /* Implement the TARGET_VECTORIZE_UNITS_PER_SIMD_WORD target hook.  */
  
! static unsigned int
! sparc_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   return TARGET_VIS ? 8 : UNITS_PER_WORD;
  }
  
  /* Return the string to output an unconditional branch to LABEL, which is
--- 6244,6268 ----
    return TARGET_VIS && VECTOR_MODE_P (mode) ? true : false;
  }
  
! /* Implement the TARGET_VECTORIZE_PREFERRED_SIMD_MODE target hook.  */
  
! static enum machine_mode
! sparc_preferred_simd_mode (enum machine_mode mode)
  {
!   if (TARGET_VIS)
!     switch (mode)
!       {
!       case SImode:
! 	return V2SImode;
!       case HImode:
! 	return V4HImode;
!       case QImode:
! 	return V8QImode;
! 
!       default:;
!       }
! 
!   return word_mode;
  }
  
  /* Return the string to output an unconditional branch to LABEL, which is
Index: trunk/gcc/target.def
===================================================================
*** trunk.orig/gcc/target.def	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/target.def	2010-10-06 13:30:50.000000000 +0200
*************** DEFHOOK
*** 880,892 ****
   (enum machine_mode mode, const_tree type, int misalignment, bool is_packed),
   default_builtin_support_vector_misalignment)
  
! /* Return units per SIMD word.  */
  DEFHOOK
! (units_per_simd_word,
   "",
!  unsigned int,
   (enum machine_mode mode),
!  default_units_per_simd_word)
  
  HOOK_VECTOR_END (vectorize)
  
--- 880,893 ----
   (enum machine_mode mode, const_tree type, int misalignment, bool is_packed),
   default_builtin_support_vector_misalignment)
  
! /* Returns the preferred mode for SIMD operations for the specified
!    scalar mode.  */
  DEFHOOK
! (preferred_simd_mode,
   "",
!  enum machine_mode,
   (enum machine_mode mode),
!  default_preferred_simd_mode)
  
  HOOK_VECTOR_END (vectorize)
  
Index: trunk/gcc/targhooks.c
===================================================================
*** trunk.orig/gcc/targhooks.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/targhooks.c	2010-10-06 13:30:50.000000000 +0200
*************** default_builtin_support_vector_misalignm
*** 979,988 ****
  /* By default, only attempt to parallelize bitwise operations, and
     possibly adds/subtracts using bit-twiddling.  */
  
! unsigned int
! default_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   return UNITS_PER_WORD;
  }
  
  /* Determine whether or not a pointer mode is valid. Assume defaults
--- 979,988 ----
  /* By default, only attempt to parallelize bitwise operations, and
     possibly adds/subtracts using bit-twiddling.  */
  
! enum machine_mode
! default_preferred_simd_mode (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   return word_mode;
  }
  
  /* Determine whether or not a pointer mode is valid. Assume defaults
Index: trunk/gcc/targhooks.h
===================================================================
*** trunk.orig/gcc/targhooks.h	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/targhooks.h	2010-10-06 13:30:50.000000000 +0200
*************** extern bool
*** 86,92 ****
  default_builtin_support_vector_misalignment (enum machine_mode mode,
  					     const_tree,
  					     int, bool);
! extern unsigned int default_units_per_simd_word (enum machine_mode mode);
  
  /* These are here, and not in hooks.[ch], because not all users of
     hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS.  */
--- 86,92 ----
  default_builtin_support_vector_misalignment (enum machine_mode mode,
  					     const_tree,
  					     int, bool);
! extern enum machine_mode default_preferred_simd_mode (enum machine_mode mode);
  
  /* These are here, and not in hooks.[ch], because not all users of
     hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS.  */
Index: trunk/gcc/tree-vect-stmts.c
===================================================================
*** trunk.orig/gcc/tree-vect-stmts.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/tree-vect-stmts.c	2010-10-06 13:30:45.000000000 +0200
*************** tree
*** 4793,4804 ****
  get_vectype_for_scalar_type (tree scalar_type)
  {
    enum machine_mode inner_mode = TYPE_MODE (scalar_type);
    unsigned int nbytes = GET_MODE_SIZE (inner_mode);
    int nunits;
    tree vectype;
  
!   if (nbytes == 0
!       || (nbytes >= targetm.vectorize.units_per_simd_word (inner_mode)))
      return NULL_TREE;
  
    /* We can't build a vector type of elements with alignment bigger than
--- 4793,4804 ----
  get_vectype_for_scalar_type (tree scalar_type)
  {
    enum machine_mode inner_mode = TYPE_MODE (scalar_type);
+   enum machine_mode simd_mode;
    unsigned int nbytes = GET_MODE_SIZE (inner_mode);
    int nunits;
    tree vectype;
  
!   if (nbytes == 0)
      return NULL_TREE;
  
    /* We can't build a vector type of elements with alignment bigger than
*************** get_vectype_for_scalar_type (tree scalar
*** 4814,4822 ****
        && GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type))
      return NULL_TREE;
  
!   /* FORNOW: Only a single vector size per mode
!     (TARGET_VECTORIZE_UNITS_PER_SIMD_WORD) is expected.  */
!   nunits = targetm.vectorize.units_per_simd_word (inner_mode) / nbytes;
  
    vectype = build_vector_type (scalar_type, nunits);
    if (vect_print_dump_info (REPORT_DETAILS))
--- 4814,4827 ----
        && GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type))
      return NULL_TREE;
  
!   if (GET_MODE_CLASS (inner_mode) != MODE_INT
!       && GET_MODE_CLASS (inner_mode) != MODE_FLOAT)
!     return NULL_TREE;
! 
!   simd_mode = targetm.vectorize.preferred_simd_mode (inner_mode);
!   nunits = GET_MODE_SIZE (simd_mode) / nbytes;
!   if (nunits <= 1)
!     return NULL_TREE;
  
    vectype = build_vector_type (scalar_type, nunits);
    if (vect_print_dump_info (REPORT_DETAILS))
Index: trunk/gcc/config/mips/mips.c
===================================================================
*** trunk.orig/gcc/config/mips/mips.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/config/mips/mips.c	2010-10-06 11:30:18.000000000 +0200
*************** mips_scalar_mode_supported_p (enum machi
*** 11140,11151 ****
    return default_scalar_mode_supported_p (mode);
  }
  
! /* Implement TARGET_VECTORIZE_UNITS_PER_SIMD_WORD.  */
  
! static unsigned int
! mips_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   return TARGET_PAIRED_SINGLE_FLOAT ? 8 : UNITS_PER_WORD;
  }
  
  /* Implement TARGET_INIT_LIBFUNCS.  */
--- 11140,11154 ----
    return default_scalar_mode_supported_p (mode);
  }
  
! /* Implement TARGET_VECTORIZE_PREFERRED_SIMD_MODE.  */
  
! static enum machine_mode
! mips_preferred_simd_mode (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   if (TARGET_PAIRED_SINGLE_FLOAT
!       && mode == SFmode)
!     return V2SFmode;
!   return word_mode;
  }
  
  /* Implement TARGET_INIT_LIBFUNCS.  */
*************** mips_shift_truncation_mask (enum machine
*** 16524,16531 ****
  #undef TARGET_SCALAR_MODE_SUPPORTED_P
  #define TARGET_SCALAR_MODE_SUPPORTED_P mips_scalar_mode_supported_p
  
! #undef TARGET_VECTORIZE_UNITS_PER_SIMD_WORD
! #define TARGET_VECTORIZE_UNITS_PER_SIMD_WORD mips_units_per_simd_word
  
  #undef TARGET_INIT_BUILTINS
  #define TARGET_INIT_BUILTINS mips_init_builtins
--- 16527,16534 ----
  #undef TARGET_SCALAR_MODE_SUPPORTED_P
  #define TARGET_SCALAR_MODE_SUPPORTED_P mips_scalar_mode_supported_p
  
! #undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
! #define TARGET_VECTORIZE_PREFERRED_SIMD_MODE mips_preferred_simd_mode
  
  #undef TARGET_INIT_BUILTINS
  #define TARGET_INIT_BUILTINS mips_init_builtins
Index: trunk/gcc/config/rs6000/rs6000.c
===================================================================
*** trunk.orig/gcc/config/rs6000/rs6000.c	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/config/rs6000/rs6000.c	2010-10-06 11:30:18.000000000 +0200
*************** static bool rs6000_builtin_support_vecto
*** 1086,1092 ****
  							int, bool);
  static int rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt,
                                                tree, int);
! static unsigned int rs6000_units_per_simd_word (enum machine_mode);
  
  static void def_builtin (int, const char *, tree, int);
  static bool rs6000_vector_alignment_reachable (const_tree, bool);
--- 1086,1092 ----
  							int, bool);
  static int rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt,
                                                tree, int);
! static enum machine_mode rs6000_preferred_simd_mode (enum machine_mode);
  
  static void def_builtin (int, const char *, tree, int);
  static bool rs6000_vector_alignment_reachable (const_tree, bool);
*************** static const struct attribute_spec rs600
*** 1492,1500 ****
  #undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
  #define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST \
    rs6000_builtin_vectorization_cost
! #undef TARGET_VECTORIZE_UNITS_PER_SIMD_WORD
! #define TARGET_VECTORIZE_UNITS_PER_SIMD_WORD \
!   rs6000_units_per_simd_word
  
  #undef TARGET_INIT_BUILTINS
  #define TARGET_INIT_BUILTINS rs6000_init_builtins
--- 1492,1500 ----
  #undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
  #define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST \
    rs6000_builtin_vectorization_cost
! #undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
! #define TARGET_VECTORIZE_PREFERRED_SIMD_MODE \
!   rs6000_preferred_simd_mode
  
  #undef TARGET_INIT_BUILTINS
  #define TARGET_INIT_BUILTINS rs6000_init_builtins
*************** rs6000_builtin_vectorization_cost (enum
*** 3595,3610 ****
      }
  }
  
! /* Implement targetm.vectorize.units_per_simd_word.  */
  
! static unsigned int
! rs6000_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED)
  {
!   return (TARGET_VSX ? UNITS_PER_VSX_WORD
! 	  : (TARGET_ALTIVEC ? UNITS_PER_ALTIVEC_WORD
! 	     : (TARGET_SPE ? UNITS_PER_SPE_WORD
! 		: (TARGET_PAIRED_FLOAT ? UNITS_PER_PAIRED_WORD
! 		   : UNITS_PER_WORD))));
  }
  
  /* Handle generic options of the form -mfoo=yes/no.
--- 3595,3640 ----
      }
  }
  
! /* Implement targetm.vectorize.preferred_simd_mode.  */
  
! static enum machine_mode
! rs6000_preferred_simd_mode (enum machine_mode mode)
  {
!   if (TARGET_VSX)
!     switch (mode)
!       {
!       case DFmode:
! 	return V2DFmode;
!       default:;
!       }
!   if (TARGET_ALTIVEC || TARGET_VSX)
!     switch (mode)
!       {
!       case SFmode:
! 	return V4SFmode;
!       case DImode:
! 	return V2DImode;
!       case SImode:
! 	return V4SImode;
!       case HImode:
! 	return V8HImode;
!       case QImode:
! 	return V16QImode;
!       default:;
!       }
!   if (TARGET_SPE)
!     switch (mode)
!       {
!       case SFmode:
! 	return V2SFmode;
!       case SImode:
! 	return V2SImode;
!       default:;
!       }
!   if (TARGET_PAIRED_FLOAT
!       && mode == SFmode)
!     return V2SFmode;
!   return word_mode;
  }
  
  /* Handle generic options of the form -mfoo=yes/no.
Index: trunk/gcc/doc/tm.texi.in
===================================================================
*** trunk.orig/gcc/doc/tm.texi.in	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/doc/tm.texi.in	2010-10-06 13:30:50.000000000 +0200
*************** the elements in the vectors should be of
*** 5759,5768 ****
  parameter is true if the memory access is defined in a packed struct.
  @end deftypefn
  
! @hook TARGET_VECTORIZE_UNITS_PER_SIMD_WORD
! This hook should return th number of units in the vectors that the
! vectorizer can produce for scalar mode @var{mode}.  The default is
! equal to @code{UNITS_PER_WORD}, because the vectorizer can do some
  transformations even in absence of specialized @acronym{SIMD} hardware.
  @end deftypefn
  
--- 5759,5768 ----
  parameter is true if the memory access is defined in a packed struct.
  @end deftypefn
  
! @hook TARGET_VECTORIZE_PREFERRED_SIMD_MODE
! This hook should return the preferred mode for vectorizing scalar
! mode @var{mode}.  The default is
! equal to @code{word_mode}, because the vectorizer can do some
  transformations even in absence of specialized @acronym{SIMD} hardware.
  @end deftypefn
  
Index: trunk/gcc/doc/tm.texi
===================================================================
*** trunk.orig/gcc/doc/tm.texi	2010-10-06 11:29:38.000000000 +0200
--- trunk/gcc/doc/tm.texi	2010-10-06 13:06:25.000000000 +0200
*************** the elements in the vectors should be of
*** 5761,5770 ****
  parameter is true if the memory access is defined in a packed struct.
  @end deftypefn
  
! @deftypefn {Target Hook} {unsigned int} TARGET_VECTORIZE_UNITS_PER_SIMD_WORD (enum machine_mode @var{mode})
! This hook should return th number of units in the vectors that the
! vectorizer can produce for scalar mode @var{mode}.  The default is
! equal to @code{UNITS_PER_WORD}, because the vectorizer can do some
  transformations even in absence of specialized @acronym{SIMD} hardware.
  @end deftypefn
  
--- 5761,5770 ----
  parameter is true if the memory access is defined in a packed struct.
  @end deftypefn
  
! @deftypefn {Target Hook} {enum machine_mode} TARGET_VECTORIZE_PREFERRED_SIMD_MODE (enum machine_mode @var{mode})
! This hook should return the preferred mode for vectorizing scalar
! mode @var{mode}.  The default is
! equal to @code{word_mode}, because the vectorizer can do some
  transformations even in absence of specialized @acronym{SIMD} hardware.
  @end deftypefn
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]