https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92658
--- Comment #9 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to rguent...@suse.de from comment #8) > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92658 > > > > --- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- > > Richi, should the following test also vectorize? > > In priciple yes. I see both cases "vectorized" to a store > from a CTOR but then my primitive pattern matching in forwprop > not applying because supportable_convert_operation is confused > about a vector(4) char type having SImode and bailing out at the > > 292 if (!VECTOR_MODE_P (m1) || !VECTOR_MODE_P (m2)) > 293 return false; > > check. So it looks like with just SSE2 the backend doesn't > consider V4QImode a supported vector type. I'm not sure we > want to fix that but then this means regular optab checks > won't do it here. > > Interesting cases nevertheless. > > Would those conversions map to good assembly? Yes, please see attached test cases, especially pr92658-sse4.c. We have pmovzxbd for v4qi->v4si, pmovzxbq for v2qi->v2di, and pmovzxwd for v2hi->v2di, in addition to AVX2 pmovzxbq for v4qi->v4di. All testcases should vectorize with a single instruction. It is also possible to introduce additional conversions to 64bit vectors (e.g. v2qi->v2si) for TARGET_MMX_WITH_SSE targets. Please note that there are similar sign_extend patterns and corresponding truncate patterns with AVX512F, currently not covered by attached patch and testcases.