[PATCH] D18850: [X86]: Fix for PR27251

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 17:41:24 PDT 2016


ab added inline comments.

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:27268-27269
@@ +27267,4 @@
+
+      // If the negate was on the false side of the select, then
+      // the operands of the SUB need to be swapped. PR 27251.
+      if (V == Y) {
----------------
Could you perhaps elaborate on the logic here a bit?

IIUC, we used to do:
    (vselect M, X, (sub 0, X))
    ->
    (sub (xor X, M), M)

But we should do:
    (sub M, (xor X, M))

Which works because
    -1 - ~X == X

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:27271-27272
@@ +27270,4 @@
+      if (V == Y) {
+         SubOp2 = SubOp1;
+         SubOp1 = Mask;
+      }
----------------
How about:

    std::swap(SubOp1, SubOp2)

which lets us get rid of SubOp2



http://reviews.llvm.org/D18850





More information about the llvm-commits mailing list