Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-09-18 23:28:33 +00:00
parent 47a7e2681e
commit 6b5578f052

View File

@ -2331,14 +2331,13 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
} }
break; break;
case TargetLowering::Expand: case TargetLowering::Expand:
unsigned DivOpc= (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SREM; unsigned DivOpc= (Node->getOpcode() == ISD::UREM) ? ISD::UDIV : ISD::SDIV;
if (MVT::isInteger(Node->getValueType(0))) { if (MVT::isInteger(Node->getValueType(0))) {
if (TLI.getOperationAction(DivOpc, Node->getValueType(0)) == if (TLI.getOperationAction(DivOpc, Node->getValueType(0)) ==
TargetLowering::Legal) { TargetLowering::Legal) {
// X % Y -> X-X/Y*Y // X % Y -> X-X/Y*Y
MVT::ValueType VT = Node->getValueType(0); MVT::ValueType VT = Node->getValueType(0);
unsigned Opc = Node->getOpcode() == ISD::UREM ? ISD::UDIV : ISD::SDIV; Result = DAG.getNode(DivOpc, VT, Tmp1, Tmp2);
Result = DAG.getNode(Opc, VT, Tmp1, Tmp2);
Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2); Result = DAG.getNode(ISD::MUL, VT, Result, Tmp2);
Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result); Result = DAG.getNode(ISD::SUB, VT, Tmp1, Result);
} else { } else {