[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Apr 1 21:27:10 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.38 -> 1.39
---
Log message:
transform fabs/fabsf calls into FABS nodes.
---
Diffs of the changes: (+39 -29)
SelectionDAGISel.cpp | 68 +++++++++++++++++++++++++++++----------------------
1 files changed, 39 insertions(+), 29 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.38 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.39
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.38 Fri Apr 1 23:04:50 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Apr 1 23:26:53 2005
@@ -652,35 +652,45 @@
void SelectionDAGLowering::visitCall(CallInst &I) {
const char *RenameFn = 0;
if (Function *F = I.getCalledFunction())
- switch (F->getIntrinsicID()) {
- case 0: break; // Not an intrinsic.
- case Intrinsic::vastart: visitVAStart(I); return;
- case Intrinsic::vaend: visitVAEnd(I); return;
- case Intrinsic::vacopy: visitVACopy(I); return;
- case Intrinsic::returnaddress: visitFrameReturnAddress(I, false); return;
- case Intrinsic::frameaddress: visitFrameReturnAddress(I, true); return;
- default:
- // FIXME: IMPLEMENT THESE.
- // readport, writeport, readio, writeio
- assert(0 && "This intrinsic is not implemented yet!");
- return;
- case Intrinsic::setjmp: RenameFn = "setjmp"; break;
- case Intrinsic::longjmp: RenameFn = "longjmp"; break;
- case Intrinsic::memcpy: visitMemIntrinsic(I, ISD::MEMCPY); return;
- case Intrinsic::memset: visitMemIntrinsic(I, ISD::MEMSET); return;
- case Intrinsic::memmove: visitMemIntrinsic(I, ISD::MEMMOVE); return;
-
- case Intrinsic::isunordered:
- setValue(&I, DAG.getSetCC(ISD::SETUO, MVT::i1, getValue(I.getOperand(1)),
- getValue(I.getOperand(2))));
- return;
- case Intrinsic::pcmarker: {
- SDOperand Num = getValue(I.getOperand(1));
- DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Num));
- return;
- }
-
- }
+ if (F->isExternal())
+ switch (F->getIntrinsicID()) {
+ 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;
+ case Intrinsic::returnaddress: visitFrameReturnAddress(I, false); return;
+ case Intrinsic::frameaddress: visitFrameReturnAddress(I, true); return;
+ default:
+ // FIXME: IMPLEMENT THESE.
+ // readport, writeport, readio, writeio
+ assert(0 && "This intrinsic is not implemented yet!");
+ return;
+ case Intrinsic::setjmp: RenameFn = "setjmp"; break;
+ case Intrinsic::longjmp: RenameFn = "longjmp"; break;
+ case Intrinsic::memcpy: visitMemIntrinsic(I, ISD::MEMCPY); return;
+ case Intrinsic::memset: visitMemIntrinsic(I, ISD::MEMSET); return;
+ case Intrinsic::memmove: visitMemIntrinsic(I, ISD::MEMMOVE); return;
+
+ case Intrinsic::isunordered:
+ setValue(&I, DAG.getSetCC(ISD::SETUO, MVT::i1,getValue(I.getOperand(1)),
+ getValue(I.getOperand(2))));
+ return;
+ case Intrinsic::pcmarker: {
+ SDOperand Num = getValue(I.getOperand(1));
+ DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Num));
+ return;
+ }
+ }
SDOperand Callee;
if (!RenameFn)
More information about the llvm-commits
mailing list