+2015-12-01 Ilya Enkovich <enkovich.gnu@gmail.com>
+
+ PR middle-end/68595
+ * tree-vect-stmts.c (vect_init_vector): Cast boolean
+ scalars to a proper value before building a vector.
+
2015-12-01 Richard Sandiford <richard.sandiford@arm.com>
* genattrtab.c (check_attr_test): Take an attr_desc instead of
+2015-12-01 Ilya Enkovich <enkovich.gnu@gmail.com>
+
+ PR middle-end/68595
+ * gcc.dg/pr68595.c: New test.
+
2015-12-01 Christian Bruel <christian.bruel@st.com>
* gcc.target/arm/ftest-armv6-thumb.c: Remove NEED_ARM_FEATURE_UNALIGNED.
{
if (!types_compatible_p (TREE_TYPE (type), TREE_TYPE (val)))
{
- if (CONSTANT_CLASS_P (val))
+ /* Scalar boolean value should be transformed into
+ all zeros or all ones value before building a vector. */
+ if (VECTOR_BOOLEAN_TYPE_P (type))
+ {
+ tree true_val = build_zero_cst (TREE_TYPE (type));
+ tree false_val = build_all_ones_cst (TREE_TYPE (type));
+
+ if (CONSTANT_CLASS_P (val))
+ val = integer_zerop (val) ? false_val : true_val;
+ else
+ {
+ new_temp = make_ssa_name (TREE_TYPE (type));
+ init_stmt = gimple_build_assign (new_temp, COND_EXPR,
+ val, true_val, false_val);
+ vect_init_vector_1 (stmt, init_stmt, gsi);
+ val = new_temp;
+ }
+ }
+ else if (CONSTANT_CLASS_P (val))
val = fold_convert (TREE_TYPE (type), val);
else
{