diff options
author | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-10 11:15:14 +0000 |
---|---|---|
committer | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-10 11:15:14 +0000 |
commit | 432dd330807c633428562eb7d66ede067fd87262 (patch) | |
tree | 28b2392d93f8ced83cd8e4d51d5232f6883088da /gcc/stor-layout.c | |
parent | 287e36142a3337a665099426864c94af017a535a (diff) | |
download | gcc-432dd330807c633428562eb7d66ede067fd87262.tar.gz |
2013-05-10 Marc Glisse <marc.glisse@inria.fr>
gcc/
* stor-layout.c (element_precision): New function.
* machmode.h (element_precision): Declare it.
* tree.c (build_minus_one_cst): New function.
(element_precision): Likewise.
* tree.h (build_minus_one_cst): Declare new function.
(element_precision): Likewise.
* fold-const.c (operand_equal_p): Use element_precision.
(fold_binary_loc): Handle vector types.
* convert.c (convert_to_integer): Use element_precision.
* gimple.c (iterative_hash_canonical_type): Handle complex and vectors
separately.
gcc/c-family/
* c-common.c (vector_types_convertible_p): No TYPE_PRECISION for
vectors.
gcc/testsuite/
* gcc.dg/vector-shift.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198772 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 5ad95b10030..6f6b3107841 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -453,6 +453,18 @@ get_mode_alignment (enum machine_mode mode) return MIN (BIGGEST_ALIGNMENT, MAX (1, mode_base_align[mode]*BITS_PER_UNIT)); } +/* Return the precision of the mode, or for a complex or vector mode the + precision of the mode of its elements. */ + +unsigned int +element_precision (enum machine_mode mode) +{ + if (COMPLEX_MODE_P (mode) || VECTOR_MODE_P (mode)) + mode = GET_MODE_INNER (mode); + + return GET_MODE_PRECISION (mode); +} + /* Return the natural mode of an array, given that it is SIZE bytes in total and has elements of type ELEM_TYPE. */ |