diff options
author | Duncan Sands <baldrick@free.fr> | 2008-07-08 10:50:55 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-07-08 10:50:55 +0000 |
commit | 28124ac6066795e69046371936f73faa09f15aba (patch) | |
tree | 19d27eed4d563255600b0a76afe1f63edb336838 /lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | |
parent | 4a497a2757487bd127b21c179f68173f976eb153 (diff) |
LegalizeTypes support for FP_ROUND and FP_EXTEND
soft float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index 4b0d572cd0..f8340ccc1f 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -66,7 +66,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) { cerr << "SoftenFloatResult #" << ResNo << ": "; N->dump(&DAG); cerr << "\n"; #endif - assert(0 && "Do not know how to convert the result of this operator!"); + assert(0 && "Do not know how to soften the result of this operator!"); abort(); case ISD::BIT_CONVERT: R = SoftenFloatRes_BIT_CONVERT(N); break; @@ -75,6 +75,8 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) { R = SoftenFloatRes_ConstantFP(cast<ConstantFPSDNode>(N)); break; case ISD::FCOPYSIGN: R = SoftenFloatRes_FCOPYSIGN(N); break; + case ISD::FP_EXTEND: R = SoftenFloatRes_FP_EXTEND(N); break; + case ISD::FP_ROUND: R = SoftenFloatRes_FP_ROUND(N); break; case ISD::LOAD: R = SoftenFloatRes_LOAD(N); break; case ISD::SINT_TO_FP: case ISD::UINT_TO_FP: R = SoftenFloatRes_XINT_TO_FP(N); break; @@ -169,6 +171,46 @@ SDOperand DAGTypeLegalizer::SoftenFloatRes_FMUL(SDNode *N) { NVT, Ops, 2, false); } +SDOperand DAGTypeLegalizer::SoftenFloatRes_FP_EXTEND(SDNode *N) { + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + SDOperand Op = N->getOperand(0); + + RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; + switch (Op.getValueType().getSimpleVT()) { + default: + assert(false && "Unsupported FP_EXTEND!"); + case MVT::f32: + switch (N->getValueType(0).getSimpleVT()) { + default: + assert(false && "Unsupported FP_EXTEND!"); + case MVT::f64: + LC = RTLIB::FPEXT_F32_F64; + } + } + + return MakeLibCall(LC, NVT, &Op, 1, false); +} + +SDOperand DAGTypeLegalizer::SoftenFloatRes_FP_ROUND(SDNode *N) { + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + SDOperand Op = N->getOperand(0); + + RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; + switch (Op.getValueType().getSimpleVT()) { + default: + assert(false && "Unsupported FP_ROUND!"); + case MVT::f64: + switch (N->getValueType(0).getSimpleVT()) { + default: + assert(false && "Unsupported FP_ROUND!"); + case MVT::f32: + LC = RTLIB::FPROUND_F64_F32; + } + } + + return MakeLibCall(LC, NVT, &Op, 1, false); +} + SDOperand DAGTypeLegalizer::SoftenFloatRes_FSUB(SDNode *N) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDOperand Ops[2] = { GetSoftenedFloat(N->getOperand(0)), @@ -323,7 +365,7 @@ bool DAGTypeLegalizer::SoftenFloatOperand(SDNode *N, unsigned OpNo) { cerr << "SoftenFloatOperand Op #" << OpNo << ": "; N->dump(&DAG); cerr << "\n"; #endif - assert(0 && "Do not know how to convert this operator's operand!"); + assert(0 && "Do not know how to soften this operator's operand!"); abort(); case ISD::BIT_CONVERT: Res = SoftenFloatOp_BIT_CONVERT(N); break; |