diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-07 14:34:44 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-07 14:34:44 +0000 |
commit | b24d851fa7cad44fd130f4386f28062d6c395bb1 (patch) | |
tree | e369542c279196e8b7be20440bc887cf9eed16f3 /gcc/config | |
parent | 0d82568791b8565cc38d03ac20a63863cc74f1fb (diff) | |
download | gcc-b24d851fa7cad44fd130f4386f28062d6c395bb1.tar.gz |
2010-10-07 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165114 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/arm/arm.c | 45 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 44 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 15 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 54 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 27 |
5 files changed, 137 insertions, 48 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 7a8155d2fbc..8ad312ed743 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -240,7 +240,7 @@ static rtx arm_trampoline_adjust_address (rtx); 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 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, @@ -381,8 +381,8 @@ static const struct attribute_spec arm_attribute_table[] = #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_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 @@ -21998,11 +21998,42 @@ arm_vector_mode_supported_p (enum machine_mode mode) 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) +static enum machine_mode +arm_preferred_simd_mode (enum machine_mode mode) { - return (TARGET_NEON - ? (TARGET_NEON_VECTORIZE_QUAD ? 16 : 8) : UNITS_PER_WORD); + 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. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7fe654a3586..74ded78f800 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -32962,23 +32962,35 @@ has_dispatch (rtx insn, int action) /* ??? 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) +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 UNITS_PER_WORD; + return word_mode; -#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; + 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. */ @@ -33238,9 +33250,9 @@ ix86_units_per_simd_word (enum machine_mode mode) #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_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 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 95994cfc7a9..6555470dca3 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -11140,12 +11140,15 @@ mips_scalar_mode_supported_p (enum machine_mode mode) return default_scalar_mode_supported_p (mode); } -/* Implement TARGET_VECTORIZE_UNITS_PER_SIMD_WORD. */ +/* Implement TARGET_VECTORIZE_PREFERRED_SIMD_MODE. */ -static unsigned int -mips_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED) +static enum machine_mode +mips_preferred_simd_mode (enum machine_mode mode ATTRIBUTE_UNUSED) { - return TARGET_PAIRED_SINGLE_FLOAT ? 8 : UNITS_PER_WORD; + if (TARGET_PAIRED_SINGLE_FLOAT + && mode == SFmode) + return V2SFmode; + return word_mode; } /* Implement TARGET_INIT_LIBFUNCS. */ @@ -16524,8 +16527,8 @@ mips_shift_truncation_mask (enum machine_mode mode) #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_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 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 509000ba822..91b26124c5c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1086,7 +1086,7 @@ static bool rs6000_builtin_support_vector_misalignment (enum 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 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); @@ -1492,9 +1492,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #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_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 @@ -3595,16 +3595,46 @@ rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, } } -/* Implement targetm.vectorize.units_per_simd_word. */ +/* Implement targetm.vectorize.preferred_simd_mode. */ -static unsigned int -rs6000_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED) +static enum machine_mode +rs6000_preferred_simd_mode (enum machine_mode mode) { - 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)))); + 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. diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 36c60533d98..d672d8f6e3e 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -435,7 +435,7 @@ static bool sparc_can_eliminate (const int, const int); 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); +static enum machine_mode sparc_preferred_simd_mode (enum machine_mode); #ifdef SUBTARGET_ATTRIBUTE_TABLE /* Table of valid machine attributes. */ @@ -573,8 +573,8 @@ static bool fpu_option_set = false; #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_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 @@ -6244,12 +6244,25 @@ sparc_vector_mode_supported_p (enum machine_mode mode) return TARGET_VIS && VECTOR_MODE_P (mode) ? true : false; } -/* Implement the TARGET_VECTORIZE_UNITS_PER_SIMD_WORD target hook. */ +/* Implement the TARGET_VECTORIZE_PREFERRED_SIMD_MODE target hook. */ -static unsigned int -sparc_units_per_simd_word (enum machine_mode mode ATTRIBUTE_UNUSED) +static enum machine_mode +sparc_preferred_simd_mode (enum machine_mode mode) { - return TARGET_VIS ? 8 : UNITS_PER_WORD; + 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 |