tree test, true_value, false_value;
tree lhs = NULL_TREE;
tree rhs = NULL_TREE;
+ enum tree_code cond_code = COND_EXPR;
- if (TREE_CODE (cond) == COND_EXPR)
+ if (TREE_CODE (cond) == COND_EXPR
+ || TREE_CODE (cond) == VEC_COND_EXPR)
{
test = TREE_OPERAND (cond, 0);
true_value = TREE_OPERAND (cond, 1);
false_value = constant_boolean_node (false, testtype);
}
+ if (TREE_CODE (TREE_TYPE (test)) == VECTOR_TYPE)
+ cond_code = VEC_COND_EXPR;
+
/* This transformation is only worthwhile if we don't have to wrap ARG
in a SAVE_EXPR and the operation can be simplified on at least one
of the branches once its pushed inside the COND_EXPR. */
if (!TREE_CONSTANT (arg) && !TREE_CONSTANT (lhs) && !TREE_CONSTANT (rhs))
return NULL_TREE;
- return fold_build3_loc (loc, COND_EXPR, type, test, lhs, rhs);
+ return fold_build3_loc (loc, cond_code, type, test, lhs, rhs);
}
\f
tem);
}
- if (TREE_CODE (arg0) == COND_EXPR || COMPARISON_CLASS_P (arg0))
+ if (TREE_CODE (arg0) == COND_EXPR
+ || TREE_CODE (arg0) == VEC_COND_EXPR
+ || COMPARISON_CLASS_P (arg0))
{
tem = fold_binary_op_with_conditional_arg (loc, code, type, op0, op1,
arg0, arg1,
return tem;
}
- if (TREE_CODE (arg1) == COND_EXPR || COMPARISON_CLASS_P (arg1))
+ if (TREE_CODE (arg1) == COND_EXPR
+ || TREE_CODE (arg1) == VEC_COND_EXPR
+ || COMPARISON_CLASS_P (arg1))
{
tem = fold_binary_op_with_conditional_arg (loc, code, type, op0, op1,
arg1, arg0,