This folds a negation through a csel, which can come up during the lowering of negative abs.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks like a useful optimisation @dmgreen! I left a few minor comments ...
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14993 | Is it worth having a simple helper function like isNegate for all these cases. Perhaps one already exists? | |
15003 | Does this work when both inputs are negated and do we have a test for that? | |
15009 | I understand you're reusing the opcode and operands here, but it took me a while to realise that! Is it worth just writing out what we're doing here fully for clarity, i.e. something a bit like SDValue Zero = N->getOperand(0); SDValue N0N = DAG.getNode(ISD::SUB, DL, VT, Zero, N0); SDValue N1N = DAG.getNode(ISD::SUB, DL, VT, Zero, N1); |
Whoops, that was the wrong differential revision. It should have been https://reviews.llvm.org/D118595
Is it worth having a simple helper function like isNegate for all these cases. Perhaps one already exists?