Skip to content

Commit 383cbed

Browse files
committed
Add getBoolExtOrTrunc and and
1 parent 42547c8 commit 383cbed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10872,7 +10872,8 @@ SDValue TargetLowering::expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const {
1087210872
SDValue Zero = DAG.getConstant(0, dl, VT);
1087310873
EVT BoolVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
1087410874
SDValue IsNonZero = DAG.getSetCC(dl, BoolVT, LHS, Zero, ISD::SETNE);
10875-
SDValue Subtrahend = DAG.getZExtOrTrunc(IsNonZero, dl, VT);
10875+
SDValue Subtrahend = DAG.getBoolExtOrTrunc(IsNonZero, dl, VT, BoolVT);
10876+
Subtrahend = DAG.getNode(ISD::AND, dl, VT, Subtrahend, DAG.getConstant(1, dl, VT));
1087610877
return DAG.getNode(ISD::SUB, dl, VT, LHS, Subtrahend);
1087710878
}
1087810879

0 commit comments

Comments
 (0)