[PATCH] D134881: [RISCV] Branchless lowering for select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) )

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 08:17:00 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9035
+    // (select (and (x , 0x1) == 0), y, (z | y) ) -> (-(and (x , 0x1)) & z ) | y
+    if (isNullConstant(RHS) && (CCVal == ISD::SETEQ || CCVal == ISD::SETNE) &&
+        LHS.getOpcode() == ISD::AND && isOneConstant(LHS.getOperand(1))) {
----------------
Use `ISD::isIntEqualitySetCC(CCVal)`?


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9067
+        SDValue Neg;
+        unsigned int CmpSz = LHS.getSimpleValueType().getSizeInBits();
+        // we need mask of all zeros or ones with same size of the other
----------------
`unsigned int` -> `unsigned`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134881/new/

https://reviews.llvm.org/D134881



More information about the llvm-commits mailing list