mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 21:38:19 +00:00
Consolidate logic for creating NaNs. Silence compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42966 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -268,6 +268,7 @@ namespace llvm {
|
|||||||
opStatus multiplySpecials(const APFloat &);
|
opStatus multiplySpecials(const APFloat &);
|
||||||
|
|
||||||
/* Miscellany. */
|
/* Miscellany. */
|
||||||
|
void makeNaN(void);
|
||||||
opStatus normalize(roundingMode, lostFraction);
|
opStatus normalize(roundingMode, lostFraction);
|
||||||
opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract);
|
opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract);
|
||||||
cmpResult compareAbsoluteValue(const APFloat &) const;
|
cmpResult compareAbsoluteValue(const APFloat &) const;
|
||||||
|
@ -586,6 +586,15 @@ APFloat::copySignificand(const APFloat &rhs)
|
|||||||
partCount());
|
partCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make this number a NaN, with an arbitrary but deterministic value
|
||||||
|
for the significand. */
|
||||||
|
void
|
||||||
|
APFloat::makeNaN(void)
|
||||||
|
{
|
||||||
|
category = fcNaN;
|
||||||
|
APInt::tcSet(significandParts(), ~0U, partCount());
|
||||||
|
}
|
||||||
|
|
||||||
APFloat &
|
APFloat &
|
||||||
APFloat::operator=(const APFloat &rhs)
|
APFloat::operator=(const APFloat &rhs)
|
||||||
{
|
{
|
||||||
@ -650,6 +659,8 @@ APFloat::APFloat(const fltSemantics &ourSemantics,
|
|||||||
sign = negative;
|
sign = negative;
|
||||||
if(category == fcNormal)
|
if(category == fcNormal)
|
||||||
category = fcZero;
|
category = fcZero;
|
||||||
|
else if (ourCategory == fcNaN)
|
||||||
|
makeNaN();
|
||||||
}
|
}
|
||||||
|
|
||||||
APFloat::APFloat(const fltSemantics &ourSemantics, const char *text)
|
APFloat::APFloat(const fltSemantics &ourSemantics, const char *text)
|
||||||
@ -1210,9 +1221,7 @@ APFloat::addOrSubtractSpecials(const APFloat &rhs, bool subtract)
|
|||||||
/* Differently signed infinities can only be validly
|
/* Differently signed infinities can only be validly
|
||||||
subtracted. */
|
subtracted. */
|
||||||
if(sign ^ rhs.sign != subtract) {
|
if(sign ^ rhs.sign != subtract) {
|
||||||
category = fcNaN;
|
makeNaN();
|
||||||
// Arbitrary but deterministic value for significand
|
|
||||||
APInt::tcSet(significandParts(), ~0U, partCount());
|
|
||||||
return opInvalidOp;
|
return opInvalidOp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1328,9 +1337,7 @@ APFloat::multiplySpecials(const APFloat &rhs)
|
|||||||
|
|
||||||
case convolve(fcZero, fcInfinity):
|
case convolve(fcZero, fcInfinity):
|
||||||
case convolve(fcInfinity, fcZero):
|
case convolve(fcInfinity, fcZero):
|
||||||
category = fcNaN;
|
makeNaN();
|
||||||
// Arbitrary but deterministic value for significand
|
|
||||||
APInt::tcSet(significandParts(), ~0U, partCount());
|
|
||||||
return opInvalidOp;
|
return opInvalidOp;
|
||||||
|
|
||||||
case convolve(fcNormal, fcNormal):
|
case convolve(fcNormal, fcNormal):
|
||||||
@ -1372,9 +1379,7 @@ APFloat::divideSpecials(const APFloat &rhs)
|
|||||||
|
|
||||||
case convolve(fcInfinity, fcInfinity):
|
case convolve(fcInfinity, fcInfinity):
|
||||||
case convolve(fcZero, fcZero):
|
case convolve(fcZero, fcZero):
|
||||||
category = fcNaN;
|
makeNaN();
|
||||||
// Arbitrary but deterministic value for significand
|
|
||||||
APInt::tcSet(significandParts(), ~0U, partCount());
|
|
||||||
return opInvalidOp;
|
return opInvalidOp;
|
||||||
|
|
||||||
case convolve(fcNormal, fcNormal):
|
case convolve(fcNormal, fcNormal):
|
||||||
@ -1769,7 +1774,7 @@ APFloat::convertToInteger(integerPart *parts, unsigned int width,
|
|||||||
if(bits > 0) {
|
if(bits > 0) {
|
||||||
lost_fraction = tmp.shiftSignificandRight(bits);
|
lost_fraction = tmp.shiftSignificandRight(bits);
|
||||||
} else {
|
} else {
|
||||||
if (-bits >= semantics->precision) {
|
if ((unsigned) -bits >= semantics->precision) {
|
||||||
// Unrepresentably large.
|
// Unrepresentably large.
|
||||||
if (!sign && isSigned)
|
if (!sign && isSigned)
|
||||||
APInt::tcSetLeastSignificantBits(parts, partsCount, width-1);
|
APInt::tcSetLeastSignificantBits(parts, partsCount, width-1);
|
||||||
|
Reference in New Issue
Block a user