+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.
+
2012-09-28 Jan Hubicka <jh@suse.cz>
* basic-block.h (RDIV): Define.
#include "tree-ssa-propagate.h"
#include "target.h"
#include "gimple-fold.h"
-#include "langhooks.h"
/* Return true when DECL can be referenced from current unit.
FROM_DECL (if non-null) specify constructor of variable DECL was taken from.
and_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
enum tree_code code2, tree op2a, tree op2b)
{
- tree truth_type = boolean_type_node;
- if (TREE_CODE (TREE_TYPE (op1a)) == VECTOR_TYPE)
- {
- tree vec_type = TREE_TYPE (op1a);
- tree elem = lang_hooks.types.type_for_size
- (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vec_type))), 0);
- truth_type = build_opaque_vector_type (elem,
- TYPE_VECTOR_SUBPARTS (vec_type));
- }
+ tree truth_type = truth_type_for (TREE_TYPE (op1a));
/* First check for ((x CODE1 y) AND (x CODE2 y)). */
if (operand_equal_p (op1a, op2a, 0)
or_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
enum tree_code code2, tree op2a, tree op2b)
{
- tree truth_type = boolean_type_node;
- if (TREE_CODE (TREE_TYPE (op1a)) == VECTOR_TYPE)
- {
- tree vec_type = TREE_TYPE (op1a);
- tree elem = lang_hooks.types.type_for_size
- (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vec_type))), 0);
- truth_type = build_opaque_vector_type (elem,
- TYPE_VECTOR_SUBPARTS (vec_type));
- }
+ tree truth_type = truth_type_for (TREE_TYPE (op1a));
/* First check for ((x CODE1 y) OR (x CODE2 y)). */
if (operand_equal_p (op1a, op2a, 0)
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. */
extern tree signed_or_unsigned_type_for (int, tree);
extern tree signed_type_for (tree);
extern tree unsigned_type_for (tree);
+extern tree truth_type_for (tree);
extern void initialize_sizetypes (void);
extern void fixup_unsigned_type (tree);
extern tree build_pointer_type_for_mode (tree, enum machine_mode, bool);