https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771
--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Hongtao.liu from comment #3) > for patt_42 = (<signed-boolean:1>) patt_40; > > vectype_in (QImode:nunits 4) > > <vector_type 0x7fffea18de70 > type <boolean_type 0x7fffea18ddc8 public QI > size <integer_cst 0x7fffea2e2e40 constant 8> > unit-size <integer_cst 0x7fffea2e2e58 constant 1> > align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type > 0x7fffea18ddc8 precision:1 min <integer_cst 0x7fffea196ab0 -1> max > <integer_cst 0x7fffea196b70 0>> > QI size <integer_cst 0x7fffea2e2e40 8> unit-size <integer_cst > 0x7fffea2e2e58 1> > align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type > 0x7fffea18de70 nunits:4> > > vectype_out(HImode) > > <vector_type 0x7fffea18df18 > type <boolean_type 0x7fffea18ddc8 public QI > size <integer_cst 0x7fffea2e2e40 constant 8> > unit-size <integer_cst 0x7fffea2e2e58 constant 1> > align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type > 0x7fffea18ddc8 precision:1 min <integer_cst 0x7fffea196ab0 -1> max > <integer_cst 0x7fffea196b70 0>> > HI > size <integer_cst 0x7fffea2e2f00 type <integer_type 0x7fffea2fd0a8 > bitsizetype> constant 16> > unit-size <integer_cst 0x7fffea2e2f18 type <integer_type 0x7fffea2fd000 > sizetype> constant 2> > align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type > 0x7fffea18df18 nunits:16> > > And ‘vec_pack_sbool_trunc_m’ only handle situation when input and output > have same mode. And GCC vectorizer only handle 2X elements, but not 4X,8X,... /* For scalar masks we may have different boolean vector types having the same QImode. Thus we add additional check for elements number. */ if (known_eq (TYPE_VECTOR_SUBPARTS (vectype) * 2, TYPE_VECTOR_SUBPARTS (narrow_vectype)))