transform fabs/fabsf calls into FABS nodes.

llvm-svn: 21014
This commit is contained in:
Chris Lattner 2005-04-02 05:26:53 +00:00
parent a0c72cf289
commit 0c14000760
1 changed files with 39 additions and 29 deletions

View File

@ -652,8 +652,19 @@ void SelectionDAGLowering::visitStore(StoreInst &I) {
void SelectionDAGLowering::visitCall(CallInst &I) {
const char *RenameFn = 0;
if (Function *F = I.getCalledFunction())
if (F->isExternal())
switch (F->getIntrinsicID()) {
case 0: break; // Not an intrinsic.
case 0: // Not an LLVM intrinsic.
if (F->getName() == "fabs" || F->getName() == "fabsf") {
if (I.getNumOperands() == 2 && // Basic sanity checks.
I.getOperand(1)->getType()->isFloatingPoint() &&
I.getType() == I.getOperand(1)->getType()) {
SDOperand Tmp = getValue(I.getOperand(1));
setValue(&I, DAG.getNode(ISD::FABS, Tmp.getValueType(), Tmp));
return;
}
}
break;
case Intrinsic::vastart: visitVAStart(I); return;
case Intrinsic::vaend: visitVAEnd(I); return;
case Intrinsic::vacopy: visitVACopy(I); return;
@ -679,7 +690,6 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Num));
return;
}
}
SDOperand Callee;