mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-02 15:51:54 +00:00
add some simple hacky long double support for the CBE. This
should work for intel long double, but ppc long double aborts in convert. llvm-svn: 57672
This commit is contained in:
parent
1641e5e794
commit
e087da1d39
@ -1129,11 +1129,21 @@ void CWriter::printConstant(Constant *CPV, bool Static) {
|
||||
"long double")
|
||||
<< "*)&FPConstant" << I->second << ')';
|
||||
} else {
|
||||
assert(FPC->getType() == Type::FloatTy ||
|
||||
FPC->getType() == Type::DoubleTy);
|
||||
double V = FPC->getType() == Type::FloatTy ?
|
||||
FPC->getValueAPF().convertToFloat() :
|
||||
FPC->getValueAPF().convertToDouble();
|
||||
double V;
|
||||
if (FPC->getType() == Type::FloatTy)
|
||||
V = FPC->getValueAPF().convertToFloat();
|
||||
else if (FPC->getType() == Type::DoubleTy)
|
||||
V = FPC->getValueAPF().convertToDouble();
|
||||
else {
|
||||
// Long double. Convert the number to double, discarding precision.
|
||||
// This is not awesome, but it at least makes the CBE output somewhat
|
||||
// useful.
|
||||
APFloat Tmp = FPC->getValueAPF();
|
||||
bool LosesInfo;
|
||||
Tmp.convert(APFloat::IEEEdouble, APFloat::rmTowardZero, &LosesInfo);
|
||||
V = Tmp.convertToDouble();
|
||||
}
|
||||
|
||||
if (IsNAN(V)) {
|
||||
// The value is NaN
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user