https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112623
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- But the problem is of course that you then can't have both at the same time, vec_pack_trunk_v4sf from V8HF and V8BF unless we'd support "VOIDmode" there. Note there's the "better" {s,z}ext optabs which have two modes and could support V8HF to V8SF conversions, but it doesn't work to model the pack/unpack style of ISA with this. The ambiguities would support using a conversion optab for the various pack/unpack optabs but we have very many of those ... and the problem extends to even/odd and lo/hi widen ops as well. I don't think mass-changing those at this point is desirable (that definitely looks like a stage1 problem). As long as we don't have both we can circumvent the ICE with patches like proposed. Fixed patch, "complete": diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index d39dfc1065f..0fb21e58138 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -47,6 +47,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfgcleanup.h" #include "cfganal.h" #include "optabs-tree.h" +#include "insn-config.h" +#include "recog.h" #include "tree-vector-builder.h" #include "vec-perm-indices.h" #include "internal-fn.h" @@ -2978,6 +2980,7 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) /* Only few targets implement direct conversion patterns so try some simple special cases via VEC_[UN]PACK[_FLOAT]_LO_EXPR. */ optab optab; + insn_code icode; tree halfvectype, dblvectype; enum tree_code unpack_op; @@ -3015,8 +3018,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) && (optab = optab_for_tree_code (unpack_op, dblvectype, optab_default)) - && (optab_handler (optab, TYPE_MODE (dblvectype)) - != CODE_FOR_nothing)) + && ((icode = optab_handler (optab, TYPE_MODE (dblvectype))) + != CODE_FOR_nothing) + && (insn_data[icode].operand[0].mode == TYPE_MODE (type))) { gimple_seq stmts = NULL; tree dbl; @@ -3054,8 +3058,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) && (optab = optab_for_tree_code (VEC_PACK_TRUNC_EXPR, halfvectype, optab_default)) - && (optab_handler (optab, TYPE_MODE (halfvectype)) - != CODE_FOR_nothing)) + && ((icode = optab_handler (optab, TYPE_MODE (halfvectype))) + != CODE_FOR_nothing) + && (insn_data[icode].operand[0].mode == TYPE_MODE (type))) { gimple_seq stmts = NULL; tree low = gimple_build (&stmts, BIT_FIELD_REF, halfvectype,