diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2012-09-29 10:23:23 +0200 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2012-09-29 08:23:23 +0000 |
commit | ae22ac3c62db451bae04a239d7b8c8b289e14ee7 (patch) | |
tree | 0b98a3c25fff30018c7011801207d5dbac884eed /gcc/tree.c | |
parent | b1d6986c94998636277821cb24b9b310da5f23e3 (diff) | |
download | gcc-ae22ac3c62db451bae04a239d7b8c8b289e14ee7.zip gcc-ae22ac3c62db451bae04a239d7b8c8b289e14ee7.tar.gz gcc-ae22ac3c62db451bae04a239d7b8c8b289e14ee7.tar.bz2 |
tree.c (truth_type_for): New function.
2012-09-29 Marc Glisse <marc.glisse@inria.fr>
* tree.c (truth_type_for): New function.
* tree.h (truth_type_for): Declare.
* gimple-fold.c (and_comparisons_1): Call it.
(or_comparisons_1): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond): Don't use
boolean_type_node for vectors.
From-SVN: r191848
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -10250,6 +10250,22 @@ signed_type_for (tree type) return signed_or_unsigned_type_for (0, type); } +/* If TYPE is a vector type, return a signed integer vector type with the + same width and number of subparts. Otherwise return boolean_type_node. */ + +tree +truth_type_for (tree type) +{ + if (TREE_CODE (type) == VECTOR_TYPE) + { + tree elem = lang_hooks.types.type_for_size + (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (type))), 0); + return build_opaque_vector_type (elem, TYPE_VECTOR_SUBPARTS (type)); + } + else + return boolean_type_node; +} + /* Returns the largest value obtainable by casting something in INNER type to OUTER type. */ |