[PATCH] D115185: [ARM] Fold away CMP/CSINC from CMOV

Sam Tebbs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 09:02:10 PST 2021


samtebbs added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMISelLowering.cpp:17963-17974
+    if (N->getConstantOperandVal(2) == ARMCC::EQ)
+      return DAG.getNode(N->getOpcode(), SDLoc(N), MVT::i32, N->getOperand(0),
+                         N->getOperand(1),
+                         DAG.getTargetConstant(Cond, SDLoc(N), MVT::i32),
+                         N->getOperand(3), C);
+    if (N->getConstantOperandVal(2) == ARMCC::NE)
+      return DAG.getNode(
----------------
There's a decent amount of duplication here. Would it be neater to do something like:

```
code = -1
if (N->getConstantOperandVal(2) == EQ)
  code = getTargetConstant(...)
else if (N->getConstantOperandVal(2) == NE)
  code = getOppositeCondition(...)

if (code != -1)
  return DAG.getNode(,,,)
```
?


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

https://reviews.llvm.org/D115185



More information about the llvm-commits mailing list