llvm.org GIT mirror llvm / e5e0194
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 Neil Booth 13 years ago
2 changed file(s) with 16 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
267267 opStatus multiplySpecials(const APFloat &);
268268
269269 /* Miscellany. */
270 void makeNaN(void);
270271 opStatus normalize(roundingMode, lostFraction);
271272 opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract);
272273 cmpResult compareAbsoluteValue(const APFloat &) const;
583583
584584 APInt::tcAssign(significandParts(), rhs.significandParts(),
585585 partCount());
586 }
587
588 /* Make this number a NaN, with an arbitrary but deterministic value
589 for the significand. */
590 void
591 APFloat::makeNaN(void)
592 {
593 category = fcNaN;
594 APInt::tcSet(significandParts(), ~0U, partCount());
586595 }
587596
588597 APFloat &
649658 sign = negative;
650659 if(category == fcNormal)
651660 category = fcZero;
661 else if (ourCategory == fcNaN)
662 makeNaN();
652663 }
653664
654665 APFloat::APFloat(const fltSemantics &ourSemantics, const char *text)
12091220 /* Differently signed infinities can only be validly
12101221 subtracted. */
12111222 if(sign ^ rhs.sign != subtract) {
1212 category = fcNaN;
1213 // Arbitrary but deterministic value for significand
1214 APInt::tcSet(significandParts(), ~0U, partCount());
1223 makeNaN();
12151224 return opInvalidOp;
12161225 }
12171226
13271336
13281337 case convolve(fcZero, fcInfinity):
13291338 case convolve(fcInfinity, fcZero):
1330 category = fcNaN;
1331 // Arbitrary but deterministic value for significand
1332 APInt::tcSet(significandParts(), ~0U, partCount());
1339 makeNaN();
13331340 return opInvalidOp;
13341341
13351342 case convolve(fcNormal, fcNormal):
13711378
13721379 case convolve(fcInfinity, fcInfinity):
13731380 case convolve(fcZero, fcZero):
1374 category = fcNaN;
1375 // Arbitrary but deterministic value for significand
1376 APInt::tcSet(significandParts(), ~0U, partCount());
1381 makeNaN();
13771382 return opInvalidOp;
13781383
13791384 case convolve(fcNormal, fcNormal):
17681773 if(bits > 0) {
17691774 lost_fraction = tmp.shiftSignificandRight(bits);
17701775 } else {
1771 if (-bits >= semantics->precision) {
1776 if ((unsigned) -bits >= semantics->precision) {
17721777 // Unrepresentably large.
17731778 if (!sign && isSigned)
17741779 APInt::tcSetLeastSignificantBits(parts, partsCount, width-1);