mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
Fix both the test for zero and what we do if we have a zero for
umulo legalization. Fixes PR13839 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163856 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2265,12 +2265,15 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
|
||||
// A divide for UMULO will be faster than a function call. Select to
|
||||
// make sure we aren't using 0.
|
||||
SDValue isZero = DAG.getSetCC(dl, TLI.getSetCCResultType(VT),
|
||||
RHS, DAG.getConstant(0, VT), ISD::SETNE);
|
||||
RHS, DAG.getConstant(0, VT), ISD::SETEQ);
|
||||
SDValue NotZero = DAG.getNode(ISD::SELECT, dl, VT, isZero,
|
||||
DAG.getConstant(1, VT), RHS);
|
||||
SDValue DIV = DAG.getNode(ISD::UDIV, dl, VT, MUL, NotZero);
|
||||
SDValue Overflow = DAG.getSetCC(dl, N->getValueType(1), DIV, LHS,
|
||||
ISD::SETNE);
|
||||
Overflow = DAG.getNode(ISD::SELECT, dl, N->getValueType(1), isZero,
|
||||
DAG.getConstant(0, N->getValueType(1)),
|
||||
Overflow);
|
||||
ReplaceValueWith(SDValue(N, 1), Overflow);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user