[PATCH] [DAGCombiner] Combine shuffles of BUILD_VECTOR and SCALAR_TO_VECTOR
Andrea Di Biagio
Andrea_DiBiagio at sn.scee.net
Wed Apr 1 10:03:57 PDT 2015
REPOSITORY
rL LLVM
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12033-12035
@@ +12032,5 @@
+ if (Ops.size() == VT.getVectorNumElements()) {
+ // Create SCALAR_TO_VECTOR if the only defined input is input[0].
+ if (1 == NumDefElts && Ops[0].getOpcode() != ISD::UNDEF)
+ return DAG.getNode(ISD::SCALAR_TO_VECTOR, SDLoc(N), VT, Ops[0]);
+
----------------
On x86, a build_vector with all operands undef excluding the first operand is legalized to a scalar_to_vector. I am not sure if other targets would do the same; in case, I would suggest to remove this code and just emit a build_vector.
Do you have an example that relies on this check? A shuffles with only one non-undef element should have been canonicalized/simplified to a shuffle where one of the operands is undef.
================
Comment at: test/CodeGen/X86/mmx-bitcast.ll:78
@@ +77,3 @@
+; CHECK-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
+; CHECK-NEXT: movd %xmm1, %rax
+; CHECK-NEXT: retq
----------------
I don't think this is related to your patch. However, this looks like a bug to me. Shouldn't this be a 'movq'?
================
Comment at: test/CodeGen/X86/sse41.ll:1028-1029
@@ -1027,4 @@
-
-; Edge case for insertps where we end up with a shuffle with mask=<0, 7, -1, -1>
-define void @insertps_pr20411(i32* noalias nocapture %RET) #1 {
-; X32-LABEL: insertps_pr20411:
----------------
My question is: do we have an equivalent test for insertps somewhere else? If so, then I think it is OK to remove it. Otherwise I would keep it.
================
Comment at: test/CodeGen/X86/vector-shuffle-128-v16.ll:646
@@ +645,3 @@
+; AVX-NEXT: movzbl %dil, %eax
+; AVX-NEXT: movd %eax, %xmm0
+; AVX-NEXT: retq
----------------
Shouldn't this be 'vmovd'?
http://reviews.llvm.org/D8516
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list