diff options
author | Dale Johannesen <dalej@apple.com> | 2008-09-05 18:38:42 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-09-05 18:38:42 +0000 |
commit | 520143e563f75245eef230afee63f2bc2d868165 (patch) | |
tree | 7aa4a07328a6387ed7177b13a32f3a96abff81a6 /llvm/lib/CodeGen | |
parent | 7d7a26df656f8114051769d89083da3200a159a1 (diff) | |
download | bcm5719-llvm-520143e563f75245eef230afee63f2bc2d868165.tar.gz bcm5719-llvm-520143e563f75245eef230afee63f2bc2d868165.zip |
Add hooks for other intrinsics to get low-precision expansions.
llvm-svn: 55845
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 68 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h | 4 |
2 files changed, 60 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index e7838e4b5c0..c7e2cd5caba 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -2753,6 +2753,58 @@ SelectionDAGLowering::implVisitBinaryAtomic(CallInst& I, ISD::NodeType Op) { return 0; } +/// visitExp - lower an exp intrinsic. Handles the special sequences +/// for limited-precision mode. + +void +SelectionDAGLowering::visitExp(CallInst &I) { + SDValue result; + // No special expansion. + result = DAG.getNode(ISD::FEXP, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, result); +} + +/// visitLog - lower a log intrinsic. Handles the special sequences +/// for limited-precision mode. + +void +SelectionDAGLowering::visitLog(CallInst &I) { + SDValue result; + // No special expansion. + result = DAG.getNode(ISD::FLOG, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, result); +} + +/// visitLog2 - lower a log2 intrinsic. Handles the special sequences +/// for limited-precision mode. + +void +SelectionDAGLowering::visitLog2(CallInst &I) { + SDValue result; + // No special expansion. + result = DAG.getNode(ISD::FLOG2, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, result); +} + +/// visitLog10 - lower a log10 intrinsic. Handles the special sequences +/// for limited-precision mode. + +void +SelectionDAGLowering::visitLog10(CallInst &I) { + SDValue result; + // No special expansion. + result = DAG.getNode(ISD::FLOG10, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, result); +} + /// visitExp2 - lower an exp2 intrinsic. Handles the special sequences /// for limited-precision mode. @@ -3071,24 +3123,16 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { getValue(I.getOperand(1)))); return 0; case Intrinsic::log: - setValue(&I, DAG.getNode(ISD::FLOG, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + visitLog(I); return 0; case Intrinsic::log2: - setValue(&I, DAG.getNode(ISD::FLOG2, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + visitLog2(I); return 0; case Intrinsic::log10: - setValue(&I, DAG.getNode(ISD::FLOG10, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + visitLog10(I); return 0; case Intrinsic::exp: - setValue(&I, DAG.getNode(ISD::FEXP, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + visitExp(I); return 0; case Intrinsic::exp2: visitExp2(I); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h index 8e7d86329be..72c1bf344b2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h @@ -506,6 +506,10 @@ private: void visitTargetIntrinsic(CallInst &I, unsigned Intrinsic); void visitExp2(CallInst &I); + void visitExp(CallInst &I); + void visitLog(CallInst &I); + void visitLog2(CallInst &I); + void visitLog10(CallInst &I); void visitVAStart(CallInst &I); void visitVAArg(VAArgInst &I); |