[PATCH] D22889: [X86] Match PSADBW in straight-line code

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 10:16:50 PDT 2016


mkuper added a comment.

Thanks, Simon!

I tried to share as much code as I could, see https://reviews.llvm.org/rL276798 and https://reviews.llvm.org/rL276918 .
I don't see a way to share the "shuffle pyramid" detection code, unfortunately - for the loop case, we are forced to do it in IR, because the pyramid lives in a different basic block.
And the type checks in the beginning didn't look like they were worth it.

If you have suggestions for what I can factor out, let me know, I'll be happy to try.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26461
@@ +26460,3 @@
+    return SDValue();
+
+  // Verify the extract is from index 0.
----------------
RKSimon wrote:
> To support wider types is there any way that you can split the vector, perform PSAD on both and then combine the 2 results?
I think so.
Right now we don't do this for the loop version either (I didn't write that code originally :-) ), and I kept the same constraint here. I'd prefer to leave it as a TODO, in both places.

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26500
@@ +26499,3 @@
+    // Verify the shuffle has the expected (at this stage of the pyramid) mask.
+    int MaskEnd = 1 << i;
+    for (int Index = 0; Index < MaskEnd; ++Index)
----------------
RKSimon wrote:
> Minor, but move this into the for() loop's initializer?
Sure (for both loops)


https://reviews.llvm.org/D22889





More information about the llvm-commits mailing list