[PATCH] D47927: [RISCV] Custom lower ISD::{U,S}{ADD,SUB}O nodes

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 18:46:23 PDT 2018


efriedma added a comment.

It would probably make sense to change SelectionDAGLegalize::ExpandNode to use this lowering for SADDO/SSUBO, instead of making this target-specific.   The target-independent version uses approximately the same operations anyway, just in a less efficient way.

The lowering for UADDO/USUBO appears to be essentially identical to the lowering in SelectionDAGLegalize::ExpandNode, so there isn't really any point.



================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:553
+                     ISD::SETLT),        // 0 < RHS
+        DAG.getConstant(1, DL, XLenVT)); // 0 >= RHS
+    // The sub should be less than one of the operands (LHS) if and only if the
----------------
The XOR here is a bit weird; could you just use SETGE instead?


https://reviews.llvm.org/D47927





More information about the llvm-commits mailing list