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
This commit is contained in:
Duncan Sands 2008-07-08 10:50:55 +00:00
parent 4a497a2757
commit 28124ac606
2 changed files with 46 additions and 2 deletions

View File

@ -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;

View File

@ -334,6 +334,8 @@ private:
SDOperand SoftenFloatRes_FADD(SDNode *N);
SDOperand SoftenFloatRes_FCOPYSIGN(SDNode *N);
SDOperand SoftenFloatRes_FMUL(SDNode *N);
SDOperand SoftenFloatRes_FP_EXTEND(SDNode *N);
SDOperand SoftenFloatRes_FP_ROUND(SDNode *N);
SDOperand SoftenFloatRes_FSUB(SDNode *N);
SDOperand SoftenFloatRes_LOAD(SDNode *N);
SDOperand SoftenFloatRes_XINT_TO_FP(SDNode *N);