https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69956
Ilya Enkovich <ienkovich at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ienkovich at gcc dot gnu.org
--- Comment #3 from Ilya Enkovich <ienkovich at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> We have VEC_UNPACK_HI_EXPR of 'int' type on { 0, 0, ... }
>
> vect_patt_45.15_139 = [vec_unpack_hi_expr] mask__39.12_136;
>
>
> _139 is of type int.
For multi-step conversion we get a type by mode:
intermediate_mode = insn_data[icode1].operand[0].mode;
intermediate_type
= lang_hooks.types.type_for_mode (intermediate_mode,
TYPE_UNSIGNED (prev_type));
We can never get boolean vector like this. We may introduce a target hook to
get boolean vector by mode or just compute it from the previous vectype. This
patch fixes ICE for the testcase:
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 9678d7c..1434d98 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -9000,9 +9000,19 @@ supportable_widening_operation (enum tree_code code,
gimple *stmt,
for (i = 0; i < MAX_INTERM_CVT_STEPS; i++)
{
intermediate_mode = insn_data[icode1].operand[0].mode;
- intermediate_type
- = lang_hooks.types.type_for_mode (intermediate_mode,
- TYPE_UNSIGNED (prev_type));
+ if (VECTOR_BOOLEAN_TYPE_P (prev_type))
+ {
+ intermediate_type
+ = build_truth_vector_type (TYPE_VECTOR_SUBPARTS (prev_type) / 2,
+ current_vector_size);
+ if (intermediate_mode != TYPE_MODE (intermediate_type)
+ return false;
+ }
+ else
+ intermediate_type
+ = lang_hooks.types.type_for_mode (intermediate_mode,
+ TYPE_UNSIGNED (prev_type));
+
optab3 = optab_for_tree_code (c1, intermediate_type, optab_default);
optab4 = optab_for_tree_code (c2, intermediate_type, optab_default);
Similar change is is required for narrowing case.