[PATCH] [x86] Begin a significant overhaul of how vector lowering is done in the x86 backend.

Chandler Carruth chandlerc at gmail.com
Wed Jun 25 18:07:18 PDT 2014


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:7005
@@ +7004,3 @@
+  //
+  // [0, 1, 2, 7, 4, 5, 6, 3] -PSHUFD[0,2,1,3]-> [0, 1, 4, 7, 2, 3, 6, 5]
+  //
----------------
Filipe Cabecinhas wrote:
> This seems wrong. How can you have [{0,1}{2,7}{4,5}{6,3}] -> [{0,1}{4,7}{2,3}{6,5}]? How did the {2,7} get mixed with the {4,5}? Wouldn't pshufd just shuffle double words around but not break them?
> 
> Shouldn't it become [{0,1}{4,5}{2,7}{6,3}]?
Yea, this is why examples aren't clear.

The PSHUFD applies to the *input* to this shuffle. The result here is the new mask needed after the pshufd  to produce the same final output.

How can i make this more clear?

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:7401
@@ +7400,3 @@
+  if (NumV1Inputs + NumV2Inputs <= 4)
+    return lowerV8I16BasicBlendVectorShuffle(DL, V1, V2, Mask, Subtarget, DAG);
+
----------------
Filipe Cabecinhas wrote:
> NumV1Inputs == 0 && NumV2Inputs == 4 => assert in lowerV8I16BasicBlendVectorShuffle:7293
> 
> The previous if should have an else if (NumV1Inputs == 0) ...SingleInput...(...V2...)
> 
> If this condition doesn't arise because it's been handled earlier, I'd like to have an assert here.
Correct, we can't hit this because if there is only a single input, it is always V1. Adding assert here.

http://reviews.llvm.org/D4225






More information about the llvm-commits mailing list