[PATCH] D17181: [X86] Don't turn (c?-v:v) into (c?-v:0) by blindly using PSIGN.

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 13:02:56 PST 2016


spatel added a comment.

(c ? -v : v)

I think that we can improve the SSE2 (no psign) codegen and have the SSSE3 solution avoid psign completely by using a variant of:
https://graphics.stanford.edu/~seander/bithacks.html#ConditionalNegate

>From what I can tell, the SSE2 savings are one integer logic op + a move. The SSSE3 case would have 3 simple integer logic ops rather than load/or/psign. I don't think it's worth chasing. Side note: it's been 10 years since SSSE3 (Merom) came out...can we change the default x86 subtarget now from Yonah/SSE2?


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26334
@@ -26333,2 +26333,3 @@
 
       // Now we know we at least have a plendvb with the mask val.  See if
+      // we can form a psignb/w/d:
----------------
This comment is misleading. We know we have a 'select' kind of operation, but if we don't have SSE4, then we're going to bail out because we don't actually have the x86 blendv .

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26354
@@ +26353,3 @@
+
+        SDValue One = DAG.getConstant(1, DL, MaskVT.getVectorElementType());
+        SDValue Ones = DAG.getNode(
----------------
getConstant() is magic. There are no code comments to tell you this, but it can do the splat for you. :)


http://reviews.llvm.org/D17181





More information about the llvm-commits mailing list