[PATCH] D29399: [X86][SSE] Combine shuffle nodes with multiple uses if all the users are being combined.
Andrea Di Biagio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 1 12:51:42 PST 2017
andreadb added a comment.
Hi Simon,
Do you have other code examples (other than function @_clearupper2xi64b) which may benefit from your change?
I am asking this because function @_clearupper2xi64b would be easily optimized before we even reach the code generator.
InstCombine knows how to combine a sequence of constant insertelement into a single shuffle (See function 'foldConstantInsEltIntoShuffle' in InstCombineVectorOps.cpp). If you pass function @_clearupper2xi64b to `opt -instcombine` you would get this:
define <2 x i64> @_clearupper2xi64b(<2 x i64>) #0 {
%x32 = bitcast <2 x i64> %0 to <4 x i32>
%r1 = shufflevector <4 x i32> %x32, <4 x i32> <i32 undef, i32 0, i32 undef, i32 0>, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
%r = bitcast <4 x i32> %r1 to <2 x i64>
ret <2 x i64> %r
}
Later on, that shuffle would be lowered into a ANDPS (on pre-SSE4.1 targets):
` andps .LCPI0_0(%rip), %xmm0 `
Repository:
rL LLVM
https://reviews.llvm.org/D29399
More information about the llvm-commits
mailing list