[llvm] [SelectionDAG] Lowering usub.sat(a, 1) to a - (a != 0) (PR #170076)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 17:27:14 PST 2025
================
@@ -10867,6 +10867,16 @@ SDValue TargetLowering::expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const {
assert(VT == RHS.getValueType() && "Expected operands to be the same type");
assert(VT.isInteger() && "Expected operands to be integers");
+ // usub.sat(a, 1) -> sub(a, zext(a != 0))
+ if (Opcode == ISD::USUBSAT && isOneConstant(RHS)) {
----------------
topperc wrote:
isOneConstant only returns true for scalar. So this still doesn't support vector.
https://github.com/llvm/llvm-project/pull/170076
More information about the llvm-commits
mailing list