ping On Mon, May 24, 2021 at 12:56 PM Hongtao Liu <crazy...@gmail.com> wrote: > > Hi: > This patch is about to Fold __builtin_ia32_pblendvb128 (a, b, c) as > VEC_COND_EXPR (c < 0, b, a), similar for float version but with > mask operand VIEW_CONVERT_EXPR to same sized integer vectype. > > After folding, blendv related patterns can be redefined as > vec_merge since all elements of mask operand is either const0_rtx or > constm1_rtx now. It could potentially enable more rtl optimizations. > > Besides, although there's no pblendv{d,q} instructions, backend can > still define their patterns and generate blendv{ps,pd} instead. > > Bootstrap and regtested on x86_64-linux-gnu{-m32,}. > Ok for trunk? > > gcc/ChangeLog: > > * config/i386/i386-builtin.def (IX86_BUILTIN_BLENDVPD256, > IX86_BUILTIN_BLENDVPS256, IX86_BUILTIN_PBLENDVB256, > IX86_BUILTIN_BLENDVPD, IX86_BUILTIN_BLENDVPS, > IX86_BUILTIN_PBLENDVB128): Replace icode with > CODE_FOR_nothing. > * config/i386/i386-expand.c (ix86_expand_sse_movcc): Use > > gen_avx_blendvd256/gen_avx_blendvq256/gen_sse4_1_blendvd/gen_sse4_1_blendvq > for V8SI/V4DI/V4SI/V2DImode. > * config/i386/i386.c (ix86_gimple_fold_builtin): Fold blendv > builtins. > * config/i386/mmx.md (mmx_blendvps): Change to define_expand. > (*mmx_blendvps): New pattern implemented as vec_merge. > * config/i386/sse.md > (<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>): Change to > define_expand. > (<sse4_1_avx2>_pblendvb): Ditto. > (*<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>): New pattern > implemented as vec_merge. > (*<sse4_1_avx2>_pblendvb): Ditto. > (*<sse4_1_avx2>_pblendvb_lt): Redefined as define_insn with > pattern implemented as vec_merge instead of UNSPEC_BLENDV. > (*<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>_lt): Ditto, > and extend mode to V48_AVX. > (*<sse4_1_avx2>_pblendvb_not_lt): New. > (*<sse4_1>_blendv<ssefltmodesuffix><avxsizesuffix>_ltint): Deleted. > (*<sse4_1_avx2>_pblendvb_lt): Ditto. > (*<sse4_1_avx2>_pblendvb_not_lt): Ditto. > > gcc/testsuite/ChangeLog: > > * gcc.target/i386/funcspec-8.c: Replace > __builtin_ia32_blendvpd with __builtin_ia32_roundps_az. > * gcc.target/i386/blendv-1.c: New test. > * gcc.target/i386/blendv-2.c: New test. > > > -- > BR, > Hongtao
-- BR, Hongtao