aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2012-09-29 10:23:23 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2012-09-29 08:23:23 +0000
commitae22ac3c62db451bae04a239d7b8c8b289e14ee7 (patch)
tree0b98a3c25fff30018c7011801207d5dbac884eed /gcc/tree.c
parentb1d6986c94998636277821cb24b9b310da5f23e3 (diff)
downloadgcc-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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 9169424..7f620e5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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. */