diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-07 14:36:38 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-07 14:36:38 +0000 |
commit | c4740c5d51c91bf89e34c9a38e7e8f7ddf9fd2fa (patch) | |
tree | 2b9ac40e2ddfd76e458ab91dc73fbb371682b0f1 /gcc/stor-layout.c | |
parent | 421b11b1634f1ed9bb7e8022af8124f2c2b1b7b3 (diff) | |
download | gcc-c4740c5d51c91bf89e34c9a38e7e8f7ddf9fd2fa.tar.gz |
2010-10-07 Richard Guenther <rguenther@suse.de>
* machmode.h (mode_for_vector): Declare.
* stor-layout.c (mode_for_vector): New function, split out from ...
(layout_type): ... here.
* tree-vectorizer.h (current_vector_size): Declare.
* tree-vect-stmts.c (perm_mask_for_reverse): Check if the
mask vector type is available.
(get_vectype_for_scalar_type): Rename to ...
(get_vectype_for_scalar_type_and_size): ... this. Get a vector
size argument.
(get_vectype_for_scalar_type): New wrapper around
get_vectype_for_scalar_type_and_size using current_vector_size.
(get_same_sized_vectype): Use get_vectype_for_scalar_type_and_size.
* tree-vect-loop.c (vect_analyze_loop_2): Split out core part
of vect_analyze_loop here.
(vect_analyze_loop): Loop over vector sizes calling vect_analyze_loop_3.
* tree-vect-slp.c (vect_slp_analyze_bb): Set current_vector_size
to autodetect.
* config/i386/i386.c (ix86_vectorize_builtin_conversion): Fix
V8SF to V8SI conversion builtin.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165116 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 7ffef4d8491..5796ea1f09a 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -470,6 +470,50 @@ int_mode_for_mode (enum machine_mode mode) return mode; } +/* Find a mode that is suitable for representing a vector with + NUNITS elements of mode INNERMODE. Returns BLKmode if there + is no suitable mode. */ + +enum machine_mode +mode_for_vector (enum machine_mode innermode, unsigned nunits) +{ + enum machine_mode mode; + + /* First, look for a supported vector type. */ + if (SCALAR_FLOAT_MODE_P (innermode)) + mode = MIN_MODE_VECTOR_FLOAT; + else if (SCALAR_FRACT_MODE_P (innermode)) + mode = MIN_MODE_VECTOR_FRACT; + else if (SCALAR_UFRACT_MODE_P (innermode)) + mode = MIN_MODE_VECTOR_UFRACT; + else if (SCALAR_ACCUM_MODE_P (innermode)) + mode = MIN_MODE_VECTOR_ACCUM; + else if (SCALAR_UACCUM_MODE_P (innermode)) + mode = MIN_MODE_VECTOR_UACCUM; + else + mode = MIN_MODE_VECTOR_INT; + + /* Do not check vector_mode_supported_p here. We'll do that + later in vector_type_mode. */ + for (; mode != VOIDmode ; mode = GET_MODE_WIDER_MODE (mode)) + if (GET_MODE_NUNITS (mode) == nunits + && GET_MODE_INNER (mode) == innermode) + break; + + /* For integers, try mapping it to a same-sized scalar mode. */ + if (mode == VOIDmode + && GET_MODE_CLASS (innermode) == MODE_INT) + mode = mode_for_size (nunits * GET_MODE_BITSIZE (innermode), + MODE_INT, 0); + + if (mode == VOIDmode + || (GET_MODE_CLASS (mode) == MODE_INT + && !have_regs_of_mode[mode])) + return BLKmode; + + return mode; +} + /* Return the alignment of MODE. This will be bounded by 1 and BIGGEST_ALIGNMENT. */ @@ -1848,44 +1892,8 @@ layout_type (tree type) /* Find an appropriate mode for the vector type. */ if (TYPE_MODE (type) == VOIDmode) - { - enum machine_mode innermode = TYPE_MODE (innertype); - enum machine_mode mode; - - /* First, look for a supported vector type. */ - if (SCALAR_FLOAT_MODE_P (innermode)) - mode = MIN_MODE_VECTOR_FLOAT; - else if (SCALAR_FRACT_MODE_P (innermode)) - mode = MIN_MODE_VECTOR_FRACT; - else if (SCALAR_UFRACT_MODE_P (innermode)) - mode = MIN_MODE_VECTOR_UFRACT; - else if (SCALAR_ACCUM_MODE_P (innermode)) - mode = MIN_MODE_VECTOR_ACCUM; - else if (SCALAR_UACCUM_MODE_P (innermode)) - mode = MIN_MODE_VECTOR_UACCUM; - else - mode = MIN_MODE_VECTOR_INT; - - /* Do not check vector_mode_supported_p here. We'll do that - later in vector_type_mode. */ - for (; mode != VOIDmode ; mode = GET_MODE_WIDER_MODE (mode)) - if (GET_MODE_NUNITS (mode) == nunits - && GET_MODE_INNER (mode) == innermode) - break; - - /* For integers, try mapping it to a same-sized scalar mode. */ - if (mode == VOIDmode - && GET_MODE_CLASS (innermode) == MODE_INT) - mode = mode_for_size (nunits * GET_MODE_BITSIZE (innermode), - MODE_INT, 0); - - if (mode == VOIDmode || - (GET_MODE_CLASS (mode) == MODE_INT - && !have_regs_of_mode[mode])) - SET_TYPE_MODE (type, BLKmode); - else - SET_TYPE_MODE (type, mode); - } + SET_TYPE_MODE (type, + mode_for_vector (TYPE_MODE (innertype), nunits)); TYPE_SATURATING (type) = TYPE_SATURATING (TREE_TYPE (type)); TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type)); |