[PATCH] D28354: [X86][MCU] replace select with bit manipulation instead of branches

Igor Breger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 07:37:01 PST 2017


igorb added inline comments.


================
Comment at: ../tunkClang/lib/Target/X86/X86ISelLowering.cpp:16846
 
+static SDValue getSelectMask(SDValue Cmp, SelectionDAG &DAG, MVT DestVT) {
+  SDLoc DL(Cmp);
----------------
Could you please add comments.
I think the function name is misleading.



================
Comment at: ../tunkClang/lib/Target/X86/X86ISelLowering.cpp:16992
   // (select (x != 0), -1, y) -> ~(sign_bit (x - 1)) | y
+  // (select (and (x & 0x1) == 0), (z ^ y) , y ) -> (-(and (x & 0x1)) & z ) ^ y
+  // (select (and (x & 0x1) == 0), (z | y) , y ) -> (-(and (x & 0x1)) & z ) | y
----------------
what do you mean  "(and (x & 0x1)" ?


================
Comment at: ../tunkClang/lib/Target/X86/X86ISelLowering.cpp:17043
+      SDValue Src1, Src2;
+      if (isOrXorPattern(Op2, Op1, Src1, Src2, OpCode) ||
+          isOrXorPattern(Op1, Op2, Src1, Src2, OpCode)) {
----------------
Could you implement isOrXorPattern as lambda function?


Repository:
  rL LLVM

https://reviews.llvm.org/D28354





More information about the llvm-commits mailing list