[PATCH] [DAGCombine] Don't generate atrocious shuffles for constant vectors
Sanjay Patel
spatel at rotateright.com
Wed Jan 21 08:45:33 PST 2015
Hi Michael -
This is almost exactly what I had in mind (and probably Simon did too as he was looking at this sort of problem as well).
But shortly after filing the bug, I realized that we also need to handle non-const splats better too. Eg, this is a simplification of what I'm seeing in loops where the induction variable is splatted in order to vectorize the loop:
define <4 x i64> @splat(i64 %x) {
%scalar_to_vector = insertelement <4 x i64> undef, i64 %x, i32 0
%splat = shufflevector <4 x i64> %scalar_to_vector, <4 x i64> undef, <4 x i32> zeroinitializer
ret <4 x i64> %splat
}
Can you loosen the splat check to handle more than just constants? The particular case above seems ok with AVX2 (vbroadcastsd is generated), but AVX1 still shows:
vmovq %rdi, %xmm0
vunpcklpd %xmm0, %xmm0, %xmm0 ## xmm0 = xmm0[0,0]
vinsertf128 $1, %xmm0, %ymm0, %ymm0
http://reviews.llvm.org/D7093
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list