1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Add two missing SINT_TO_FP libcalls.

llvm-svn: 53460
This commit is contained in:
Duncan Sands 2008-07-11 16:57:02 +00:00
parent 52f1dbf139
commit 58130a26f4
3 changed files with 23 additions and 11 deletions

View File

@ -125,6 +125,8 @@ namespace RTLIB {
FPTOUINT_PPCF128_I128,
SINTTOFP_I32_F32,
SINTTOFP_I32_F64,
SINTTOFP_I32_F80,
SINTTOFP_I32_PPCF128,
SINTTOFP_I64_F32,
SINTTOFP_I64_F64,
SINTTOFP_I64_F80,

View File

@ -1771,11 +1771,12 @@ SDOperand DAGTypeLegalizer::ExpandIntOp_TRUNCATE(SDNode *N) {
}
SDOperand DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(SDOperand Source,
MVT DestTy) {
MVT DestTy) {
// We know the destination is legal, but that the input needs to be expanded.
MVT SourceVT = Source.getValueType();
// Check to see if the target has a custom way to lower this. If so, use it.
// This can trigger when called from ExpandIntOp_UINT_TO_FP.
switch (TLI.getOperationAction(ISD::SINT_TO_FP, SourceVT)) {
default: assert(0 && "This action not implemented for this operation!");
case TargetLowering::Legal:
@ -1789,13 +1790,24 @@ SDOperand DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(SDOperand Source,
}
RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
if (SourceVT == MVT::i64) {
if (SourceVT == MVT::i32) {
if (DestTy == MVT::f32)
LC = RTLIB::SINTTOFP_I32_F32;
else if (DestTy == MVT::f64)
LC = RTLIB::SINTTOFP_I32_F64;
else if (DestTy == MVT::f80)
LC = RTLIB::SINTTOFP_I32_F80;
else if (DestTy == MVT::ppcf128)
LC = RTLIB::SINTTOFP_I32_PPCF128;
} else if (SourceVT == MVT::i64) {
if (DestTy == MVT::f32)
LC = RTLIB::SINTTOFP_I64_F32;
else {
assert(DestTy == MVT::f64 && "Unknown fp value type!");
else if (DestTy == MVT::f64)
LC = RTLIB::SINTTOFP_I64_F64;
}
else if (DestTy == MVT::f80)
LC = RTLIB::SINTTOFP_I64_F80;
else if (DestTy == MVT::ppcf128)
LC = RTLIB::SINTTOFP_I64_PPCF128;
} else if (SourceVT == MVT::i128) {
if (DestTy == MVT::f32)
LC = RTLIB::SINTTOFP_I128_F32;
@ -1803,16 +1815,12 @@ SDOperand DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(SDOperand Source,
LC = RTLIB::SINTTOFP_I128_F64;
else if (DestTy == MVT::f80)
LC = RTLIB::SINTTOFP_I128_F80;
else {
assert(DestTy == MVT::ppcf128 && "Unknown fp value type!");
else if (DestTy == MVT::ppcf128)
LC = RTLIB::SINTTOFP_I128_PPCF128;
}
} else {
assert(0 && "Unknown int value type!");
}
assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Don't know how to expand this SINT_TO_FP!");
return MakeLibCall(LC, DestTy, &Source, 1, true);
}

View File

@ -123,6 +123,8 @@ static void InitLibcallNames(const char **Names) {
Names[RTLIB::FPTOUINT_PPCF128_I128] = "__fixunstfti";
Names[RTLIB::SINTTOFP_I32_F32] = "__floatsisf";
Names[RTLIB::SINTTOFP_I32_F64] = "__floatsidf";
Names[RTLIB::SINTTOFP_I32_F80] = "__floatsixf";
Names[RTLIB::SINTTOFP_I32_PPCF128] = "__floatsitf";
Names[RTLIB::SINTTOFP_I64_F32] = "__floatdisf";
Names[RTLIB::SINTTOFP_I64_F64] = "__floatdidf";
Names[RTLIB::SINTTOFP_I64_F80] = "__floatdixf";