From d6bd98d01c3db23f9a66b1f1b2d3e65eef65382e Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Thu, 27 Jun 2013 20:40:11 +0000 Subject: Revert "[APFloat] Removed APFloat constructor which initialized to either zero/NaN but allowed you to arbitrarily set the category of the float." This reverts commit r185095. This is causing a FileCheck failure on the 3dnow intrinsics on at least the mips/ppc bots but not on the x86 bots. Reverting while I figure out what is going on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185099 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/APFloat.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'lib/Support/APFloat.cpp') diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index a7ff9f68cf..2eaf2b56bd 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -795,6 +795,17 @@ APFloat::APFloat(const fltSemantics &ourSemantics, uninitializedTag tag) { initialize(&ourSemantics); } +APFloat::APFloat(const fltSemantics &ourSemantics, + fltCategory ourCategory, bool negative) { + initialize(&ourSemantics); + category = ourCategory; + sign = negative; + if (isFiniteNonZero()) + category = fcZero; + else if (ourCategory == fcNaN) + makeNaN(); +} + APFloat::APFloat(const fltSemantics &ourSemantics, StringRef text) { initialize(&ourSemantics); convertFromString(text, rmNearestTiesToEven); @@ -2395,8 +2406,8 @@ APFloat::roundSignificandWithExponent(const integerPart *decSigParts, excessPrecision = calcSemantics.precision - semantics->precision; truncatedBits = excessPrecision; - APFloat decSig = APFloat::getZero(calcSemantics, sign); - APFloat pow5(calcSemantics); + APFloat decSig(calcSemantics, fcZero, sign); + APFloat pow5(calcSemantics, fcZero, false); sigStatus = decSig.convertFromUnsignedParts(decSigParts, sigPartCount, rmNearestTiesToEven); @@ -3377,16 +3388,15 @@ APFloat APFloat::getSmallest(const fltSemantics &Sem, bool Negative) { } APFloat APFloat::getSmallestNormalized(const fltSemantics &Sem, bool Negative) { - APFloat Val(Sem, uninitialized); + APFloat Val(Sem, fcNormal, Negative); // We want (in interchange format): // sign = {Negative} // exponent = 0..0 // significand = 10..0 - Val.zeroSignificand(); - Val.sign = Negative; Val.exponent = Sem.minExponent; + Val.zeroSignificand(); Val.significandParts()[partCountForBits(Sem.precision)-1] |= (((integerPart) 1) << ((Sem.precision - 1) % integerPartWidth)); -- cgit v1.2.3