[PATCH] D137949: [RISCV] Branchless lowering for (select (x < 0), TrueConstant, FalseConstant) and (select (x >= 0), TrueConstant, FalseConstant)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 23:51:13 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9637
+      int64_t FalseSImm = cast<ConstantSDNode>(FalseV)->getSExtValue();
+      // Only handle simm12, if it is not in this range, it can be considered as
+      // register.
----------------
Can you share most of the code by adding

```
if (CCVal == ISD::CondCode::SETGE)
  std::swap(TrueImm, FalseImm)
```

And another std::swap for TrueV and FalseV if the match succeeds?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137949



More information about the llvm-commits mailing list