mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b2a1432507
commit
abec474236
@ -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…
Reference in New Issue
Block a user