Factor some common code to reduce compile size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168143 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2012-11-16 07:48:23 +00:00
parent 77d6ae1b01
commit 9bd4dd742e

View File

@ -4949,25 +4949,10 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
setValue(&I, Res); setValue(&I, Res);
return 0; return 0;
} }
case Intrinsic::sqrt:
setValue(&I, DAG.getNode(ISD::FSQRT, dl,
getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::powi: case Intrinsic::powi:
setValue(&I, ExpandPowI(dl, getValue(I.getArgOperand(0)), setValue(&I, ExpandPowI(dl, getValue(I.getArgOperand(0)),
getValue(I.getArgOperand(1)), DAG)); getValue(I.getArgOperand(1)), DAG));
return 0; return 0;
case Intrinsic::sin:
setValue(&I, DAG.getNode(ISD::FSIN, dl,
getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::cos:
setValue(&I, DAG.getNode(ISD::FCOS, dl,
getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::log: case Intrinsic::log:
visitLog(I); visitLog(I);
return 0; return 0;
@ -4986,36 +4971,34 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
case Intrinsic::pow: case Intrinsic::pow:
visitPow(I); visitPow(I);
return 0; return 0;
case Intrinsic::sqrt:
case Intrinsic::fabs: case Intrinsic::fabs:
setValue(&I, DAG.getNode(ISD::FABS, dl, case Intrinsic::sin:
getValue(I.getArgOperand(0)).getValueType(), case Intrinsic::cos:
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::floor: case Intrinsic::floor:
setValue(&I, DAG.getNode(ISD::FFLOOR, dl,
getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::ceil: case Intrinsic::ceil:
setValue(&I, DAG.getNode(ISD::FCEIL, dl,
getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::trunc: case Intrinsic::trunc:
setValue(&I, DAG.getNode(ISD::FTRUNC, dl,
getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0))));
return 0;
case Intrinsic::rint: case Intrinsic::rint:
setValue(&I, DAG.getNode(ISD::FRINT, dl, case Intrinsic::nearbyint: {
getValue(I.getArgOperand(0)).getValueType(), unsigned Opcode;
getValue(I.getArgOperand(0)))); switch (Intrinsic) {
return 0; default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
case Intrinsic::nearbyint: case Intrinsic::sqrt: Opcode = ISD::FSQRT; break;
setValue(&I, DAG.getNode(ISD::FNEARBYINT, dl, case Intrinsic::fabs: Opcode = ISD::FABS; break;
case Intrinsic::sin: Opcode = ISD::FSIN; break;
case Intrinsic::cos: Opcode = ISD::FCOS; break;
case Intrinsic::floor: Opcode = ISD::FFLOOR; break;
case Intrinsic::ceil: Opcode = ISD::FCEIL; break;
case Intrinsic::trunc: Opcode = ISD::FTRUNC; break;
case Intrinsic::rint: Opcode = ISD::FRINT; break;
case Intrinsic::nearbyint: Opcode = ISD::FNEARBYINT; break;
}
setValue(&I, DAG.getNode(Opcode, dl,
getValue(I.getArgOperand(0)).getValueType(), getValue(I.getArgOperand(0)).getValueType(),
getValue(I.getArgOperand(0)))); getValue(I.getArgOperand(0))));
return 0; return 0;
}
case Intrinsic::fma: case Intrinsic::fma:
setValue(&I, DAG.getNode(ISD::FMA, dl, setValue(&I, DAG.getNode(ISD::FMA, dl,
getValue(I.getArgOperand(0)).getValueType(), getValue(I.getArgOperand(0)).getValueType(),