diff options
author | Duncan Sands <baldrick@free.fr> | 2008-07-18 21:18:48 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-07-18 21:18:48 +0000 |
commit | c3e26727c18e15b64098fc7f397e09147cd78eeb (patch) | |
tree | e1b7cfe3cd860edf898cd1fbbc17a03711a41487 | |
parent | f8ac645c59094b1165af6a06af3cc63af96a1dd9 (diff) | |
download | external_llvm-c3e26727c18e15b64098fc7f397e09147cd78eeb.zip external_llvm-c3e26727c18e15b64098fc7f397e09147cd78eeb.tar.gz external_llvm-c3e26727c18e15b64098fc7f397e09147cd78eeb.tar.bz2 |
Softfloat support for FDIV. Patch by
Richard Pennington.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53773 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | 13 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypes.h | 1 | ||||
-rw-r--r-- | test/CodeGen/ARM/2008-07-17-Fdiv.ll | 6 |
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index 888cec0..e50ff1c 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -61,6 +61,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) { break; case ISD::FADD: R = SoftenFloatRes_FADD(N); break; case ISD::FCOPYSIGN: R = SoftenFloatRes_FCOPYSIGN(N); break; + case ISD::FDIV: R = SoftenFloatRes_FDIV(N); break; case ISD::FMUL: R = SoftenFloatRes_FMUL(N); break; case ISD::FP_EXTEND: R = SoftenFloatRes_FP_EXTEND(N); break; case ISD::FP_ROUND: R = SoftenFloatRes_FP_ROUND(N); break; @@ -146,6 +147,18 @@ SDOperand DAGTypeLegalizer::SoftenFloatRes_FCOPYSIGN(SDNode *N) { return DAG.getNode(ISD::OR, LVT, LHS, SignBit); } +SDOperand DAGTypeLegalizer::SoftenFloatRes_FDIV(SDNode *N) { + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + SDOperand Ops[2] = { GetSoftenedFloat(N->getOperand(0)), + GetSoftenedFloat(N->getOperand(1)) }; + return MakeLibCall(GetFPLibCall(N->getValueType(0), + RTLIB::DIV_F32, + RTLIB::DIV_F64, + RTLIB::DIV_F80, + RTLIB::DIV_PPCF128), + NVT, Ops, 2, false); +} + SDOperand DAGTypeLegalizer::SoftenFloatRes_FMUL(SDNode *N) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDOperand Ops[2] = { GetSoftenedFloat(N->getOperand(0)), diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h index f6a5c69..8122459 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -336,6 +336,7 @@ private: SDOperand SoftenFloatRes_ConstantFP(ConstantFPSDNode *N); SDOperand SoftenFloatRes_FADD(SDNode *N); SDOperand SoftenFloatRes_FCOPYSIGN(SDNode *N); + SDOperand SoftenFloatRes_FDIV(SDNode *N); SDOperand SoftenFloatRes_FMUL(SDNode *N); SDOperand SoftenFloatRes_FP_EXTEND(SDNode *N); SDOperand SoftenFloatRes_FP_ROUND(SDNode *N); diff --git a/test/CodeGen/ARM/2008-07-17-Fdiv.ll b/test/CodeGen/ARM/2008-07-17-Fdiv.ll new file mode 100644 index 0000000..aa75970 --- /dev/null +++ b/test/CodeGen/ARM/2008-07-17-Fdiv.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=arm + +define float @f(float %a, float %b) nounwind { + %tmp = fdiv float %a, %b + ret float %tmp +} |