https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68714
--- Comment #3 from Ilya Enkovich <ienkovich at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #1) > Helps, but then we have: > > _8 = x_1(D) <= y_2(D); > _6 = VEC_COND_EXPR <_8, { -1, -1, -1, -1 }, { 0, 0, 0, 0 }>; > > vector lowering calls expand_vec_cond_expr_p using the type of _8 (when the > comparison is inside rhs1, it uses the type of x) which goes through > get_vcond_mask_icode so it answers false (on everything but x86), and the > VEC_COND_EXPR is lowered to a horrible sequence of > > _5 = BIT_FIELD_REF <_8, 32, 0>; > _3 = _5 != 0; > _4 = _3 ? -1 : 0; > [...] > _6 = {_4, _11, _14, _17}; expand_vec_cond_expr_p is not in sync with expand_vec_cond_expr right now. expand_vec_cond_expr allows VEC_COND_EXPR with no embedded comparison even if vcond_mask_optab doesn't have it. This patch should help: diff --git a/gcc/optabs-tree.c b/gcc/optabs-tree.c index d887619..3c9c485 100644 --- a/gcc/optabs-tree.c +++ b/gcc/optabs-tree.c @@ -343,8 +343,13 @@ expand_vec_cond_expr_p (tree value_type, tree cmp_op_type) machine_mode value_mode = TYPE_MODE (value_type); machine_mode cmp_op_mode = TYPE_MODE (cmp_op_type); if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type)) - return get_vcond_mask_icode (TYPE_MODE (value_type), - TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing; + { + if (get_vcond_mask_icode (TYPE_MODE (value_type), + TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing) + return true; + if (GET_MODE_CLASS (TYPE_MODE (cmp_op_type)) != MODE_VECTOR_INT) + return false; + } if (GET_MODE_SIZE (value_mode) != GET_MODE_SIZE (cmp_op_mode) || GET_MODE_NUNITS (value_mode) != GET_MODE_NUNITS (cmp_op_mode) || get_vcond_icode (TYPE_MODE (value_type), TYPE_MODE (cmp_op_type),