[llvm] r289647 - Replace APFloatBase static fltSemantics data members with getter functions
Stephan Bergmann via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 03:57:21 PST 2016
Author: sberg
Date: Wed Dec 14 05:57:17 2016
New Revision: 289647
URL: http://llvm.org/viewvc/llvm-project?rev=289647&view=rev
Log:
Replace APFloatBase static fltSemantics data members with getter functions
At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.
Differential Revision: https://reviews.llvm.org/D26671
Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
llvm/trunk/include/llvm/IR/Type.h
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/lib/AsmParser/LLLexer.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/MachineInstr.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/IR/AsmWriter.cpp
llvm/trunk/lib/IR/ConstantFold.cpp
llvm/trunk/lib/IR/Constants.cpp
llvm/trunk/lib/IR/Core.cpp
llvm/trunk/lib/IR/LLVMContextImpl.h
llvm/trunk/lib/IR/Verifier.cpp
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/lib/Support/APFloat.cpp
llvm/trunk/lib/Support/ScaledNumber.cpp
llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/trunk/lib/Target/ARM/ARMMCInstLower.cpp
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td
llvm/trunk/lib/Target/NVPTX/NVPTXMCExpr.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/trunk/unittests/ADT/APFloatTest.cpp
Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Wed Dec 14 05:57:17 2016
@@ -136,16 +136,16 @@ struct APFloatBase {
/// \name Floating Point Semantics.
/// @{
- static const fltSemantics IEEEhalf;
- static const fltSemantics IEEEsingle;
- static const fltSemantics IEEEdouble;
- static const fltSemantics IEEEquad;
- static const fltSemantics PPCDoubleDouble;
- static const fltSemantics x87DoubleExtended;
+ static const fltSemantics &IEEEhalf();
+ static const fltSemantics &IEEEsingle();
+ static const fltSemantics &IEEEdouble();
+ static const fltSemantics &IEEEquad();
+ static const fltSemantics &PPCDoubleDouble();
+ static const fltSemantics &x87DoubleExtended();
/// A Pseudo fltsemantic used to construct APFloats that cannot conflict with
/// anything real.
- static const fltSemantics Bogus;
+ static const fltSemantics &Bogus();
/// @}
@@ -664,7 +664,7 @@ class APFloat : public APFloatBase {
explicit Storage(IEEEFloat F, const fltSemantics &S);
explicit Storage(DoubleAPFloat F, const fltSemantics &S)
: Double(std::move(F)) {
- assert(&S == &PPCDoubleDouble);
+ assert(&S == &PPCDoubleDouble());
}
template <typename... ArgTypes>
@@ -741,9 +741,9 @@ class APFloat : public APFloatBase {
static_assert(std::is_same<T, IEEEFloat>::value ||
std::is_same<T, DoubleAPFloat>::value, "");
if (std::is_same<T, DoubleAPFloat>::value) {
- return &Semantics == &PPCDoubleDouble;
+ return &Semantics == &PPCDoubleDouble();
}
- return &Semantics != &PPCDoubleDouble;
+ return &Semantics != &PPCDoubleDouble();
}
IEEEFloat &getIEEE() {
@@ -793,7 +793,7 @@ class APFloat : public APFloatBase {
// FIXME: This is due to clang 3.3 (or older version) always checks for the
// default constructor in an array aggregate initialization, even if no
// elements in the array is default initialized.
- APFloat() : U(IEEEdouble) {
+ APFloat() : U(IEEEdouble()) {
llvm_unreachable("This is a workaround for old clang.");
}
@@ -820,8 +820,8 @@ public:
APFloat(const fltSemantics &Semantics, uninitializedTag)
: U(Semantics, uninitialized) {}
APFloat(const fltSemantics &Semantics, const APInt &I) : U(Semantics, I) {}
- explicit APFloat(double d) : U(IEEEFloat(d), IEEEdouble) {}
- explicit APFloat(float f) : U(IEEEFloat(f), IEEEsingle) {}
+ explicit APFloat(double d) : U(IEEEFloat(d), IEEEdouble()) {}
+ explicit APFloat(float f) : U(IEEEFloat(f), IEEEsingle()) {}
APFloat(const APFloat &RHS) = default;
APFloat(APFloat &&RHS) = default;
@@ -1073,7 +1073,7 @@ public:
// This is for internal test only.
// TODO: Remove it after the PPCDoubleDouble transition.
const APFloat &getSecondFloat() const {
- assert(&getSemantics() == &PPCDoubleDouble);
+ assert(&getSemantics() == &PPCDoubleDouble());
return U.Double.getSecond();
}
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Dec 14 05:57:17 2016
@@ -1180,12 +1180,12 @@ public:
static const fltSemantics &EVTToAPFloatSemantics(EVT VT) {
switch (VT.getScalarType().getSimpleVT().SimpleTy) {
default: llvm_unreachable("Unknown FP format");
- case MVT::f16: return APFloat::IEEEhalf;
- case MVT::f32: return APFloat::IEEEsingle;
- case MVT::f64: return APFloat::IEEEdouble;
- case MVT::f80: return APFloat::x87DoubleExtended;
- case MVT::f128: return APFloat::IEEEquad;
- case MVT::ppcf128: return APFloat::PPCDoubleDouble;
+ case MVT::f16: return APFloat::IEEEhalf();
+ case MVT::f32: return APFloat::IEEEsingle();
+ case MVT::f64: return APFloat::IEEEdouble();
+ case MVT::f80: return APFloat::x87DoubleExtended();
+ case MVT::f128: return APFloat::IEEEquad();
+ case MVT::ppcf128: return APFloat::PPCDoubleDouble();
}
}
Modified: llvm/trunk/include/llvm/IR/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Type.h?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Type.h (original)
+++ llvm/trunk/include/llvm/IR/Type.h Wed Dec 14 05:57:17 2016
@@ -166,12 +166,12 @@ public:
const fltSemantics &getFltSemantics() const {
switch (getTypeID()) {
- case HalfTyID: return APFloat::IEEEhalf;
- case FloatTyID: return APFloat::IEEEsingle;
- case DoubleTyID: return APFloat::IEEEdouble;
- case X86_FP80TyID: return APFloat::x87DoubleExtended;
- case FP128TyID: return APFloat::IEEEquad;
- case PPC_FP128TyID: return APFloat::PPCDoubleDouble;
+ case HalfTyID: return APFloat::IEEEhalf();
+ case FloatTyID: return APFloat::IEEEsingle();
+ case DoubleTyID: return APFloat::IEEEdouble();
+ case X86_FP80TyID: return APFloat::x87DoubleExtended();
+ case FP128TyID: return APFloat::IEEEquad();
+ case PPC_FP128TyID: return APFloat::PPCDoubleDouble();
default: llvm_unreachable("Invalid floating type");
}
}
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Dec 14 05:57:17 2016
@@ -1442,7 +1442,7 @@ Constant *GetConstantFoldFPValue(double
if (Ty->isHalfTy()) {
APFloat APF(V);
bool unused;
- APF.convert(APFloat::IEEEhalf, APFloat::rmNearestTiesToEven, &unused);
+ APF.convert(APFloat::IEEEhalf(), APFloat::rmNearestTiesToEven, &unused);
return ConstantFP::get(Ty->getContext(), APF);
}
if (Ty->isFloatTy())
@@ -1533,7 +1533,7 @@ double getValueAsDouble(ConstantFP *Op)
bool unused;
APFloat APF = Op->getValueAPF();
- APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &unused);
+ APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &unused);
return APF.convertToDouble();
}
@@ -1551,7 +1551,7 @@ Constant *ConstantFoldScalarCall(StringR
APFloat Val(Op->getValueAPF());
bool lost = false;
- Val.convert(APFloat::IEEEhalf, APFloat::rmNearestTiesToEven, &lost);
+ Val.convert(APFloat::IEEEhalf(), APFloat::rmNearestTiesToEven, &lost);
return ConstantInt::get(Ty->getContext(), Val.bitcastToAPInt());
}
@@ -1726,7 +1726,7 @@ Constant *ConstantFoldScalarCall(StringR
case Intrinsic::bitreverse:
return ConstantInt::get(Ty->getContext(), Op->getValue().reverseBits());
case Intrinsic::convert_from_fp16: {
- APFloat Val(APFloat::IEEEhalf, Op->getValue());
+ APFloat Val(APFloat::IEEEhalf(), Op->getValue());
bool lost = false;
APFloat::opStatus status = Val.convert(
Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Wed Dec 14 05:57:17 2016
@@ -876,7 +876,7 @@ lltok::Kind LLLexer::Lex0x() {
// HexFPConstant - Floating point constant represented in IEEE format as a
// hexadecimal number for when exponential notation is not precise enough.
// Half, Float, and double only.
- APFloatVal = APFloat(APFloat::IEEEdouble,
+ APFloatVal = APFloat(APFloat::IEEEdouble(),
APInt(64, HexIntToVal(TokStart + 2, CurPtr)));
return lltok::APFloat;
}
@@ -887,20 +887,20 @@ lltok::Kind LLLexer::Lex0x() {
case 'K':
// F80HexFPConstant - x87 long double in hexadecimal format (10 bytes)
FP80HexToIntPair(TokStart+3, CurPtr, Pair);
- APFloatVal = APFloat(APFloat::x87DoubleExtended, APInt(80, Pair));
+ APFloatVal = APFloat(APFloat::x87DoubleExtended(), APInt(80, Pair));
return lltok::APFloat;
case 'L':
// F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes)
HexToIntPair(TokStart+3, CurPtr, Pair);
- APFloatVal = APFloat(APFloat::IEEEquad, APInt(128, Pair));
+ APFloatVal = APFloat(APFloat::IEEEquad(), APInt(128, Pair));
return lltok::APFloat;
case 'M':
// PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes)
HexToIntPair(TokStart+3, CurPtr, Pair);
- APFloatVal = APFloat(APFloat::PPCDoubleDouble, APInt(128, Pair));
+ APFloatVal = APFloat(APFloat::PPCDoubleDouble(), APInt(128, Pair));
return lltok::APFloat;
case 'H':
- APFloatVal = APFloat(APFloat::IEEEhalf,
+ APFloatVal = APFloat(APFloat::IEEEhalf(),
APInt(16,HexIntToVal(TokStart+3, CurPtr)));
return lltok::APFloat;
}
@@ -967,7 +967,7 @@ lltok::Kind LLLexer::LexDigitOrNegative(
}
}
- APFloatVal = APFloat(APFloat::IEEEdouble,
+ APFloatVal = APFloat(APFloat::IEEEdouble(),
StringRef(TokStart, CurPtr - TokStart));
return lltok::APFloat;
}
@@ -1004,7 +1004,7 @@ lltok::Kind LLLexer::LexPositive() {
}
}
- APFloatVal = APFloat(APFloat::IEEEdouble,
+ APFloatVal = APFloat(APFloat::IEEEdouble(),
StringRef(TokStart, CurPtr - TokStart));
return lltok::APFloat;
}
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Dec 14 05:57:17 2016
@@ -4460,13 +4460,13 @@ bool LLParser::ConvertValIDToValue(Type
// The lexer has no type info, so builds all half, float, and double FP
// constants as double. Fix this here. Long double does not need this.
- if (&ID.APFloatVal.getSemantics() == &APFloat::IEEEdouble) {
+ if (&ID.APFloatVal.getSemantics() == &APFloat::IEEEdouble()) {
bool Ignored;
if (Ty->isHalfTy())
- ID.APFloatVal.convert(APFloat::IEEEhalf, APFloat::rmNearestTiesToEven,
+ ID.APFloatVal.convert(APFloat::IEEEhalf(), APFloat::rmNearestTiesToEven,
&Ignored);
else if (Ty->isFloatTy())
- ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
+ ID.APFloatVal.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven,
&Ignored);
}
V = ConstantFP::get(Context, ID.APFloatVal);
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Dec 14 05:57:17 2016
@@ -1996,26 +1996,26 @@ Error BitcodeReader::parseConstants() {
if (Record.empty())
return error("Invalid record");
if (CurTy->isHalfTy())
- V = ConstantFP::get(Context, APFloat(APFloat::IEEEhalf,
+ V = ConstantFP::get(Context, APFloat(APFloat::IEEEhalf(),
APInt(16, (uint16_t)Record[0])));
else if (CurTy->isFloatTy())
- V = ConstantFP::get(Context, APFloat(APFloat::IEEEsingle,
+ V = ConstantFP::get(Context, APFloat(APFloat::IEEEsingle(),
APInt(32, (uint32_t)Record[0])));
else if (CurTy->isDoubleTy())
- V = ConstantFP::get(Context, APFloat(APFloat::IEEEdouble,
+ V = ConstantFP::get(Context, APFloat(APFloat::IEEEdouble(),
APInt(64, Record[0])));
else if (CurTy->isX86_FP80Ty()) {
// Bits are not stored the same way as a normal i80 APInt, compensate.
uint64_t Rearrange[2];
Rearrange[0] = (Record[1] & 0xffffLL) | (Record[0] << 16);
Rearrange[1] = Record[0] >> 48;
- V = ConstantFP::get(Context, APFloat(APFloat::x87DoubleExtended,
+ V = ConstantFP::get(Context, APFloat(APFloat::x87DoubleExtended(),
APInt(80, Rearrange)));
} else if (CurTy->isFP128Ty())
- V = ConstantFP::get(Context, APFloat(APFloat::IEEEquad,
+ V = ConstantFP::get(Context, APFloat(APFloat::IEEEquad(),
APInt(128, Record)));
else if (CurTy->isPPC_FP128Ty())
- V = ConstantFP::get(Context, APFloat(APFloat::PPCDoubleDouble,
+ V = ConstantFP::get(Context, APFloat(APFloat::PPCDoubleDouble(),
APInt(128, Record)));
else
V = UndefValue::get(CurTy);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Dec 14 05:57:17 2016
@@ -758,7 +758,7 @@ static bool emitDebugValueComment(const
// There is no good way to print long double. Convert a copy to
// double. Ah well, it's only a comment.
bool ignored;
- APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
+ APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven,
&ignored);
OS << "(long double) " << APF.convertToDouble();
}
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Dec 14 05:57:17 2016
@@ -401,7 +401,7 @@ void MachineOperand::print(raw_ostream &
} else if (getFPImm()->getType()->isHalfTy()) {
APFloat APF = getFPImm()->getValueAPF();
bool Unused;
- APF.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &Unused);
+ APF.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &Unused);
OS << "half " << APF.convertToFloat();
} else {
OS << getFPImm()->getValueAPF().convertToDouble();
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Dec 14 05:57:17 2016
@@ -1466,7 +1466,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XI
// TODO: Are there fast-math-flags to propagate to this FADD?
Lo = DAG.getNode(ISD::FADD, dl, VT, Hi,
- DAG.getConstantFP(APFloat(APFloat::PPCDoubleDouble,
+ DAG.getConstantFP(APFloat(APFloat::PPCDoubleDouble(),
APInt(128, Parts)),
dl, MVT::ppcf128));
Lo = DAG.getSelectCC(dl, Src, DAG.getConstant(0, dl, SrcVT),
@@ -1631,7 +1631,7 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_
assert(N->getOperand(0).getValueType() == MVT::ppcf128 &&
"Logic only correct for ppcf128!");
const uint64_t TwoE31[] = {0x41e0000000000000LL, 0};
- APFloat APF = APFloat(APFloat::PPCDoubleDouble, APInt(128, TwoE31));
+ APFloat APF = APFloat(APFloat::PPCDoubleDouble(), APInt(128, TwoE31));
SDValue Tmp = DAG.getConstantFP(APF, dl, MVT::ppcf128);
// X>=2^31 ? (int)(X-2^31)+0x80000000 : (int)X
// FIXME: generated code sucks.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Dec 14 05:57:17 2016
@@ -3191,13 +3191,13 @@ SDValue SelectionDAG::getNode(unsigned O
}
case ISD::BITCAST:
if (VT == MVT::f16 && C->getValueType(0) == MVT::i16)
- return getConstantFP(APFloat(APFloat::IEEEhalf, Val), DL, VT);
+ return getConstantFP(APFloat(APFloat::IEEEhalf(), Val), DL, VT);
if (VT == MVT::f32 && C->getValueType(0) == MVT::i32)
- return getConstantFP(APFloat(APFloat::IEEEsingle, Val), DL, VT);
+ return getConstantFP(APFloat(APFloat::IEEEsingle(), Val), DL, VT);
if (VT == MVT::f64 && C->getValueType(0) == MVT::i64)
- return getConstantFP(APFloat(APFloat::IEEEdouble, Val), DL, VT);
+ return getConstantFP(APFloat(APFloat::IEEEdouble(), Val), DL, VT);
if (VT == MVT::f128 && C->getValueType(0) == MVT::i128)
- return getConstantFP(APFloat(APFloat::IEEEquad, Val), DL, VT);
+ return getConstantFP(APFloat(APFloat::IEEEquad(), Val), DL, VT);
break;
case ISD::BSWAP:
return getConstant(Val.byteSwap(), DL, VT, C->isTargetOpcode(),
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Dec 14 05:57:17 2016
@@ -4172,7 +4172,7 @@ static SDValue GetExponent(SelectionDAG
/// getF32Constant - Get 32-bit floating point constant.
static SDValue getF32Constant(SelectionDAG &DAG, unsigned Flt,
const SDLoc &dl) {
- return DAG.getConstantFP(APFloat(APFloat::IEEEsingle, APInt(32, Flt)), dl,
+ return DAG.getConstantFP(APFloat(APFloat::IEEEsingle(), APInt(32, Flt)), dl,
MVT::f32);
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp Wed Dec 14 05:57:17 2016
@@ -425,9 +425,9 @@ void SDNode::print_details(raw_ostream &
} else if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(this)) {
OS << '<' << CSDN->getAPIntValue() << '>';
} else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(this)) {
- if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle)
+ if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle())
OS << '<' << CSDN->getValueAPF().convertToFloat() << '>';
- else if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEdouble)
+ else if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEdouble())
OS << '<' << CSDN->getValueAPF().convertToDouble() << '>';
else {
OS << "<APFloat(";
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Wed Dec 14 05:57:17 2016
@@ -692,7 +692,7 @@ GenericValue ExecutionEngine::getConstan
else if (CE->getType()->isDoubleTy())
GV.DoubleVal = GV.IntVal.roundToDouble();
else if (CE->getType()->isX86_FP80Ty()) {
- APFloat apf = APFloat::getZero(APFloat::x87DoubleExtended);
+ APFloat apf = APFloat::getZero(APFloat::x87DoubleExtended());
(void)apf.convertFromAPInt(GV.IntVal,
false,
APFloat::rmNearestTiesToEven);
@@ -707,7 +707,7 @@ GenericValue ExecutionEngine::getConstan
else if (CE->getType()->isDoubleTy())
GV.DoubleVal = GV.IntVal.signedRoundToDouble();
else if (CE->getType()->isX86_FP80Ty()) {
- APFloat apf = APFloat::getZero(APFloat::x87DoubleExtended);
+ APFloat apf = APFloat::getZero(APFloat::x87DoubleExtended());
(void)apf.convertFromAPInt(GV.IntVal,
true,
APFloat::rmNearestTiesToEven);
@@ -724,7 +724,7 @@ GenericValue ExecutionEngine::getConstan
else if (Op0->getType()->isDoubleTy())
GV.IntVal = APIntOps::RoundDoubleToAPInt(GV.DoubleVal, BitWidth);
else if (Op0->getType()->isX86_FP80Ty()) {
- APFloat apf = APFloat(APFloat::x87DoubleExtended, GV.IntVal);
+ APFloat apf = APFloat(APFloat::x87DoubleExtended(), GV.IntVal);
uint64_t v;
bool ignored;
(void)apf.convertToInteger(&v, BitWidth,
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Wed Dec 14 05:57:17 2016
@@ -1106,15 +1106,15 @@ static void WriteConstantInternal(raw_os
}
if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
- if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEsingle ||
- &CFP->getValueAPF().getSemantics() == &APFloat::IEEEdouble) {
+ if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEsingle() ||
+ &CFP->getValueAPF().getSemantics() == &APFloat::IEEEdouble()) {
// We would like to output the FP constant value in exponential notation,
// but we cannot do this if doing so will lose precision. Check here to
// make sure that we only output it in exponential format if we can parse
// the value back and get the same value.
//
bool ignored;
- bool isDouble = &CFP->getValueAPF().getSemantics()==&APFloat::IEEEdouble;
+ bool isDouble = &CFP->getValueAPF().getSemantics()==&APFloat::IEEEdouble();
bool isInf = CFP->getValueAPF().isInfinity();
bool isNaN = CFP->getValueAPF().isNaN();
if (!isInf && !isNaN) {
@@ -1131,7 +1131,7 @@ static void WriteConstantInternal(raw_os
((StrVal[0] == '-' || StrVal[0] == '+') &&
(StrVal[1] >= '0' && StrVal[1] <= '9'))) {
// Reparse stringized version!
- if (APFloat(APFloat::IEEEdouble, StrVal).convertToDouble() == Val) {
+ if (APFloat(APFloat::IEEEdouble(), StrVal).convertToDouble() == Val) {
Out << StrVal;
return;
}
@@ -1146,7 +1146,7 @@ static void WriteConstantInternal(raw_os
APFloat apf = CFP->getValueAPF();
// Floats are represented in ASCII IR as double, convert.
if (!isDouble)
- apf.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
+ apf.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven,
&ignored);
Out << format_hex(apf.bitcastToAPInt().getZExtValue(), 0, /*Upper=*/true);
return;
@@ -1157,26 +1157,26 @@ static void WriteConstantInternal(raw_os
// fixed number of hex digits.
Out << "0x";
APInt API = CFP->getValueAPF().bitcastToAPInt();
- if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended) {
+ if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended()) {
Out << 'K';
Out << format_hex_no_prefix(API.getHiBits(16).getZExtValue(), 4,
/*Upper=*/true);
Out << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
/*Upper=*/true);
return;
- } else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad) {
+ } else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad()) {
Out << 'L';
Out << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
/*Upper=*/true);
Out << format_hex_no_prefix(API.getHiBits(64).getZExtValue(), 16,
/*Upper=*/true);
- } else if (&CFP->getValueAPF().getSemantics() == &APFloat::PPCDoubleDouble) {
+ } else if (&CFP->getValueAPF().getSemantics() == &APFloat::PPCDoubleDouble()) {
Out << 'M';
Out << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
/*Upper=*/true);
Out << format_hex_no_prefix(API.getHiBits(64).getZExtValue(), 16,
/*Upper=*/true);
- } else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEhalf) {
+ } else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEhalf()) {
Out << 'H';
Out << format_hex_no_prefix(API.getZExtValue(), 4,
/*Upper=*/true);
Modified: llvm/trunk/lib/IR/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantFold.cpp (original)
+++ llvm/trunk/lib/IR/ConstantFold.cpp Wed Dec 14 05:57:17 2016
@@ -590,13 +590,13 @@ Constant *llvm::ConstantFoldCastInstruct
if (ConstantFP *FPC = dyn_cast<ConstantFP>(V)) {
bool ignored;
APFloat Val = FPC->getValueAPF();
- Val.convert(DestTy->isHalfTy() ? APFloat::IEEEhalf :
- DestTy->isFloatTy() ? APFloat::IEEEsingle :
- DestTy->isDoubleTy() ? APFloat::IEEEdouble :
- DestTy->isX86_FP80Ty() ? APFloat::x87DoubleExtended :
- DestTy->isFP128Ty() ? APFloat::IEEEquad :
- DestTy->isPPC_FP128Ty() ? APFloat::PPCDoubleDouble :
- APFloat::Bogus,
+ Val.convert(DestTy->isHalfTy() ? APFloat::IEEEhalf() :
+ DestTy->isFloatTy() ? APFloat::IEEEsingle() :
+ DestTy->isDoubleTy() ? APFloat::IEEEdouble() :
+ DestTy->isX86_FP80Ty() ? APFloat::x87DoubleExtended() :
+ DestTy->isFP128Ty() ? APFloat::IEEEquad() :
+ DestTy->isPPC_FP128Ty() ? APFloat::PPCDoubleDouble() :
+ APFloat::Bogus(),
APFloat::rmNearestTiesToEven, &ignored);
return ConstantFP::get(V->getContext(), Val);
}
Modified: llvm/trunk/lib/IR/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Constants.cpp (original)
+++ llvm/trunk/lib/IR/Constants.cpp Wed Dec 14 05:57:17 2016
@@ -198,22 +198,22 @@ Constant *Constant::getNullValue(Type *T
return ConstantInt::get(Ty, 0);
case Type::HalfTyID:
return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEhalf));
+ APFloat::getZero(APFloat::IEEEhalf()));
case Type::FloatTyID:
return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEsingle));
+ APFloat::getZero(APFloat::IEEEsingle()));
case Type::DoubleTyID:
return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEdouble));
+ APFloat::getZero(APFloat::IEEEdouble()));
case Type::X86_FP80TyID:
return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::x87DoubleExtended));
+ APFloat::getZero(APFloat::x87DoubleExtended()));
case Type::FP128TyID:
return ConstantFP::get(Ty->getContext(),
- APFloat::getZero(APFloat::IEEEquad));
+ APFloat::getZero(APFloat::IEEEquad()));
case Type::PPC_FP128TyID:
return ConstantFP::get(Ty->getContext(),
- APFloat(APFloat::PPCDoubleDouble,
+ APFloat(APFloat::PPCDoubleDouble(),
APInt::getNullValue(128)));
case Type::PointerTyID:
return ConstantPointerNull::get(cast<PointerType>(Ty));
@@ -604,18 +604,18 @@ void ConstantInt::destroyConstantImpl()
static const fltSemantics *TypeToFloatSemantics(Type *Ty) {
if (Ty->isHalfTy())
- return &APFloat::IEEEhalf;
+ return &APFloat::IEEEhalf();
if (Ty->isFloatTy())
- return &APFloat::IEEEsingle;
+ return &APFloat::IEEEsingle();
if (Ty->isDoubleTy())
- return &APFloat::IEEEdouble;
+ return &APFloat::IEEEdouble();
if (Ty->isX86_FP80Ty())
- return &APFloat::x87DoubleExtended;
+ return &APFloat::x87DoubleExtended();
else if (Ty->isFP128Ty())
- return &APFloat::IEEEquad;
+ return &APFloat::IEEEquad();
assert(Ty->isPPC_FP128Ty() && "Unknown FP format");
- return &APFloat::PPCDoubleDouble;
+ return &APFloat::PPCDoubleDouble();
}
void ConstantFP::anchor() { }
@@ -689,18 +689,18 @@ ConstantFP* ConstantFP::get(LLVMContext
if (!Slot) {
Type *Ty;
- if (&V.getSemantics() == &APFloat::IEEEhalf)
+ if (&V.getSemantics() == &APFloat::IEEEhalf())
Ty = Type::getHalfTy(Context);
- else if (&V.getSemantics() == &APFloat::IEEEsingle)
+ else if (&V.getSemantics() == &APFloat::IEEEsingle())
Ty = Type::getFloatTy(Context);
- else if (&V.getSemantics() == &APFloat::IEEEdouble)
+ else if (&V.getSemantics() == &APFloat::IEEEdouble())
Ty = Type::getDoubleTy(Context);
- else if (&V.getSemantics() == &APFloat::x87DoubleExtended)
+ else if (&V.getSemantics() == &APFloat::x87DoubleExtended())
Ty = Type::getX86_FP80Ty(Context);
- else if (&V.getSemantics() == &APFloat::IEEEquad)
+ else if (&V.getSemantics() == &APFloat::IEEEquad())
Ty = Type::getFP128Ty(Context);
else {
- assert(&V.getSemantics() == &APFloat::PPCDoubleDouble &&
+ assert(&V.getSemantics() == &APFloat::PPCDoubleDouble() &&
"Unknown FP format");
Ty = Type::getPPC_FP128Ty(Context);
}
@@ -1210,40 +1210,40 @@ bool ConstantFP::isValueValidForType(Typ
// FIXME rounding mode needs to be more flexible
case Type::HalfTyID: {
- if (&Val2.getSemantics() == &APFloat::IEEEhalf)
+ if (&Val2.getSemantics() == &APFloat::IEEEhalf())
return true;
- Val2.convert(APFloat::IEEEhalf, APFloat::rmNearestTiesToEven, &losesInfo);
+ Val2.convert(APFloat::IEEEhalf(), APFloat::rmNearestTiesToEven, &losesInfo);
return !losesInfo;
}
case Type::FloatTyID: {
- if (&Val2.getSemantics() == &APFloat::IEEEsingle)
+ if (&Val2.getSemantics() == &APFloat::IEEEsingle())
return true;
- Val2.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &losesInfo);
+ Val2.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &losesInfo);
return !losesInfo;
}
case Type::DoubleTyID: {
- if (&Val2.getSemantics() == &APFloat::IEEEhalf ||
- &Val2.getSemantics() == &APFloat::IEEEsingle ||
- &Val2.getSemantics() == &APFloat::IEEEdouble)
+ if (&Val2.getSemantics() == &APFloat::IEEEhalf() ||
+ &Val2.getSemantics() == &APFloat::IEEEsingle() ||
+ &Val2.getSemantics() == &APFloat::IEEEdouble())
return true;
- Val2.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &losesInfo);
+ Val2.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &losesInfo);
return !losesInfo;
}
case Type::X86_FP80TyID:
- return &Val2.getSemantics() == &APFloat::IEEEhalf ||
- &Val2.getSemantics() == &APFloat::IEEEsingle ||
- &Val2.getSemantics() == &APFloat::IEEEdouble ||
- &Val2.getSemantics() == &APFloat::x87DoubleExtended;
+ return &Val2.getSemantics() == &APFloat::IEEEhalf() ||
+ &Val2.getSemantics() == &APFloat::IEEEsingle() ||
+ &Val2.getSemantics() == &APFloat::IEEEdouble() ||
+ &Val2.getSemantics() == &APFloat::x87DoubleExtended();
case Type::FP128TyID:
- return &Val2.getSemantics() == &APFloat::IEEEhalf ||
- &Val2.getSemantics() == &APFloat::IEEEsingle ||
- &Val2.getSemantics() == &APFloat::IEEEdouble ||
- &Val2.getSemantics() == &APFloat::IEEEquad;
+ return &Val2.getSemantics() == &APFloat::IEEEhalf() ||
+ &Val2.getSemantics() == &APFloat::IEEEsingle() ||
+ &Val2.getSemantics() == &APFloat::IEEEdouble() ||
+ &Val2.getSemantics() == &APFloat::IEEEquad();
case Type::PPC_FP128TyID:
- return &Val2.getSemantics() == &APFloat::IEEEhalf ||
- &Val2.getSemantics() == &APFloat::IEEEsingle ||
- &Val2.getSemantics() == &APFloat::IEEEdouble ||
- &Val2.getSemantics() == &APFloat::PPCDoubleDouble;
+ return &Val2.getSemantics() == &APFloat::IEEEhalf() ||
+ &Val2.getSemantics() == &APFloat::IEEEsingle() ||
+ &Val2.getSemantics() == &APFloat::IEEEdouble() ||
+ &Val2.getSemantics() == &APFloat::PPCDoubleDouble();
}
}
@@ -2610,15 +2610,15 @@ APFloat ConstantDataSequential::getEleme
llvm_unreachable("Accessor can only be used when element is float/double!");
case Type::HalfTyID: {
auto EltVal = *reinterpret_cast<const uint16_t *>(EltPtr);
- return APFloat(APFloat::IEEEhalf, APInt(16, EltVal));
+ return APFloat(APFloat::IEEEhalf(), APInt(16, EltVal));
}
case Type::FloatTyID: {
auto EltVal = *reinterpret_cast<const uint32_t *>(EltPtr);
- return APFloat(APFloat::IEEEsingle, APInt(32, EltVal));
+ return APFloat(APFloat::IEEEsingle(), APInt(32, EltVal));
}
case Type::DoubleTyID: {
auto EltVal = *reinterpret_cast<const uint64_t *>(EltPtr);
- return APFloat(APFloat::IEEEdouble, APInt(64, EltVal));
+ return APFloat(APFloat::IEEEdouble(), APInt(64, EltVal));
}
}
}
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Wed Dec 14 05:57:17 2016
@@ -983,7 +983,7 @@ double LLVMConstRealGetDouble(LLVMValueR
bool APFLosesInfo;
APFloat APF = cFP->getValueAPF();
- APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &APFLosesInfo);
+ APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &APFLosesInfo);
*LosesInfo = APFLosesInfo;
return APF.convertToDouble();
}
Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Wed Dec 14 05:57:17 2016
@@ -68,8 +68,8 @@ struct DenseMapAPIntKeyInfo {
};
struct DenseMapAPFloatKeyInfo {
- static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus, 1); }
- static inline APFloat getTombstoneKey() { return APFloat(APFloat::Bogus, 2); }
+ static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus(), 1); }
+ static inline APFloat getTombstoneKey() { return APFloat(APFloat::Bogus(), 2); }
static unsigned getHashValue(const APFloat &Key) {
return static_cast<unsigned>(hash_value(Key));
}
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Wed Dec 14 05:57:17 2016
@@ -4030,7 +4030,7 @@ void Verifier::visitInstruction(Instruct
if (ConstantFP *CFP0 =
mdconst::dyn_extract_or_null<ConstantFP>(MD->getOperand(0))) {
const APFloat &Accuracy = CFP0->getValueAPF();
- Assert(&Accuracy.getSemantics() == &APFloat::IEEEsingle,
+ Assert(&Accuracy.getSemantics() == &APFloat::IEEEsingle(),
"fpmath accuracy must have float type", &I);
Assert(Accuracy.isFiniteNonZero() && !Accuracy.isNegative(),
"fpmath accuracy not a positive number!", &I);
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed Dec 14 05:57:17 2016
@@ -1042,7 +1042,7 @@ bool AsmParser::parsePrimaryExpr(const M
return false;
}
case AsmToken::Real: {
- APFloat RealVal(APFloat::IEEEdouble, getTok().getString());
+ APFloat RealVal(APFloat::IEEEdouble(), getTok().getString());
uint64_t IntVal = RealVal.bitcastToAPInt().getZExtValue();
Res = MCConstantExpr::create(IntVal, getContext());
EndLoc = Lexer.getTok().getEndLoc();
@@ -1761,10 +1761,10 @@ bool AsmParser::parseStatement(ParseStat
case DK_SINGLE:
case DK_FLOAT:
case DK_DC_S:
- return parseDirectiveRealValue(IDVal, APFloat::IEEEsingle);
+ return parseDirectiveRealValue(IDVal, APFloat::IEEEsingle());
case DK_DOUBLE:
case DK_DC_D:
- return parseDirectiveRealValue(IDVal, APFloat::IEEEdouble);
+ return parseDirectiveRealValue(IDVal, APFloat::IEEEdouble());
case DK_ALIGN: {
bool IsPow2 = !getContext().getAsmInfo()->getAlignmentIsInBytes();
return parseDirectiveAlign(IsPow2, /*ExprSize=*/1);
@@ -1943,11 +1943,11 @@ bool AsmParser::parseStatement(ParseStat
case DK_DCB_B:
return parseDirectiveDCB(IDVal, 1);
case DK_DCB_D:
- return parseDirectiveRealDCB(IDVal, APFloat::IEEEdouble);
+ return parseDirectiveRealDCB(IDVal, APFloat::IEEEdouble());
case DK_DCB_L:
return parseDirectiveDCB(IDVal, 4);
case DK_DCB_S:
- return parseDirectiveRealDCB(IDVal, APFloat::IEEEsingle);
+ return parseDirectiveRealDCB(IDVal, APFloat::IEEEsingle());
case DK_DC_X:
case DK_DCB_X:
return TokError(Twine(IDVal) +
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Wed Dec 14 05:57:17 2016
@@ -59,12 +59,12 @@ namespace llvm {
unsigned int sizeInBits;
};
- const fltSemantics APFloatBase::IEEEhalf = {15, -14, 11, 16};
- const fltSemantics APFloatBase::IEEEsingle = {127, -126, 24, 32};
- const fltSemantics APFloatBase::IEEEdouble = {1023, -1022, 53, 64};
- const fltSemantics APFloatBase::IEEEquad = {16383, -16382, 113, 128};
- const fltSemantics APFloatBase::x87DoubleExtended = {16383, -16382, 64, 80};
- const fltSemantics APFloatBase::Bogus = {0, 0, 0, 0};
+ static const fltSemantics semIEEEhalf = {15, -14, 11, 16};
+ static const fltSemantics semIEEEsingle = {127, -126, 24, 32};
+ static const fltSemantics semIEEEdouble = {1023, -1022, 53, 64};
+ static const fltSemantics semIEEEquad = {16383, -16382, 113, 128};
+ static const fltSemantics semX87DoubleExtended = {16383, -16382, 64, 80};
+ static const fltSemantics semBogus = {0, 0, 0, 0};
/* The PowerPC format consists of two doubles. It does not map cleanly
onto the usual format above. It is approximated using twice the
@@ -77,7 +77,7 @@ namespace llvm {
to represent all possible values held by a PPC double-double number,
for example: (long double) 1.0 + (long double) 0x1p-106
Should this be replaced by a full emulation of PPC double-double? */
- const fltSemantics APFloatBase::PPCDoubleDouble = {0, 0, 0, 0};
+ static const fltSemantics semPPCDoubleDouble = {0, 0, 0, 0};
/* There are temporary semantics for the real PPCDoubleDouble implementation.
Currently, APFloat of PPCDoubleDouble holds one PPCDoubleDoubleImpl as the
@@ -87,8 +87,30 @@ namespace llvm {
TODO: Once all functions support DoubleAPFloat mode, we'll change all
PPCDoubleDoubleImpl to IEEEdouble and remove PPCDoubleDoubleImpl. */
- static const fltSemantics PPCDoubleDoubleImpl = {1023, -1022 + 53, 53 + 53,
- 128};
+ static const fltSemantics semPPCDoubleDoubleImpl = {1023, -1022 + 53, 53 + 53,
+ 128};
+
+ const fltSemantics &APFloatBase::IEEEhalf() {
+ return semIEEEhalf;
+ }
+ const fltSemantics &APFloatBase::IEEEsingle() {
+ return semIEEEsingle;
+ }
+ const fltSemantics &APFloatBase::IEEEdouble() {
+ return semIEEEdouble;
+ }
+ const fltSemantics &APFloatBase::IEEEquad() {
+ return semIEEEquad;
+ }
+ const fltSemantics &APFloatBase::x87DoubleExtended() {
+ return semX87DoubleExtended;
+ }
+ const fltSemantics &APFloatBase::Bogus() {
+ return semBogus;
+ }
+ const fltSemantics &APFloatBase::PPCDoubleDouble() {
+ return semPPCDoubleDouble;
+ }
/* A tight upper bound on number of parts required to hold the value
pow(5, power) is
@@ -685,7 +707,7 @@ void IEEEFloat::makeNaN(bool SNaN, bool
// For x87 extended precision, we want to make a NaN, not a
// pseudo-NaN. Maybe we should expose the ability to make
// pseudo-NaNs?
- if (semantics == &APFloat::x87DoubleExtended)
+ if (semantics == &semX87DoubleExtended)
APInt::tcSetBit(significand, QNaNBit + 1);
}
@@ -710,7 +732,7 @@ IEEEFloat &IEEEFloat::operator=(IEEEFloa
category = rhs.category;
sign = rhs.sign;
- rhs.semantics = &Bogus;
+ rhs.semantics = &semBogus;
return *this;
}
@@ -830,7 +852,7 @@ IEEEFloat::IEEEFloat(const IEEEFloat &rh
assign(rhs);
}
-IEEEFloat::IEEEFloat(IEEEFloat &&rhs) : semantics(&Bogus) {
+IEEEFloat::IEEEFloat(IEEEFloat &&rhs) : semantics(&semBogus) {
*this = std::move(rhs);
}
@@ -1929,8 +1951,8 @@ IEEEFloat::opStatus IEEEFloat::convert(c
shift = toSemantics.precision - fromSemantics.precision;
bool X86SpecialNan = false;
- if (&fromSemantics == &IEEEFloat::x87DoubleExtended &&
- &toSemantics != &IEEEFloat::x87DoubleExtended && category == fcNaN &&
+ if (&fromSemantics == &semX87DoubleExtended &&
+ &toSemantics != &semX87DoubleExtended && category == fcNaN &&
(!(*significandParts() & 0x8000000000000000ULL) ||
!(*significandParts() & 0x4000000000000000ULL))) {
// x86 has some unusual NaNs which cannot be represented in any other
@@ -1994,7 +2016,7 @@ IEEEFloat::opStatus IEEEFloat::convert(c
// For x87 extended precision, we want to make a NaN, not a special NaN if
// the input wasn't special either.
- if (!X86SpecialNan && semantics == &IEEEFloat::x87DoubleExtended)
+ if (!X86SpecialNan && semantics == &semX87DoubleExtended)
APInt::tcSetBit(significandParts(), semantics->precision - 1);
// gcc forces the Quiet bit on, which means (float)(double)(float_sNan)
@@ -2796,7 +2818,7 @@ hash_code hash_value(const IEEEFloat &Ar
// the actual IEEE respresentations. We compensate for that here.
APInt IEEEFloat::convertF80LongDoubleAPFloatToAPInt() const {
- assert(semantics == (const llvm::fltSemantics*)&x87DoubleExtended);
+ assert(semantics == (const llvm::fltSemantics*)&semX87DoubleExtended);
assert(partCount()==2);
uint64_t myexponent, mysignificand;
@@ -2826,7 +2848,7 @@ APInt IEEEFloat::convertF80LongDoubleAPF
}
APInt IEEEFloat::convertPPCDoubleDoubleAPFloatToAPInt() const {
- assert(semantics == (const llvm::fltSemantics *)&PPCDoubleDoubleImpl);
+ assert(semantics == (const llvm::fltSemantics *)&semPPCDoubleDoubleImpl);
assert(partCount()==2);
uint64_t words[2];
@@ -2840,14 +2862,14 @@ APInt IEEEFloat::convertPPCDoubleDoubleA
// Declare fltSemantics before APFloat that uses it (and
// saves pointer to it) to ensure correct destruction order.
fltSemantics extendedSemantics = *semantics;
- extendedSemantics.minExponent = IEEEdouble.minExponent;
+ extendedSemantics.minExponent = semIEEEdouble.minExponent;
IEEEFloat extended(*this);
fs = extended.convert(extendedSemantics, rmNearestTiesToEven, &losesInfo);
assert(fs == opOK && !losesInfo);
(void)fs;
IEEEFloat u(extended);
- fs = u.convert(IEEEdouble, rmNearestTiesToEven, &losesInfo);
+ fs = u.convert(semIEEEdouble, rmNearestTiesToEven, &losesInfo);
assert(fs == opOK || fs == opInexact);
(void)fs;
words[0] = *u.convertDoubleAPFloatToAPInt().getRawData();
@@ -2863,7 +2885,7 @@ APInt IEEEFloat::convertPPCDoubleDoubleA
IEEEFloat v(extended);
v.subtract(u, rmNearestTiesToEven);
- fs = v.convert(IEEEdouble, rmNearestTiesToEven, &losesInfo);
+ fs = v.convert(semIEEEdouble, rmNearestTiesToEven, &losesInfo);
assert(fs == opOK && !losesInfo);
(void)fs;
words[1] = *v.convertDoubleAPFloatToAPInt().getRawData();
@@ -2875,7 +2897,7 @@ APInt IEEEFloat::convertPPCDoubleDoubleA
}
APInt IEEEFloat::convertQuadrupleAPFloatToAPInt() const {
- assert(semantics == (const llvm::fltSemantics*)&IEEEquad);
+ assert(semantics == (const llvm::fltSemantics*)&semIEEEquad);
assert(partCount()==2);
uint64_t myexponent, mysignificand, mysignificand2;
@@ -2909,7 +2931,7 @@ APInt IEEEFloat::convertQuadrupleAPFloat
}
APInt IEEEFloat::convertDoubleAPFloatToAPInt() const {
- assert(semantics == (const llvm::fltSemantics*)&IEEEdouble);
+ assert(semantics == (const llvm::fltSemantics*)&semIEEEdouble);
assert(partCount()==1);
uint64_t myexponent, mysignificand;
@@ -2937,7 +2959,7 @@ APInt IEEEFloat::convertDoubleAPFloatToA
}
APInt IEEEFloat::convertFloatAPFloatToAPInt() const {
- assert(semantics == (const llvm::fltSemantics*)&IEEEsingle);
+ assert(semantics == (const llvm::fltSemantics*)&semIEEEsingle);
assert(partCount()==1);
uint32_t myexponent, mysignificand;
@@ -2964,7 +2986,7 @@ APInt IEEEFloat::convertFloatAPFloatToAP
}
APInt IEEEFloat::convertHalfAPFloatToAPInt() const {
- assert(semantics == (const llvm::fltSemantics*)&IEEEhalf);
+ assert(semantics == (const llvm::fltSemantics*)&semIEEEhalf);
assert(partCount()==1);
uint32_t myexponent, mysignificand;
@@ -2995,35 +3017,35 @@ APInt IEEEFloat::convertHalfAPFloatToAPI
// and treating the result as a normal integer is unlikely to be useful.
APInt IEEEFloat::bitcastToAPInt() const {
- if (semantics == (const llvm::fltSemantics*)&IEEEhalf)
+ if (semantics == (const llvm::fltSemantics*)&semIEEEhalf)
return convertHalfAPFloatToAPInt();
- if (semantics == (const llvm::fltSemantics*)&IEEEsingle)
+ if (semantics == (const llvm::fltSemantics*)&semIEEEsingle)
return convertFloatAPFloatToAPInt();
- if (semantics == (const llvm::fltSemantics*)&IEEEdouble)
+ if (semantics == (const llvm::fltSemantics*)&semIEEEdouble)
return convertDoubleAPFloatToAPInt();
- if (semantics == (const llvm::fltSemantics*)&IEEEquad)
+ if (semantics == (const llvm::fltSemantics*)&semIEEEquad)
return convertQuadrupleAPFloatToAPInt();
- if (semantics == (const llvm::fltSemantics *)&PPCDoubleDoubleImpl)
+ if (semantics == (const llvm::fltSemantics *)&semPPCDoubleDoubleImpl)
return convertPPCDoubleDoubleAPFloatToAPInt();
- assert(semantics == (const llvm::fltSemantics*)&x87DoubleExtended &&
+ assert(semantics == (const llvm::fltSemantics*)&semX87DoubleExtended &&
"unknown format!");
return convertF80LongDoubleAPFloatToAPInt();
}
float IEEEFloat::convertToFloat() const {
- assert(semantics == (const llvm::fltSemantics*)&IEEEsingle &&
+ assert(semantics == (const llvm::fltSemantics*)&semIEEEsingle &&
"Float semantics are not IEEEsingle");
APInt api = bitcastToAPInt();
return api.bitsToFloat();
}
double IEEEFloat::convertToDouble() const {
- assert(semantics == (const llvm::fltSemantics*)&IEEEdouble &&
+ assert(semantics == (const llvm::fltSemantics*)&semIEEEdouble &&
"Float semantics are not IEEEdouble");
APInt api = bitcastToAPInt();
return api.bitsToDouble();
@@ -3043,7 +3065,7 @@ void IEEEFloat::initFromF80LongDoubleAPI
uint64_t myexponent = (i2 & 0x7fff);
uint64_t mysignificand = i1;
- initialize(&IEEEFloat::x87DoubleExtended);
+ initialize(&semX87DoubleExtended);
assert(partCount()==2);
sign = static_cast<unsigned int>(i2>>15);
@@ -3077,14 +3099,14 @@ void IEEEFloat::initFromPPCDoubleDoubleA
// Get the first double and convert to our format.
initFromDoubleAPInt(APInt(64, i1));
- fs = convert(PPCDoubleDoubleImpl, rmNearestTiesToEven, &losesInfo);
+ fs = convert(semPPCDoubleDoubleImpl, rmNearestTiesToEven, &losesInfo);
assert(fs == opOK && !losesInfo);
(void)fs;
// Unless we have a special case, add in second double.
if (isFiniteNonZero()) {
- IEEEFloat v(IEEEdouble, APInt(64, i2));
- fs = v.convert(PPCDoubleDoubleImpl, rmNearestTiesToEven, &losesInfo);
+ IEEEFloat v(semIEEEdouble, APInt(64, i2));
+ fs = v.convert(semPPCDoubleDoubleImpl, rmNearestTiesToEven, &losesInfo);
assert(fs == opOK && !losesInfo);
(void)fs;
@@ -3100,7 +3122,7 @@ void IEEEFloat::initFromQuadrupleAPInt(c
uint64_t mysignificand = i1;
uint64_t mysignificand2 = i2 & 0xffffffffffffLL;
- initialize(&IEEEFloat::IEEEquad);
+ initialize(&semIEEEquad);
assert(partCount()==2);
sign = static_cast<unsigned int>(i2>>63);
@@ -3136,7 +3158,7 @@ void IEEEFloat::initFromDoubleAPInt(cons
uint64_t myexponent = (i >> 52) & 0x7ff;
uint64_t mysignificand = i & 0xfffffffffffffLL;
- initialize(&IEEEFloat::IEEEdouble);
+ initialize(&semIEEEdouble);
assert(partCount()==1);
sign = static_cast<unsigned int>(i>>63);
@@ -3167,7 +3189,7 @@ void IEEEFloat::initFromFloatAPInt(const
uint32_t myexponent = (i >> 23) & 0xff;
uint32_t mysignificand = i & 0x7fffff;
- initialize(&IEEEFloat::IEEEsingle);
+ initialize(&semIEEEsingle);
assert(partCount()==1);
sign = i >> 31;
@@ -3198,7 +3220,7 @@ void IEEEFloat::initFromHalfAPInt(const
uint32_t myexponent = (i >> 10) & 0x1f;
uint32_t mysignificand = i & 0x3ff;
- initialize(&IEEEFloat::IEEEhalf);
+ initialize(&semIEEEhalf);
assert(partCount()==1);
sign = i >> 15;
@@ -3228,17 +3250,17 @@ void IEEEFloat::initFromHalfAPInt(const
/// isIEEE argument distinguishes between PPC128 and IEEE128 (not meaningful
/// when the size is anything else).
void IEEEFloat::initFromAPInt(const fltSemantics *Sem, const APInt &api) {
- if (Sem == &IEEEhalf)
+ if (Sem == &semIEEEhalf)
return initFromHalfAPInt(api);
- if (Sem == &IEEEsingle)
+ if (Sem == &semIEEEsingle)
return initFromFloatAPInt(api);
- if (Sem == &IEEEdouble)
+ if (Sem == &semIEEEdouble)
return initFromDoubleAPInt(api);
- if (Sem == &x87DoubleExtended)
+ if (Sem == &semX87DoubleExtended)
return initFromF80LongDoubleAPInt(api);
- if (Sem == &IEEEquad)
+ if (Sem == &semIEEEquad)
return initFromQuadrupleAPInt(api);
- if (Sem == &PPCDoubleDoubleImpl)
+ if (Sem == &semPPCDoubleDoubleImpl)
return initFromPPCDoubleDoubleAPInt(api);
llvm_unreachable(nullptr);
@@ -3301,11 +3323,11 @@ IEEEFloat::IEEEFloat(const fltSemantics
}
IEEEFloat::IEEEFloat(float f) {
- initFromAPInt(&IEEEsingle, APInt::floatToBits(f));
+ initFromAPInt(&semIEEEsingle, APInt::floatToBits(f));
}
IEEEFloat::IEEEFloat(double d) {
- initFromAPInt(&IEEEdouble, APInt::doubleToBits(d));
+ initFromAPInt(&semIEEEdouble, APInt::doubleToBits(d));
}
namespace {
@@ -3830,40 +3852,40 @@ IEEEFloat frexp(const IEEEFloat &Val, in
}
DoubleAPFloat::DoubleAPFloat(const fltSemantics &S)
- : Semantics(&S), Floats(new APFloat[2]{APFloat(PPCDoubleDoubleImpl),
- APFloat(IEEEdouble)}) {
- assert(Semantics == &PPCDoubleDouble);
+ : Semantics(&S), Floats(new APFloat[2]{APFloat(semPPCDoubleDoubleImpl),
+ APFloat(semIEEEdouble)}) {
+ assert(Semantics == &semPPCDoubleDouble);
}
DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, uninitializedTag)
: Semantics(&S),
- Floats(new APFloat[2]{APFloat(PPCDoubleDoubleImpl, uninitialized),
- APFloat(IEEEdouble, uninitialized)}) {
- assert(Semantics == &PPCDoubleDouble);
+ Floats(new APFloat[2]{APFloat(semPPCDoubleDoubleImpl, uninitialized),
+ APFloat(semIEEEdouble, uninitialized)}) {
+ assert(Semantics == &semPPCDoubleDouble);
}
DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, integerPart I)
- : Semantics(&S), Floats(new APFloat[2]{APFloat(PPCDoubleDoubleImpl, I),
- APFloat(IEEEdouble)}) {
- assert(Semantics == &PPCDoubleDouble);
+ : Semantics(&S), Floats(new APFloat[2]{APFloat(semPPCDoubleDoubleImpl, I),
+ APFloat(semIEEEdouble)}) {
+ assert(Semantics == &semPPCDoubleDouble);
}
DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, const APInt &I)
: Semantics(&S), Floats(new APFloat[2]{
- APFloat(PPCDoubleDoubleImpl, I),
- APFloat(IEEEdouble, APInt(64, I.getRawData()[1]))}) {
- assert(Semantics == &PPCDoubleDouble);
+ APFloat(semPPCDoubleDoubleImpl, I),
+ APFloat(semIEEEdouble, APInt(64, I.getRawData()[1]))}) {
+ assert(Semantics == &semPPCDoubleDouble);
}
DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, APFloat &&First,
APFloat &&Second)
: Semantics(&S),
Floats(new APFloat[2]{std::move(First), std::move(Second)}) {
- assert(Semantics == &PPCDoubleDouble);
+ assert(Semantics == &semPPCDoubleDouble);
// TODO Check for First == &IEEEdouble once the transition is done.
- assert(&Floats[0].getSemantics() == &PPCDoubleDoubleImpl ||
- &Floats[0].getSemantics() == &IEEEdouble);
- assert(&Floats[1].getSemantics() == &IEEEdouble);
+ assert(&Floats[0].getSemantics() == &semPPCDoubleDoubleImpl ||
+ &Floats[0].getSemantics() == &semIEEEdouble);
+ assert(&Floats[1].getSemantics() == &semIEEEdouble);
}
DoubleAPFloat::DoubleAPFloat(const DoubleAPFloat &RHS)
@@ -3871,13 +3893,13 @@ DoubleAPFloat::DoubleAPFloat(const Doubl
Floats(RHS.Floats ? new APFloat[2]{APFloat(RHS.Floats[0]),
APFloat(RHS.Floats[1])}
: nullptr) {
- assert(Semantics == &PPCDoubleDouble);
+ assert(Semantics == &semPPCDoubleDouble);
}
DoubleAPFloat::DoubleAPFloat(DoubleAPFloat &&RHS)
: Semantics(RHS.Semantics), Floats(std::move(RHS.Floats)) {
- RHS.Semantics = &Bogus;
- assert(Semantics == &PPCDoubleDouble);
+ RHS.Semantics = &semBogus;
+ assert(Semantics == &semPPCDoubleDouble);
}
DoubleAPFloat &DoubleAPFloat::operator=(const DoubleAPFloat &RHS) {
@@ -4009,22 +4031,22 @@ APFloat::opStatus DoubleAPFloat::addWith
// These conversions will go away once PPCDoubleDoubleImpl goes away.
// (PPCDoubleDoubleImpl, IEEEDouble) -> (IEEEDouble, IEEEDouble)
- APFloat A(IEEEdouble,
+ APFloat A(semIEEEdouble,
APInt(64, LHS.Floats[0].bitcastToAPInt().getRawData()[0])),
AA(LHS.Floats[1]),
- C(IEEEdouble, APInt(64, RHS.Floats[0].bitcastToAPInt().getRawData()[0])),
+ C(semIEEEdouble, APInt(64, RHS.Floats[0].bitcastToAPInt().getRawData()[0])),
CC(RHS.Floats[1]);
- assert(&AA.getSemantics() == &IEEEdouble);
- assert(&CC.getSemantics() == &IEEEdouble);
- Out.Floats[0] = APFloat(IEEEdouble);
- assert(&Out.Floats[1].getSemantics() == &IEEEdouble);
+ assert(&AA.getSemantics() == &semIEEEdouble);
+ assert(&CC.getSemantics() == &semIEEEdouble);
+ Out.Floats[0] = APFloat(semIEEEdouble);
+ assert(&Out.Floats[1].getSemantics() == &semIEEEdouble);
auto Ret = Out.addImpl(A, AA, C, CC, RM);
// (IEEEDouble, IEEEDouble) -> (PPCDoubleDoubleImpl, IEEEDouble)
uint64_t Buffer[] = {Out.Floats[0].bitcastToAPInt().getRawData()[0],
Out.Floats[1].bitcastToAPInt().getRawData()[0]};
- Out.Floats[0] = APFloat(PPCDoubleDoubleImpl, APInt(128, 2, Buffer));
+ Out.Floats[0] = APFloat(semPPCDoubleDoubleImpl, APInt(128, 2, Buffer));
return Ret;
}
@@ -4091,7 +4113,7 @@ APFloat::Storage::Storage(IEEEFloat F, c
} else if (usesLayout<DoubleAPFloat>(Semantics)) {
new (&Double)
DoubleAPFloat(Semantics, APFloat(std::move(F), F.getSemantics()),
- APFloat(IEEEdouble));
+ APFloat(semIEEEdouble));
} else {
llvm_unreachable("Unexpected semantics");
}
@@ -4117,10 +4139,10 @@ APFloat::opStatus APFloat::convert(const
return U.IEEE.convert(ToSemantics, RM, losesInfo);
} else if (usesLayout<IEEEFloat>(getSemantics()) &&
usesLayout<DoubleAPFloat>(ToSemantics)) {
- assert(&ToSemantics == &PPCDoubleDouble);
- auto Ret = U.IEEE.convert(PPCDoubleDoubleImpl, RM, losesInfo);
+ assert(&ToSemantics == &semPPCDoubleDouble);
+ auto Ret = U.IEEE.convert(semPPCDoubleDoubleImpl, RM, losesInfo);
*this = APFloat(
- DoubleAPFloat(PPCDoubleDouble, std::move(*this), APFloat(IEEEdouble)),
+ DoubleAPFloat(semPPCDoubleDouble, std::move(*this), APFloat(semIEEEdouble)),
ToSemantics);
return Ret;
} else if (usesLayout<DoubleAPFloat>(getSemantics()) &&
@@ -4137,21 +4159,21 @@ APFloat APFloat::getAllOnesValue(unsigne
if (isIEEE) {
switch (BitWidth) {
case 16:
- return APFloat(IEEEhalf, APInt::getAllOnesValue(BitWidth));
+ return APFloat(semIEEEhalf, APInt::getAllOnesValue(BitWidth));
case 32:
- return APFloat(IEEEsingle, APInt::getAllOnesValue(BitWidth));
+ return APFloat(semIEEEsingle, APInt::getAllOnesValue(BitWidth));
case 64:
- return APFloat(IEEEdouble, APInt::getAllOnesValue(BitWidth));
+ return APFloat(semIEEEdouble, APInt::getAllOnesValue(BitWidth));
case 80:
- return APFloat(x87DoubleExtended, APInt::getAllOnesValue(BitWidth));
+ return APFloat(semX87DoubleExtended, APInt::getAllOnesValue(BitWidth));
case 128:
- return APFloat(IEEEquad, APInt::getAllOnesValue(BitWidth));
+ return APFloat(semIEEEquad, APInt::getAllOnesValue(BitWidth));
default:
llvm_unreachable("Unknown floating bit width");
}
} else {
assert(BitWidth == 128);
- return APFloat(PPCDoubleDouble, APInt::getAllOnesValue(BitWidth));
+ return APFloat(semPPCDoubleDouble, APInt::getAllOnesValue(BitWidth));
}
}
Modified: llvm/trunk/lib/Support/ScaledNumber.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ScaledNumber.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ScaledNumber.cpp (original)
+++ llvm/trunk/lib/Support/ScaledNumber.cpp Wed Dec 14 05:57:17 2016
@@ -183,7 +183,7 @@ static std::string toStringAPFloat(uint6
// Build the float and print it.
uint64_t RawBits[2] = {D, AdjustedE};
- APFloat Float(APFloat::x87DoubleExtended, APInt(80, RawBits));
+ APFloat Float(APFloat::x87DoubleExtended(), APInt(80, RawBits));
SmallVector<char, 24> Chars;
Float.toString(Chars, Precision, 0);
return std::string(Chars.begin(), Chars.end());
Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Wed Dec 14 05:57:17 2016
@@ -2206,7 +2206,7 @@ AArch64AsmParser::tryParseFPImm(OperandV
const AsmToken &Tok = Parser.getTok();
if (Tok.is(AsmToken::Real)) {
- APFloat RealVal(APFloat::IEEEdouble, Tok.getString());
+ APFloat RealVal(APFloat::IEEEdouble(), Tok.getString());
if (isNegative)
RealVal.changeSign();
@@ -2232,7 +2232,7 @@ AArch64AsmParser::tryParseFPImm(OperandV
return MatchOperand_ParseFail;
}
} else {
- APFloat RealVal(APFloat::IEEEdouble, Tok.getString());
+ APFloat RealVal(APFloat::IEEEdouble(), Tok.getString());
uint64_t IntVal = RealVal.bitcastToAPInt().getZExtValue();
// If we had a '-' in front, toggle the sign bit.
IntVal ^= (uint64_t)isNegative << 63;
@@ -3154,7 +3154,7 @@ bool AArch64AsmParser::parseOperand(Oper
// so convert the value.
const AsmToken &Tok = Parser.getTok();
if (Tok.is(AsmToken::Real)) {
- APFloat RealVal(APFloat::IEEEdouble, Tok.getString());
+ APFloat RealVal(APFloat::IEEEdouble(), Tok.getString());
uint64_t IntVal = RealVal.bitcastToAPInt().getZExtValue();
if (Mnemonic != "fcmp" && Mnemonic != "fcmpe" && Mnemonic != "fcmeq" &&
Mnemonic != "fcmge" && Mnemonic != "fcmgt" && Mnemonic != "fcmle" &&
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Wed Dec 14 05:57:17 2016
@@ -1614,7 +1614,7 @@ SDValue AMDGPUTargetLowering::LowerFRINT
assert(Op.getValueType() == MVT::f64);
- APFloat C1Val(APFloat::IEEEdouble, "0x1.0p+52");
+ APFloat C1Val(APFloat::IEEEdouble(), "0x1.0p+52");
SDValue C1 = DAG.getConstantFP(C1Val, SL, MVT::f64);
SDValue CopySign = DAG.getNode(ISD::FCOPYSIGN, SL, MVT::f64, C1, Src);
@@ -1625,7 +1625,7 @@ SDValue AMDGPUTargetLowering::LowerFRINT
SDValue Fabs = DAG.getNode(ISD::FABS, SL, MVT::f64, Src);
- APFloat C2Val(APFloat::IEEEdouble, "0x1.fffffffffffffp+51");
+ APFloat C2Val(APFloat::IEEEdouble(), "0x1.fffffffffffffp+51");
SDValue C2 = DAG.getConstantFP(C2Val, SL, MVT::f64);
EVT SetCCVT =
Modified: llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp Wed Dec 14 05:57:17 2016
@@ -882,11 +882,11 @@ struct OptionalOperand {
static const fltSemantics *getFltSemantics(unsigned Size) {
switch (Size) {
case 4:
- return &APFloat::IEEEsingle;
+ return &APFloat::IEEEsingle();
case 8:
- return &APFloat::IEEEdouble;
+ return &APFloat::IEEEdouble();
case 2:
- return &APFloat::IEEEhalf;
+ return &APFloat::IEEEhalf();
default:
llvm_unreachable("unsupported fp type");
}
@@ -935,7 +935,7 @@ bool AMDGPUOperand::isInlinableImm(MVT t
AsmParser->hasInv2PiInlineImm());
}
- APFloat FPLiteral(APFloat::IEEEdouble, APInt(64, Imm.Val));
+ APFloat FPLiteral(APFloat::IEEEdouble(), APInt(64, Imm.Val));
if (!canLosslesslyConvertToFPType(FPLiteral, type))
return false;
@@ -993,7 +993,7 @@ bool AMDGPUOperand::isLiteralImm(MVT typ
return false;
}
- APFloat FPLiteral(APFloat::IEEEdouble, APInt(64, Imm.Val));
+ APFloat FPLiteral(APFloat::IEEEdouble(), APInt(64, Imm.Val));
return canLosslesslyConvertToFPType(FPLiteral, type);
}
@@ -1062,7 +1062,7 @@ void AMDGPUOperand::addLiteralImmOperand
case 4:
case 2: {
bool lost;
- APFloat FPLiteral(APFloat::IEEEdouble, Literal);
+ APFloat FPLiteral(APFloat::IEEEdouble(), Literal);
// Convert literal to single precision
FPLiteral.convert(*getFltSemantics(OpSize),
APFloat::rmNearestTiesToEven, &lost);
@@ -1130,7 +1130,7 @@ void AMDGPUOperand::addKImmFPOperands(MC
}
bool Lost;
- APFloat FPLiteral(APFloat::IEEEdouble, Literal);
+ APFloat FPLiteral(APFloat::IEEEdouble(), Literal);
FPLiteral.convert(*getFltSemantics(Bitwidth / 8),
APFloat::rmNearestTiesToEven, &Lost);
Inst.addOperand(MCOperand::createImm(FPLiteral.bitcastToAPInt().getZExtValue()));
Modified: llvm/trunk/lib/Target/ARM/ARMMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMCInstLower.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMMCInstLower.cpp Wed Dec 14 05:57:17 2016
@@ -99,7 +99,7 @@ bool ARMAsmPrinter::lowerOperand(const M
case MachineOperand::MO_FPImmediate: {
APFloat Val = MO.getFPImm()->getValueAPF();
bool ignored;
- Val.convert(APFloat::IEEEdouble, APFloat::rmTowardZero, &ignored);
+ Val.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &ignored);
MCOp = MCOperand::createFPImm(Val.convertToDouble());
break;
}
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Wed Dec 14 05:57:17 2016
@@ -5295,7 +5295,7 @@ ARMAsmParser::parseFPImm(OperandVector &
const AsmToken &Tok = Parser.getTok();
SMLoc Loc = Tok.getLoc();
if (Tok.is(AsmToken::Real) && isVmovf) {
- APFloat RealVal(APFloat::IEEEsingle, Tok.getString());
+ APFloat RealVal(APFloat::IEEEsingle(), Tok.getString());
uint64_t IntVal = RealVal.bitcastToAPInt().getZExtValue();
// If we had a '-' in front, toggle the sign bit.
IntVal ^= (uint64_t)isNegative << 31;
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Wed Dec 14 05:57:17 2016
@@ -1723,11 +1723,11 @@ void NVPTXAsmPrinter::printFPConstant(co
if (Fp->getType()->getTypeID() == Type::FloatTyID) {
numHex = 8;
lead = "0f";
- APF.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &ignored);
+ APF.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &ignored);
} else if (Fp->getType()->getTypeID() == Type::DoubleTyID) {
numHex = 16;
lead = "0d";
- APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &ignored);
+ APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &ignored);
} else
llvm_unreachable("unsupported fp type");
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td Wed Dec 14 05:57:17 2016
@@ -739,12 +739,12 @@ def INEG64 :
// Constant 1.0f
def FloatConst1 : PatLeaf<(fpimm), [{
- return &N->getValueAPF().getSemantics() == &llvm::APFloat::IEEEsingle &&
+ return &N->getValueAPF().getSemantics() == &llvm::APFloat::IEEEsingle() &&
N->getValueAPF().convertToFloat() == 1.0f;
}]>;
// Constant 1.0 (double)
def DoubleConst1 : PatLeaf<(fpimm), [{
- return &N->getValueAPF().getSemantics() == &llvm::APFloat::IEEEdouble &&
+ return &N->getValueAPF().getSemantics() == &llvm::APFloat::IEEEdouble() &&
N->getValueAPF().convertToDouble() == 1.0;
}]>;
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXMCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXMCExpr.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXMCExpr.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXMCExpr.cpp Wed Dec 14 05:57:17 2016
@@ -30,12 +30,12 @@ void NVPTXFloatMCExpr::printImpl(raw_ost
case VK_NVPTX_SINGLE_PREC_FLOAT:
OS << "0f";
NumHex = 8;
- APF.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &Ignored);
+ APF.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &Ignored);
break;
case VK_NVPTX_DOUBLE_PREC_FLOAT:
OS << "0d";
NumHex = 16;
- APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &Ignored);
+ APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &Ignored);
break;
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Dec 14 05:57:17 2016
@@ -599,14 +599,14 @@ X86TargetLowering::X86TargetLowering(con
setOperationAction(ISD::UNDEF, MVT::f80, Expand);
setOperationAction(ISD::FCOPYSIGN, MVT::f80, Expand);
{
- APFloat TmpFlt = APFloat::getZero(APFloat::x87DoubleExtended);
+ APFloat TmpFlt = APFloat::getZero(APFloat::x87DoubleExtended());
addLegalFPImmediate(TmpFlt); // FLD0
TmpFlt.changeSign();
addLegalFPImmediate(TmpFlt); // FLD0/FCHS
bool ignored;
APFloat TmpFlt2(+1.0);
- TmpFlt2.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
+ TmpFlt2.convert(APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven,
&ignored);
addLegalFPImmediate(TmpFlt2); // FLD1
TmpFlt2.changeSign();
@@ -4767,10 +4767,10 @@ static SDValue getConstVector(ArrayRef<A
Ops.push_back(DAG.getConstant(V.trunc(32), dl, EltVT));
Ops.push_back(DAG.getConstant(V.lshr(32).trunc(32), dl, EltVT));
} else if (EltVT == MVT::f32) {
- APFloat FV(APFloat::IEEEsingle, V);
+ APFloat FV(APFloat::IEEEsingle(), V);
Ops.push_back(DAG.getConstantFP(FV, dl, EltVT));
} else if (EltVT == MVT::f64) {
- APFloat FV(APFloat::IEEEdouble, V);
+ APFloat FV(APFloat::IEEEdouble(), V);
Ops.push_back(DAG.getConstantFP(FV, dl, EltVT));
} else {
Ops.push_back(DAG.getConstant(V, dl, EltVT));
@@ -14378,10 +14378,10 @@ SDValue X86TargetLowering::LowerUINT_TO_
SmallVector<Constant*,2> CV1;
CV1.push_back(
- ConstantFP::get(*Context, APFloat(APFloat::IEEEdouble,
+ ConstantFP::get(*Context, APFloat(APFloat::IEEEdouble(),
APInt(64, 0x4330000000000000ULL))));
CV1.push_back(
- ConstantFP::get(*Context, APFloat(APFloat::IEEEdouble,
+ ConstantFP::get(*Context, APFloat(APFloat::IEEEdouble(),
APInt(64, 0x4530000000000000ULL))));
Constant *C1 = ConstantVector::get(CV1);
SDValue CPIdx1 = DAG.getConstantPool(C1, PtrVT, 16);
@@ -14583,7 +14583,7 @@ static SDValue lowerUINT_TO_FP_vXi32(SDV
// Create the vector constant for -(0x1.0p39f + 0x1.0p23f).
SDValue VecCstFAdd = DAG.getConstantFP(
- APFloat(APFloat::IEEEsingle, APInt(32, 0xD3000080)), DL, VecFloatVT);
+ APFloat(APFloat::IEEEsingle(), APInt(32, 0xD3000080)), DL, VecFloatVT);
// float4 fhi = (float4) hi - (0x1.0p39f + 0x1.0p23f);
SDValue HighBitcast = DAG.getBitcast(VecFloatVT, High);
@@ -14821,15 +14821,15 @@ X86TargetLowering::FP_TO_INTHelper(SDVal
// For X87 we'd like to use the smallest FP type for this constant, but
// for DAG type consistency we have to match the FP operand type.
- APFloat Thresh(APFloat::IEEEsingle, APInt(32, 0x5f000000));
+ APFloat Thresh(APFloat::IEEEsingle(), APInt(32, 0x5f000000));
LLVM_ATTRIBUTE_UNUSED APFloat::opStatus Status = APFloat::opOK;
bool LosesInfo = false;
if (TheVT == MVT::f64)
// The rounding mode is irrelevant as the conversion should be exact.
- Status = Thresh.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
+ Status = Thresh.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven,
&LosesInfo);
else if (TheVT == MVT::f80)
- Status = Thresh.convert(APFloat::x87DoubleExtended,
+ Status = Thresh.convert(APFloat::x87DoubleExtended(),
APFloat::rmNearestTiesToEven, &LosesInfo);
assert(Status == APFloat::opOK && !LosesInfo &&
@@ -15379,8 +15379,8 @@ static SDValue LowerFABSorFNEG(SDValue O
APInt MaskElt =
IsFABS ? APInt::getSignedMaxValue(EltBits) : APInt::getSignBit(EltBits);
const fltSemantics &Sem =
- EltVT == MVT::f64 ? APFloat::IEEEdouble :
- (IsF128 ? APFloat::IEEEquad : APFloat::IEEEsingle);
+ EltVT == MVT::f64 ? APFloat::IEEEdouble() :
+ (IsF128 ? APFloat::IEEEquad() : APFloat::IEEEsingle());
SDValue Mask = DAG.getConstantFP(APFloat(Sem, MaskElt), dl, LogicVT);
SDValue Op0 = Op.getOperand(0);
@@ -15424,8 +15424,8 @@ static SDValue LowerFCOPYSIGN(SDValue Op
MVT EltVT = VT.getScalarType();
const fltSemantics &Sem =
- EltVT == MVT::f64 ? APFloat::IEEEdouble
- : (IsF128 ? APFloat::IEEEquad : APFloat::IEEEsingle);
+ EltVT == MVT::f64 ? APFloat::IEEEdouble()
+ : (IsF128 ? APFloat::IEEEquad() : APFloat::IEEEsingle());
// Perform all scalar logic operations as 16-byte vectors because there are no
// scalar FP logic instructions in SSE.
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Wed Dec 14 05:57:17 2016
@@ -1239,14 +1239,14 @@ static Value *lookThroughFPExtensions(Va
if (CFP->getType() == Type::getPPC_FP128Ty(V->getContext()))
return V; // No constant folding of this.
// See if the value can be truncated to half and then reextended.
- if (Value *V = fitsInFPType(CFP, APFloat::IEEEhalf))
+ if (Value *V = fitsInFPType(CFP, APFloat::IEEEhalf()))
return V;
// See if the value can be truncated to float and then reextended.
- if (Value *V = fitsInFPType(CFP, APFloat::IEEEsingle))
+ if (Value *V = fitsInFPType(CFP, APFloat::IEEEsingle()))
return V;
if (CFP->getType()->isDoubleTy())
return V; // Won't shrink.
- if (Value *V = fitsInFPType(CFP, APFloat::IEEEdouble))
+ if (Value *V = fitsInFPType(CFP, APFloat::IEEEdouble()))
return V;
// Don't try to shrink to various long double types.
}
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Wed Dec 14 05:57:17 2016
@@ -4661,17 +4661,17 @@ Instruction *InstCombiner::visitFCmpInst
const fltSemantics *Sem;
// FIXME: This shouldn't be here.
if (LHSExt->getSrcTy()->isHalfTy())
- Sem = &APFloat::IEEEhalf;
+ Sem = &APFloat::IEEEhalf();
else if (LHSExt->getSrcTy()->isFloatTy())
- Sem = &APFloat::IEEEsingle;
+ Sem = &APFloat::IEEEsingle();
else if (LHSExt->getSrcTy()->isDoubleTy())
- Sem = &APFloat::IEEEdouble;
+ Sem = &APFloat::IEEEdouble();
else if (LHSExt->getSrcTy()->isFP128Ty())
- Sem = &APFloat::IEEEquad;
+ Sem = &APFloat::IEEEquad();
else if (LHSExt->getSrcTy()->isX86_FP80Ty())
- Sem = &APFloat::x87DoubleExtended;
+ Sem = &APFloat::x87DoubleExtended();
else if (LHSExt->getSrcTy()->isPPC_FP128Ty())
- Sem = &APFloat::PPCDoubleDouble;
+ Sem = &APFloat::PPCDoubleDouble();
else
break;
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Wed Dec 14 05:57:17 2016
@@ -900,7 +900,7 @@ static Value *valueHasFloatPrecision(Val
if (ConstantFP *Const = dyn_cast<ConstantFP>(Val)) {
APFloat F = Const->getValueAPF();
bool losesInfo;
- (void)F.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
+ (void)F.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven,
&losesInfo);
if (!losesInfo)
return ConstantFP::get(Const->getContext(), F);
@@ -1129,7 +1129,7 @@ Value *LibCallSimplifier::optimizePow(Ca
// We cannot readily convert a non-double type (like float) to a double.
// So we first convert V to something which could be converted to double.
bool ignored;
- V.convert(APFloat::IEEEdouble, APFloat::rmTowardZero, &ignored);
+ V.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &ignored);
// TODO: Should the new instructions propagate the 'fast' flag of the pow()?
Value *FMul = getPow(InnerChain, V.convertToDouble(), B);
Modified: llvm/trunk/unittests/ADT/APFloatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APFloatTest.cpp?rev=289647&r1=289646&r2=289647&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/APFloatTest.cpp (original)
+++ llvm/trunk/unittests/ADT/APFloatTest.cpp Wed Dec 14 05:57:17 2016
@@ -39,20 +39,20 @@ TEST(APFloatTest, isSignaling) {
// positive/negative distinction is included only since the getQNaN/getSNaN
// API provides the option.
APInt payload = APInt::getOneBitSet(4, 2);
- EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle, false).isSignaling());
- EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle, true).isSignaling());
- EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle, false, &payload).isSignaling());
- EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle, true, &payload).isSignaling());
- EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle, false).isSignaling());
- EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle, true).isSignaling());
- EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle, false, &payload).isSignaling());
- EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle, true, &payload).isSignaling());
+ EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), false).isSignaling());
+ EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), true).isSignaling());
+ EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), false, &payload).isSignaling());
+ EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), true, &payload).isSignaling());
+ EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isSignaling());
+ EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), true).isSignaling());
+ EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), false, &payload).isSignaling());
+ EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), true, &payload).isSignaling());
}
TEST(APFloatTest, next) {
- APFloat test(APFloat::IEEEquad, APFloat::uninitialized);
- APFloat expected(APFloat::IEEEquad, APFloat::uninitialized);
+ APFloat test(APFloat::IEEEquad(), APFloat::uninitialized);
+ APFloat expected(APFloat::IEEEquad(), APFloat::uninitialized);
// 1. Test Special Cases Values.
//
@@ -70,37 +70,37 @@ TEST(APFloatTest, next) {
// 10. -0
// nextUp(+inf) = +inf.
- test = APFloat::getInf(APFloat::IEEEquad, false);
- expected = APFloat::getInf(APFloat::IEEEquad, false);
+ test = APFloat::getInf(APFloat::IEEEquad(), false);
+ expected = APFloat::getInf(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isInfinity());
EXPECT_TRUE(!test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+inf) = -nextUp(-inf) = -(-getLargest()) = getLargest()
- test = APFloat::getInf(APFloat::IEEEquad, false);
- expected = APFloat::getLargest(APFloat::IEEEquad, false);
+ test = APFloat::getInf(APFloat::IEEEquad(), false);
+ expected = APFloat::getLargest(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(!test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-inf) = -getLargest()
- test = APFloat::getInf(APFloat::IEEEquad, true);
- expected = APFloat::getLargest(APFloat::IEEEquad, true);
+ test = APFloat::getInf(APFloat::IEEEquad(), true);
+ expected = APFloat::getLargest(APFloat::IEEEquad(), true);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-inf) = -nextUp(+inf) = -(+inf) = -inf.
- test = APFloat::getInf(APFloat::IEEEquad, true);
- expected = APFloat::getInf(APFloat::IEEEquad, true);
+ test = APFloat::getInf(APFloat::IEEEquad(), true);
+ expected = APFloat::getInf(APFloat::IEEEquad(), true);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isInfinity() && test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(getLargest()) = +inf
- test = APFloat::getLargest(APFloat::IEEEquad, false);
- expected = APFloat::getInf(APFloat::IEEEquad, false);
+ test = APFloat::getLargest(APFloat::IEEEquad(), false);
+ expected = APFloat::getInf(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isInfinity() && !test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
@@ -108,100 +108,100 @@ TEST(APFloatTest, next) {
// nextDown(getLargest()) = -nextUp(-getLargest())
// = -(-getLargest() + inc)
// = getLargest() - inc.
- test = APFloat::getLargest(APFloat::IEEEquad, false);
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat::getLargest(APFloat::IEEEquad(), false);
+ expected = APFloat(APFloat::IEEEquad(),
"0x1.fffffffffffffffffffffffffffep+16383");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(!test.isInfinity() && !test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-getLargest()) = -getLargest() + inc.
- test = APFloat::getLargest(APFloat::IEEEquad, true);
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat::getLargest(APFloat::IEEEquad(), true);
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.fffffffffffffffffffffffffffep+16383");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-getLargest()) = -nextUp(getLargest()) = -(inf) = -inf.
- test = APFloat::getLargest(APFloat::IEEEquad, true);
- expected = APFloat::getInf(APFloat::IEEEquad, true);
+ test = APFloat::getLargest(APFloat::IEEEquad(), true);
+ expected = APFloat::getInf(APFloat::IEEEquad(), true);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isInfinity() && test.isNegative());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(getSmallest()) = getSmallest() + inc.
- test = APFloat(APFloat::IEEEquad, "0x0.0000000000000000000000000001p-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"0x0.0000000000000000000000000002p-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(getSmallest()) = -nextUp(-getSmallest()) = -(-0) = +0.
- test = APFloat(APFloat::IEEEquad, "0x0.0000000000000000000000000001p-16382");
- expected = APFloat::getZero(APFloat::IEEEquad, false);
+ test = APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382");
+ expected = APFloat::getZero(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isPosZero());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-getSmallest()) = -0.
- test = APFloat(APFloat::IEEEquad, "-0x0.0000000000000000000000000001p-16382");
- expected = APFloat::getZero(APFloat::IEEEquad, true);
+ test = APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382");
+ expected = APFloat::getZero(APFloat::IEEEquad(), true);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isNegZero());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-getSmallest()) = -nextUp(getSmallest()) = -getSmallest() - inc.
- test = APFloat(APFloat::IEEEquad, "-0x0.0000000000000000000000000001p-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"-0x0.0000000000000000000000000002p-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(qNaN) = qNaN
- test = APFloat::getQNaN(APFloat::IEEEquad, false);
- expected = APFloat::getQNaN(APFloat::IEEEquad, false);
+ test = APFloat::getQNaN(APFloat::IEEEquad(), false);
+ expected = APFloat::getQNaN(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(qNaN) = qNaN
- test = APFloat::getQNaN(APFloat::IEEEquad, false);
- expected = APFloat::getQNaN(APFloat::IEEEquad, false);
+ test = APFloat::getQNaN(APFloat::IEEEquad(), false);
+ expected = APFloat::getQNaN(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(sNaN) = qNaN
- test = APFloat::getSNaN(APFloat::IEEEquad, false);
- expected = APFloat::getQNaN(APFloat::IEEEquad, false);
+ test = APFloat::getSNaN(APFloat::IEEEquad(), false);
+ expected = APFloat::getQNaN(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(false), APFloat::opInvalidOp);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(sNaN) = qNaN
- test = APFloat::getSNaN(APFloat::IEEEquad, false);
- expected = APFloat::getQNaN(APFloat::IEEEquad, false);
+ test = APFloat::getSNaN(APFloat::IEEEquad(), false);
+ expected = APFloat::getQNaN(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(true), APFloat::opInvalidOp);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(+0) = +getSmallest()
- test = APFloat::getZero(APFloat::IEEEquad, false);
- expected = APFloat::getSmallest(APFloat::IEEEquad, false);
+ test = APFloat::getZero(APFloat::IEEEquad(), false);
+ expected = APFloat::getSmallest(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+0) = -nextUp(-0) = -getSmallest()
- test = APFloat::getZero(APFloat::IEEEquad, false);
- expected = APFloat::getSmallest(APFloat::IEEEquad, true);
+ test = APFloat::getZero(APFloat::IEEEquad(), false);
+ expected = APFloat::getSmallest(APFloat::IEEEquad(), true);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-0) = +getSmallest()
- test = APFloat::getZero(APFloat::IEEEquad, true);
- expected = APFloat::getSmallest(APFloat::IEEEquad, false);
+ test = APFloat::getZero(APFloat::IEEEquad(), true);
+ expected = APFloat::getSmallest(APFloat::IEEEquad(), false);
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-0) = -nextUp(0) = -getSmallest()
- test = APFloat::getZero(APFloat::IEEEquad, true);
- expected = APFloat::getSmallest(APFloat::IEEEquad, true);
+ test = APFloat::getZero(APFloat::IEEEquad(), true);
+ expected = APFloat::getSmallest(APFloat::IEEEquad(), true);
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
@@ -214,35 +214,35 @@ TEST(APFloatTest, next) {
// * nextDown(+Smallest Normal) -> +Largest Denormal.
// nextUp(+Largest Denormal) -> +Smallest Normal.
- test = APFloat(APFloat::IEEEquad, "0x0.ffffffffffffffffffffffffffffp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffffffffp-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"0x1.0000000000000000000000000000p-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_FALSE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-Largest Denormal) -> -Smallest Normal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"-0x0.ffffffffffffffffffffffffffffp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.0000000000000000000000000000p-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_FALSE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-Smallest Normal) -> -LargestDenormal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"-0x1.0000000000000000000000000000p-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"-0x0.ffffffffffffffffffffffffffffp-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+Smallest Normal) -> +Largest Denormal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"+0x1.0000000000000000000000000000p-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"+0x0.ffffffffffffffffffffffffffffp-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -255,27 +255,27 @@ TEST(APFloatTest, next) {
// * nextDown(-Normal Binade Boundary + 1) -> -Normal Binade Boundary.
// nextUp(-Normal Binade Boundary) -> -Normal Binade Boundary + 1.
- test = APFloat(APFloat::IEEEquad, "-0x1p+1");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "-0x1p+1");
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.ffffffffffffffffffffffffffffp+0");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+Normal Binade Boundary) -> +Normal Binade Boundary - 1.
- test = APFloat(APFloat::IEEEquad, "0x1p+1");
- expected = APFloat(APFloat::IEEEquad, "0x1.ffffffffffffffffffffffffffffp+0");
+ test = APFloat(APFloat::IEEEquad(), "0x1p+1");
+ expected = APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp+0");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(+Normal Binade Boundary - 1) -> +Normal Binade Boundary.
- test = APFloat(APFloat::IEEEquad, "0x1.ffffffffffffffffffffffffffffp+0");
- expected = APFloat(APFloat::IEEEquad, "0x1p+1");
+ test = APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp+0");
+ expected = APFloat(APFloat::IEEEquad(), "0x1p+1");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-Normal Binade Boundary + 1) -> -Normal Binade Boundary.
- test = APFloat(APFloat::IEEEquad, "-0x1.ffffffffffffffffffffffffffffp+0");
- expected = APFloat(APFloat::IEEEquad, "-0x1p+1");
+ test = APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffffffffp+0");
+ expected = APFloat(APFloat::IEEEquad(), "-0x1p+1");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
@@ -291,8 +291,8 @@ TEST(APFloatTest, next) {
// * nextDown(-Smallest Normal) -> -Smallest Normal - inc.
// nextUp(-Largest Denormal) -> -Largest Denormal + inc.
- test = APFloat(APFloat::IEEEquad, "-0x0.ffffffffffffffffffffffffffffp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffffffffp-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"-0x0.fffffffffffffffffffffffffffep-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -300,8 +300,8 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+Largest Denormal) -> +Largest Denormal - inc.
- test = APFloat(APFloat::IEEEquad, "0x0.ffffffffffffffffffffffffffffp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffffffffp-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"0x0.fffffffffffffffffffffffffffep-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -309,8 +309,8 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(+Smallest Normal) -> +Smallest Normal + inc.
- test = APFloat(APFloat::IEEEquad, "0x1.0000000000000000000000000000p-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "0x1.0000000000000000000000000000p-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"0x1.0000000000000000000000000001p-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(!test.isDenormal());
@@ -318,8 +318,8 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-Smallest Normal) -> -Smallest Normal - inc.
- test = APFloat(APFloat::IEEEquad, "-0x1.0000000000000000000000000000p-16382");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "-0x1.0000000000000000000000000000p-16382");
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.0000000000000000000000000001p-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(!test.isDenormal());
@@ -336,28 +336,28 @@ TEST(APFloatTest, next) {
// * nextDown(0x1p-16382) -> 0x1.ffffffffffffffffffffffffffffp-16382
// nextUp(-0x1p-16381) -> -0x1.ffffffffffffffffffffffffffffp-16382
- test = APFloat(APFloat::IEEEquad, "-0x1p-16381");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "-0x1p-16381");
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.ffffffffffffffffffffffffffffp-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-0x1.ffffffffffffffffffffffffffffp-16382) ->
// -0x1p-16381
- test = APFloat(APFloat::IEEEquad, "-0x1.ffffffffffffffffffffffffffffp-16382");
- expected = APFloat(APFloat::IEEEquad, "-0x1p-16381");
+ test = APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffffffffp-16382");
+ expected = APFloat(APFloat::IEEEquad(), "-0x1p-16381");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(0x1.ffffffffffffffffffffffffffffp-16382) -> 0x1p-16381
- test = APFloat(APFloat::IEEEquad, "0x1.ffffffffffffffffffffffffffffp-16382");
- expected = APFloat(APFloat::IEEEquad, "0x1p-16381");
+ test = APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp-16382");
+ expected = APFloat(APFloat::IEEEquad(), "0x1p-16381");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(0x1p-16381) -> 0x1.ffffffffffffffffffffffffffffp-16382
- test = APFloat(APFloat::IEEEquad, "0x1p-16381");
- expected = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(), "0x1p-16381");
+ expected = APFloat(APFloat::IEEEquad(),
"0x1.ffffffffffffffffffffffffffffp-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.bitwiseIsEqual(expected));
@@ -374,9 +374,9 @@ TEST(APFloatTest, next) {
// * nextDown(-Normal) -> -Normal.
// nextUp(+Denormal) -> +Denormal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"0x0.ffffffffffffffffffffffff000cp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"0x0.ffffffffffffffffffffffff000dp-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -384,9 +384,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+Denormal) -> +Denormal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"0x0.ffffffffffffffffffffffff000cp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"0x0.ffffffffffffffffffffffff000bp-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -394,9 +394,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-Denormal) -> -Denormal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"-0x0.ffffffffffffffffffffffff000cp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"-0x0.ffffffffffffffffffffffff000bp-16382");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -404,9 +404,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-Denormal) -> -Denormal
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"-0x0.ffffffffffffffffffffffff000cp-16382");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"-0x0.ffffffffffffffffffffffff000dp-16382");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(test.isDenormal());
@@ -414,9 +414,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(+Normal) -> +Normal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"0x1.ffffffffffffffffffffffff000cp-16000");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"0x1.ffffffffffffffffffffffff000dp-16000");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(!test.isDenormal());
@@ -424,9 +424,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(+Normal) -> +Normal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"0x1.ffffffffffffffffffffffff000cp-16000");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"0x1.ffffffffffffffffffffffff000bp-16000");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(!test.isDenormal());
@@ -434,9 +434,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextUp(-Normal) -> -Normal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"-0x1.ffffffffffffffffffffffff000cp-16000");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.ffffffffffffffffffffffff000bp-16000");
EXPECT_EQ(test.next(false), APFloat::opOK);
EXPECT_TRUE(!test.isDenormal());
@@ -444,9 +444,9 @@ TEST(APFloatTest, next) {
EXPECT_TRUE(test.bitwiseIsEqual(expected));
// nextDown(-Normal) -> -Normal.
- test = APFloat(APFloat::IEEEquad,
+ test = APFloat(APFloat::IEEEquad(),
"-0x1.ffffffffffffffffffffffff000cp-16000");
- expected = APFloat(APFloat::IEEEquad,
+ expected = APFloat(APFloat::IEEEquad(),
"-0x1.ffffffffffffffffffffffff000dp-16000");
EXPECT_EQ(test.next(true), APFloat::opOK);
EXPECT_TRUE(!test.isDenormal());
@@ -509,8 +509,8 @@ TEST(APFloatTest, FMA) {
// Test -ve sign preservation when small negative results underflow.
{
- APFloat f1(APFloat::IEEEdouble, "-0x1p-1074");
- APFloat f2(APFloat::IEEEdouble, "+0x1p-1074");
+ APFloat f1(APFloat::IEEEdouble(), "-0x1p-1074");
+ APFloat f2(APFloat::IEEEdouble(), "+0x1p-1074");
APFloat f3(0.0);
f1.fusedMultiplyAdd(f2, f3, APFloat::rmNearestTiesToEven);
EXPECT_TRUE(f1.isNegative() && f1.isZero());
@@ -518,13 +518,13 @@ TEST(APFloatTest, FMA) {
// Test x87 extended precision case from http://llvm.org/PR20728.
{
- APFloat M1(APFloat::x87DoubleExtended, 1.0);
- APFloat M2(APFloat::x87DoubleExtended, 1.0);
- APFloat A(APFloat::x87DoubleExtended, 3.0);
+ APFloat M1(APFloat::x87DoubleExtended(), 1.0);
+ APFloat M2(APFloat::x87DoubleExtended(), 1.0);
+ APFloat A(APFloat::x87DoubleExtended(), 3.0);
bool losesInfo = false;
M1.fusedMultiplyAdd(M1, A, APFloat::rmNearestTiesToEven);
- M1.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &losesInfo);
+ M1.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &losesInfo);
EXPECT_FALSE(losesInfo);
EXPECT_EQ(4.0f, M1.convertToFloat());
}
@@ -533,7 +533,7 @@ TEST(APFloatTest, FMA) {
TEST(APFloatTest, MinNum) {
APFloat f1(1.0);
APFloat f2(2.0);
- APFloat nan = APFloat::getNaN(APFloat::IEEEdouble);
+ APFloat nan = APFloat::getNaN(APFloat::IEEEdouble());
EXPECT_EQ(1.0, minnum(f1, f2).convertToDouble());
EXPECT_EQ(1.0, minnum(f2, f1).convertToDouble());
@@ -544,7 +544,7 @@ TEST(APFloatTest, MinNum) {
TEST(APFloatTest, MaxNum) {
APFloat f1(1.0);
APFloat f2(2.0);
- APFloat nan = APFloat::getNaN(APFloat::IEEEdouble);
+ APFloat nan = APFloat::getNaN(APFloat::IEEEdouble());
EXPECT_EQ(2.0, maxnum(f1, f2).convertToDouble());
EXPECT_EQ(2.0, maxnum(f2, f1).convertToDouble());
@@ -558,11 +558,11 @@ TEST(APFloatTest, Denormal) {
// Test single precision
{
const char *MinNormalStr = "1.17549435082228750797e-38";
- EXPECT_FALSE(APFloat(APFloat::IEEEsingle, MinNormalStr).isDenormal());
- EXPECT_FALSE(APFloat(APFloat::IEEEsingle, 0.0).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEsingle(), MinNormalStr).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEsingle(), 0.0).isDenormal());
- APFloat Val2(APFloat::IEEEsingle, 2.0e0);
- APFloat T(APFloat::IEEEsingle, MinNormalStr);
+ APFloat Val2(APFloat::IEEEsingle(), 2.0e0);
+ APFloat T(APFloat::IEEEsingle(), MinNormalStr);
T.divide(Val2, rdmd);
EXPECT_TRUE(T.isDenormal());
}
@@ -570,11 +570,11 @@ TEST(APFloatTest, Denormal) {
// Test double precision
{
const char *MinNormalStr = "2.22507385850720138309e-308";
- EXPECT_FALSE(APFloat(APFloat::IEEEdouble, MinNormalStr).isDenormal());
- EXPECT_FALSE(APFloat(APFloat::IEEEdouble, 0.0).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEdouble(), MinNormalStr).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEdouble(), 0.0).isDenormal());
- APFloat Val2(APFloat::IEEEdouble, 2.0e0);
- APFloat T(APFloat::IEEEdouble, MinNormalStr);
+ APFloat Val2(APFloat::IEEEdouble(), 2.0e0);
+ APFloat T(APFloat::IEEEdouble(), MinNormalStr);
T.divide(Val2, rdmd);
EXPECT_TRUE(T.isDenormal());
}
@@ -582,11 +582,11 @@ TEST(APFloatTest, Denormal) {
// Test Intel double-ext
{
const char *MinNormalStr = "3.36210314311209350626e-4932";
- EXPECT_FALSE(APFloat(APFloat::x87DoubleExtended, MinNormalStr).isDenormal());
- EXPECT_FALSE(APFloat(APFloat::x87DoubleExtended, 0.0).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::x87DoubleExtended(), MinNormalStr).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::x87DoubleExtended(), 0.0).isDenormal());
- APFloat Val2(APFloat::x87DoubleExtended, 2.0e0);
- APFloat T(APFloat::x87DoubleExtended, MinNormalStr);
+ APFloat Val2(APFloat::x87DoubleExtended(), 2.0e0);
+ APFloat T(APFloat::x87DoubleExtended(), MinNormalStr);
T.divide(Val2, rdmd);
EXPECT_TRUE(T.isDenormal());
}
@@ -594,11 +594,11 @@ TEST(APFloatTest, Denormal) {
// Test quadruple precision
{
const char *MinNormalStr = "3.36210314311209350626267781732175260e-4932";
- EXPECT_FALSE(APFloat(APFloat::IEEEquad, MinNormalStr).isDenormal());
- EXPECT_FALSE(APFloat(APFloat::IEEEquad, 0.0).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEquad(), MinNormalStr).isDenormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEquad(), 0.0).isDenormal());
- APFloat Val2(APFloat::IEEEquad, 2.0e0);
- APFloat T(APFloat::IEEEquad, MinNormalStr);
+ APFloat Val2(APFloat::IEEEquad(), 2.0e0);
+ APFloat T(APFloat::IEEEquad(), MinNormalStr);
T.divide(Val2, rdmd);
EXPECT_TRUE(T.isDenormal());
}
@@ -617,7 +617,7 @@ TEST(APFloatTest, Zero) {
TEST(APFloatTest, DecimalStringsWithoutNullTerminators) {
// Make sure that we can parse strings without null terminators.
// rdar://14323230.
- APFloat Val(APFloat::IEEEdouble);
+ APFloat Val(APFloat::IEEEdouble());
Val.convertFromString(StringRef("0.00", 3),
llvm::APFloat::rmNearestTiesToEven);
EXPECT_EQ(Val.convertToDouble(), 0.0);
@@ -640,292 +640,292 @@ TEST(APFloatTest, DecimalStringsWithoutN
}
TEST(APFloatTest, fromZeroDecimalString) {
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "00000.").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+00000.").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-00000.").convertToDouble());
-
- EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, ".00000").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.00000").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.00000").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0000.00000").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0000.00000").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0000.00000").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "00000.").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+00000.").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-00000.").convertToDouble());
+
+ EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".00000").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.00000").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.00000").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0000.00000").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0000.00000").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0000.00000").convertToDouble());
}
TEST(APFloatTest, fromZeroDecimalSingleExponentString) {
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.e1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.e1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.e1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.e1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.e+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.e+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.e+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.e+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.e-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.e-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.e-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.e-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0e1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0e1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0e1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0e1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0e+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0e+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0e+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0e+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0e-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0e-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0e-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0e-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0e1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0e1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0e1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0e1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0e+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0e+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0e+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0e+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0e-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0e-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0e-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0e-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "000.0000e1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+000.0000e+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-000.0000e+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "000.0000e1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+000.0000e+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-000.0000e+1").convertToDouble());
}
TEST(APFloatTest, fromZeroDecimalLargeExponentString) {
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e1234").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e1234").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e1234").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e+1234").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e+1234").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e+1234").convertToDouble());
-
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e-1234").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e-1234").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e-1234").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e1234").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e1234").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e1234").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e+1234").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e+1234").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e+1234").convertToDouble());
+
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e-1234").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e-1234").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e-1234").convertToDouble());
- EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e1234").convertToDouble());
- EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e-1234").convertToDouble());
+ EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "000.0000e1234").convertToDouble());
+ EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "000.0000e-1234").convertToDouble());
- EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1234\02", 6)).convertToDouble());
+ EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), StringRef("0e1234\02", 6)).convertToDouble());
}
TEST(APFloatTest, fromZeroHexadecimalString) {
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0p1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0p1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0p+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0p+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0p-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0p-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.p1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.p1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.p+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.p+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.p+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.p+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.p-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.p-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.p-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.p-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.0p1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x.0p1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x.0p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.0p1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x.0p1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x.0p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.0p+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x.0p+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x.0p+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.0p+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x.0p+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x.0p+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.0p-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x.0p-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x.0p-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.0p-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x.0p-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x.0p-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.0p1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.0p1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.0p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.0p1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.0p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.0p+1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.0p+1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.0p+1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p+1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.0p+1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.0p+1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.0p-1").convertToDouble());
- EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.0p-1").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.0p-1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p-1").convertToDouble());
+ EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.0p-1").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.0p-1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p1").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p1234").convertToDouble());
- EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1234").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1234").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1234").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1234").convertToDouble());
- EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p1234").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x00000.p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0000.00000p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.00000p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p1234").convertToDouble());
+ EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p1234").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x00000.p1234").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0000.00000p1234").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.00000p1234").convertToDouble());
+ EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1234").convertToDouble());
}
TEST(APFloatTest, fromDecimalString) {
- EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "1").convertToDouble());
- EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble, "2.").convertToDouble());
- EXPECT_EQ(0.5, APFloat(APFloat::IEEEdouble, ".5").convertToDouble());
- EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "1.0").convertToDouble());
- EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble, "-2").convertToDouble());
- EXPECT_EQ(-4.0, APFloat(APFloat::IEEEdouble, "-4.").convertToDouble());
- EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble, "-.5").convertToDouble());
- EXPECT_EQ(-1.5, APFloat(APFloat::IEEEdouble, "-1.5").convertToDouble());
- EXPECT_EQ(1.25e12, APFloat(APFloat::IEEEdouble, "1.25e12").convertToDouble());
- EXPECT_EQ(1.25e+12, APFloat(APFloat::IEEEdouble, "1.25e+12").convertToDouble());
- EXPECT_EQ(1.25e-12, APFloat(APFloat::IEEEdouble, "1.25e-12").convertToDouble());
- EXPECT_EQ(1024.0, APFloat(APFloat::IEEEdouble, "1024.").convertToDouble());
- EXPECT_EQ(1024.05, APFloat(APFloat::IEEEdouble, "1024.05000").convertToDouble());
- EXPECT_EQ(0.05, APFloat(APFloat::IEEEdouble, ".05000").convertToDouble());
- EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble, "2.").convertToDouble());
- EXPECT_EQ(2.0e2, APFloat(APFloat::IEEEdouble, "2.e2").convertToDouble());
- EXPECT_EQ(2.0e+2, APFloat(APFloat::IEEEdouble, "2.e+2").convertToDouble());
- EXPECT_EQ(2.0e-2, APFloat(APFloat::IEEEdouble, "2.e-2").convertToDouble());
- EXPECT_EQ(2.05e2, APFloat(APFloat::IEEEdouble, "002.05000e2").convertToDouble());
- EXPECT_EQ(2.05e+2, APFloat(APFloat::IEEEdouble, "002.05000e+2").convertToDouble());
- EXPECT_EQ(2.05e-2, APFloat(APFloat::IEEEdouble, "002.05000e-2").convertToDouble());
- EXPECT_EQ(2.05e12, APFloat(APFloat::IEEEdouble, "002.05000e12").convertToDouble());
- EXPECT_EQ(2.05e+12, APFloat(APFloat::IEEEdouble, "002.05000e+12").convertToDouble());
- EXPECT_EQ(2.05e-12, APFloat(APFloat::IEEEdouble, "002.05000e-12").convertToDouble());
+ EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1").convertToDouble());
+ EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "2.").convertToDouble());
+ EXPECT_EQ(0.5, APFloat(APFloat::IEEEdouble(), ".5").convertToDouble());
+ EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0").convertToDouble());
+ EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-2").convertToDouble());
+ EXPECT_EQ(-4.0, APFloat(APFloat::IEEEdouble(), "-4.").convertToDouble());
+ EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble(), "-.5").convertToDouble());
+ EXPECT_EQ(-1.5, APFloat(APFloat::IEEEdouble(), "-1.5").convertToDouble());
+ EXPECT_EQ(1.25e12, APFloat(APFloat::IEEEdouble(), "1.25e12").convertToDouble());
+ EXPECT_EQ(1.25e+12, APFloat(APFloat::IEEEdouble(), "1.25e+12").convertToDouble());
+ EXPECT_EQ(1.25e-12, APFloat(APFloat::IEEEdouble(), "1.25e-12").convertToDouble());
+ EXPECT_EQ(1024.0, APFloat(APFloat::IEEEdouble(), "1024.").convertToDouble());
+ EXPECT_EQ(1024.05, APFloat(APFloat::IEEEdouble(), "1024.05000").convertToDouble());
+ EXPECT_EQ(0.05, APFloat(APFloat::IEEEdouble(), ".05000").convertToDouble());
+ EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "2.").convertToDouble());
+ EXPECT_EQ(2.0e2, APFloat(APFloat::IEEEdouble(), "2.e2").convertToDouble());
+ EXPECT_EQ(2.0e+2, APFloat(APFloat::IEEEdouble(), "2.e+2").convertToDouble());
+ EXPECT_EQ(2.0e-2, APFloat(APFloat::IEEEdouble(), "2.e-2").convertToDouble());
+ EXPECT_EQ(2.05e2, APFloat(APFloat::IEEEdouble(), "002.05000e2").convertToDouble());
+ EXPECT_EQ(2.05e+2, APFloat(APFloat::IEEEdouble(), "002.05000e+2").convertToDouble());
+ EXPECT_EQ(2.05e-2, APFloat(APFloat::IEEEdouble(), "002.05000e-2").convertToDouble());
+ EXPECT_EQ(2.05e12, APFloat(APFloat::IEEEdouble(), "002.05000e12").convertToDouble());
+ EXPECT_EQ(2.05e+12, APFloat(APFloat::IEEEdouble(), "002.05000e+12").convertToDouble());
+ EXPECT_EQ(2.05e-12, APFloat(APFloat::IEEEdouble(), "002.05000e-12").convertToDouble());
// These are "carefully selected" to overflow the fast log-base
// calculations in APFloat.cpp
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "99e99999").isInfinity());
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-99e99999").isInfinity());
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "1e-99999").isPosZero());
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-1e-99999").isNegZero());
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "99e99999").isInfinity());
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-99e99999").isInfinity());
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "1e-99999").isPosZero());
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-1e-99999").isNegZero());
EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828"));
}
TEST(APFloatTest, fromHexadecimalString) {
- EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble());
- EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble, "+0x1p0").convertToDouble());
- EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble, "-0x1p0").convertToDouble());
+ EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble(), "0x1p0").convertToDouble());
+ EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble(), "+0x1p0").convertToDouble());
+ EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-0x1p0").convertToDouble());
- EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble, "0x1p+0").convertToDouble());
- EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble, "+0x1p+0").convertToDouble());
- EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble, "-0x1p+0").convertToDouble());
+ EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble(), "0x1p+0").convertToDouble());
+ EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble(), "+0x1p+0").convertToDouble());
+ EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-0x1p+0").convertToDouble());
- EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble, "0x1p-0").convertToDouble());
- EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble, "+0x1p-0").convertToDouble());
- EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble, "-0x1p-0").convertToDouble());
+ EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble(), "0x1p-0").convertToDouble());
+ EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble(), "+0x1p-0").convertToDouble());
+ EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-0x1p-0").convertToDouble());
- EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble, "0x1p1").convertToDouble());
- EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble, "+0x1p1").convertToDouble());
- EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble, "-0x1p1").convertToDouble());
+ EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble(), "0x1p1").convertToDouble());
+ EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble(), "+0x1p1").convertToDouble());
+ EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-0x1p1").convertToDouble());
- EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble, "0x1p+1").convertToDouble());
- EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble, "+0x1p+1").convertToDouble());
- EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble, "-0x1p+1").convertToDouble());
+ EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble(), "0x1p+1").convertToDouble());
+ EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble(), "+0x1p+1").convertToDouble());
+ EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-0x1p+1").convertToDouble());
- EXPECT_EQ( 0.5, APFloat(APFloat::IEEEdouble, "0x1p-1").convertToDouble());
- EXPECT_EQ(+0.5, APFloat(APFloat::IEEEdouble, "+0x1p-1").convertToDouble());
- EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble, "-0x1p-1").convertToDouble());
+ EXPECT_EQ( 0.5, APFloat(APFloat::IEEEdouble(), "0x1p-1").convertToDouble());
+ EXPECT_EQ(+0.5, APFloat(APFloat::IEEEdouble(), "+0x1p-1").convertToDouble());
+ EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble(), "-0x1p-1").convertToDouble());
- EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble, "0x1.8p1").convertToDouble());
- EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble, "+0x1.8p1").convertToDouble());
- EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble, "-0x1.8p1").convertToDouble());
+ EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble(), "0x1.8p1").convertToDouble());
+ EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble(), "+0x1.8p1").convertToDouble());
+ EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble(), "-0x1.8p1").convertToDouble());
- EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble, "0x1.8p+1").convertToDouble());
- EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble, "+0x1.8p+1").convertToDouble());
- EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble, "-0x1.8p+1").convertToDouble());
+ EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble(), "0x1.8p+1").convertToDouble());
+ EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble(), "+0x1.8p+1").convertToDouble());
+ EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble(), "-0x1.8p+1").convertToDouble());
- EXPECT_EQ( 0.75, APFloat(APFloat::IEEEdouble, "0x1.8p-1").convertToDouble());
- EXPECT_EQ(+0.75, APFloat(APFloat::IEEEdouble, "+0x1.8p-1").convertToDouble());
- EXPECT_EQ(-0.75, APFloat(APFloat::IEEEdouble, "-0x1.8p-1").convertToDouble());
+ EXPECT_EQ( 0.75, APFloat(APFloat::IEEEdouble(), "0x1.8p-1").convertToDouble());
+ EXPECT_EQ(+0.75, APFloat(APFloat::IEEEdouble(), "+0x1.8p-1").convertToDouble());
+ EXPECT_EQ(-0.75, APFloat(APFloat::IEEEdouble(), "-0x1.8p-1").convertToDouble());
- EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000.000p1").convertToDouble());
- EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000.000p1").convertToDouble());
- EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000.000p1").convertToDouble());
+ EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000.000p1").convertToDouble());
+ EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000.000p1").convertToDouble());
+ EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000.000p1").convertToDouble());
- EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000.000p+1").convertToDouble());
- EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000.000p+1").convertToDouble());
- EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000.000p+1").convertToDouble());
+ EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000.000p+1").convertToDouble());
+ EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000.000p+1").convertToDouble());
+ EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000.000p+1").convertToDouble());
- EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble, "0x1000.000p-1").convertToDouble());
- EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble, "+0x1000.000p-1").convertToDouble());
- EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble, "-0x1000.000p-1").convertToDouble());
+ EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble(), "0x1000.000p-1").convertToDouble());
+ EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble(), "+0x1000.000p-1").convertToDouble());
+ EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble(), "-0x1000.000p-1").convertToDouble());
- EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000p1").convertToDouble());
- EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000p1").convertToDouble());
- EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000p1").convertToDouble());
+ EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000p1").convertToDouble());
+ EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000p1").convertToDouble());
+ EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000p1").convertToDouble());
- EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000p+1").convertToDouble());
- EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000p+1").convertToDouble());
- EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000p+1").convertToDouble());
+ EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000p+1").convertToDouble());
+ EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000p+1").convertToDouble());
+ EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000p+1").convertToDouble());
- EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble, "0x1000p-1").convertToDouble());
- EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble, "+0x1000p-1").convertToDouble());
- EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble, "-0x1000p-1").convertToDouble());
+ EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble(), "0x1000p-1").convertToDouble());
+ EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble(), "+0x1000p-1").convertToDouble());
+ EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble(), "-0x1000p-1").convertToDouble());
- EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble, "0x10p10").convertToDouble());
- EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble, "+0x10p10").convertToDouble());
- EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble, "-0x10p10").convertToDouble());
+ EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble(), "0x10p10").convertToDouble());
+ EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble(), "+0x10p10").convertToDouble());
+ EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble(), "-0x10p10").convertToDouble());
- EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble, "0x10p+10").convertToDouble());
- EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble, "+0x10p+10").convertToDouble());
- EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble, "-0x10p+10").convertToDouble());
+ EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble(), "0x10p+10").convertToDouble());
+ EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble(), "+0x10p+10").convertToDouble());
+ EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble(), "-0x10p+10").convertToDouble());
- EXPECT_EQ( 0.015625, APFloat(APFloat::IEEEdouble, "0x10p-10").convertToDouble());
- EXPECT_EQ(+0.015625, APFloat(APFloat::IEEEdouble, "+0x10p-10").convertToDouble());
- EXPECT_EQ(-0.015625, APFloat(APFloat::IEEEdouble, "-0x10p-10").convertToDouble());
+ EXPECT_EQ( 0.015625, APFloat(APFloat::IEEEdouble(), "0x10p-10").convertToDouble());
+ EXPECT_EQ(+0.015625, APFloat(APFloat::IEEEdouble(), "+0x10p-10").convertToDouble());
+ EXPECT_EQ(-0.015625, APFloat(APFloat::IEEEdouble(), "-0x10p-10").convertToDouble());
- EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble, "0x1.1p0").convertToDouble());
- EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble());
+ EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble(), "0x1.1p0").convertToDouble());
+ EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "0x1p0").convertToDouble());
EXPECT_EQ(convertToDoubleFromString("0x1p-150"),
convertToDoubleFromString("+0x800000000000000001.p-221"));
@@ -954,44 +954,44 @@ TEST(APFloatTest, toInteger) {
APSInt result(5, /*isUnsigned=*/true);
EXPECT_EQ(APFloat::opOK,
- APFloat(APFloat::IEEEdouble, "10")
+ APFloat(APFloat::IEEEdouble(), "10")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_TRUE(isExact);
EXPECT_EQ(APSInt(APInt(5, 10), true), result);
EXPECT_EQ(APFloat::opInvalidOp,
- APFloat(APFloat::IEEEdouble, "-10")
+ APFloat(APFloat::IEEEdouble(), "-10")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_FALSE(isExact);
EXPECT_EQ(APSInt::getMinValue(5, true), result);
EXPECT_EQ(APFloat::opInvalidOp,
- APFloat(APFloat::IEEEdouble, "32")
+ APFloat(APFloat::IEEEdouble(), "32")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_FALSE(isExact);
EXPECT_EQ(APSInt::getMaxValue(5, true), result);
EXPECT_EQ(APFloat::opInexact,
- APFloat(APFloat::IEEEdouble, "7.9")
+ APFloat(APFloat::IEEEdouble(), "7.9")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_FALSE(isExact);
EXPECT_EQ(APSInt(APInt(5, 7), true), result);
result.setIsUnsigned(false);
EXPECT_EQ(APFloat::opOK,
- APFloat(APFloat::IEEEdouble, "-10")
+ APFloat(APFloat::IEEEdouble(), "-10")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_TRUE(isExact);
EXPECT_EQ(APSInt(APInt(5, -10, true), false), result);
EXPECT_EQ(APFloat::opInvalidOp,
- APFloat(APFloat::IEEEdouble, "-17")
+ APFloat(APFloat::IEEEdouble(), "-17")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_FALSE(isExact);
EXPECT_EQ(APSInt::getMinValue(5, false), result);
EXPECT_EQ(APFloat::opInvalidOp,
- APFloat(APFloat::IEEEdouble, "16")
+ APFloat(APFloat::IEEEdouble(), "16")
.convertToInteger(result, APFloat::rmTowardZero, &isExact));
EXPECT_FALSE(isExact);
EXPECT_EQ(APSInt::getMaxValue(5, false), result);
@@ -1007,224 +1007,224 @@ static APInt nanbits(const fltSemantics
}
TEST(APFloatTest, makeNaN) {
- ASSERT_EQ(0x7fc00000, nanbits(APFloat::IEEEsingle, false, false, 0));
- ASSERT_EQ(0xffc00000, nanbits(APFloat::IEEEsingle, false, true, 0));
- ASSERT_EQ(0x7fc0ae72, nanbits(APFloat::IEEEsingle, false, false, 0xae72));
- ASSERT_EQ(0x7fffae72, nanbits(APFloat::IEEEsingle, false, false, 0xffffae72));
- ASSERT_EQ(0x7fa00000, nanbits(APFloat::IEEEsingle, true, false, 0));
- ASSERT_EQ(0xffa00000, nanbits(APFloat::IEEEsingle, true, true, 0));
- ASSERT_EQ(0x7f80ae72, nanbits(APFloat::IEEEsingle, true, false, 0xae72));
- ASSERT_EQ(0x7fbfae72, nanbits(APFloat::IEEEsingle, true, false, 0xffffae72));
-
- ASSERT_EQ(0x7ff8000000000000ULL, nanbits(APFloat::IEEEdouble, false, false, 0));
- ASSERT_EQ(0xfff8000000000000ULL, nanbits(APFloat::IEEEdouble, false, true, 0));
- ASSERT_EQ(0x7ff800000000ae72ULL, nanbits(APFloat::IEEEdouble, false, false, 0xae72));
- ASSERT_EQ(0x7fffffffffffae72ULL, nanbits(APFloat::IEEEdouble, false, false, 0xffffffffffffae72ULL));
- ASSERT_EQ(0x7ff4000000000000ULL, nanbits(APFloat::IEEEdouble, true, false, 0));
- ASSERT_EQ(0xfff4000000000000ULL, nanbits(APFloat::IEEEdouble, true, true, 0));
- ASSERT_EQ(0x7ff000000000ae72ULL, nanbits(APFloat::IEEEdouble, true, false, 0xae72));
- ASSERT_EQ(0x7ff7ffffffffae72ULL, nanbits(APFloat::IEEEdouble, true, false, 0xffffffffffffae72ULL));
+ ASSERT_EQ(0x7fc00000, nanbits(APFloat::IEEEsingle(), false, false, 0));
+ ASSERT_EQ(0xffc00000, nanbits(APFloat::IEEEsingle(), false, true, 0));
+ ASSERT_EQ(0x7fc0ae72, nanbits(APFloat::IEEEsingle(), false, false, 0xae72));
+ ASSERT_EQ(0x7fffae72, nanbits(APFloat::IEEEsingle(), false, false, 0xffffae72));
+ ASSERT_EQ(0x7fa00000, nanbits(APFloat::IEEEsingle(), true, false, 0));
+ ASSERT_EQ(0xffa00000, nanbits(APFloat::IEEEsingle(), true, true, 0));
+ ASSERT_EQ(0x7f80ae72, nanbits(APFloat::IEEEsingle(), true, false, 0xae72));
+ ASSERT_EQ(0x7fbfae72, nanbits(APFloat::IEEEsingle(), true, false, 0xffffae72));
+
+ ASSERT_EQ(0x7ff8000000000000ULL, nanbits(APFloat::IEEEdouble(), false, false, 0));
+ ASSERT_EQ(0xfff8000000000000ULL, nanbits(APFloat::IEEEdouble(), false, true, 0));
+ ASSERT_EQ(0x7ff800000000ae72ULL, nanbits(APFloat::IEEEdouble(), false, false, 0xae72));
+ ASSERT_EQ(0x7fffffffffffae72ULL, nanbits(APFloat::IEEEdouble(), false, false, 0xffffffffffffae72ULL));
+ ASSERT_EQ(0x7ff4000000000000ULL, nanbits(APFloat::IEEEdouble(), true, false, 0));
+ ASSERT_EQ(0xfff4000000000000ULL, nanbits(APFloat::IEEEdouble(), true, true, 0));
+ ASSERT_EQ(0x7ff000000000ae72ULL, nanbits(APFloat::IEEEdouble(), true, false, 0xae72));
+ ASSERT_EQ(0x7ff7ffffffffae72ULL, nanbits(APFloat::IEEEdouble(), true, false, 0xffffffffffffae72ULL));
}
#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST(APFloatTest, SemanticsDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEsingle, 0.0f).convertToDouble(), "Float semantics are not IEEEdouble");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, 0.0 ).convertToFloat(), "Float semantics are not IEEEsingle");
+ EXPECT_DEATH(APFloat(APFloat::IEEEsingle(), 0.0f).convertToDouble(), "Float semantics are not IEEEdouble");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), 0.0 ).convertToFloat(), "Float semantics are not IEEEsingle");
}
TEST(APFloatTest, StringDecimalDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ""), "Invalid string length");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+"), "String has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-"), "String has no digits");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("\0", 1)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\0", 2)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02", 3)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02e1", 5)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e\0", 3)), "Invalid character in exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\0", 4)), "Invalid character in exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\02", 5)), "Invalid character in exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0f"), "Invalid character in significand");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".."), "String contains multiple dots");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "..0"), "String contains multiple dots");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0.0"), "String contains multiple dots");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ""), "Invalid string length");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+"), "String has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-"), "String has no digits");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("\0", 1)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("1\0", 2)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("1\02", 3)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("1\02e1", 5)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("1e\0", 3)), "Invalid character in exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("1e1\0", 4)), "Invalid character in exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("1e1\02", 5)), "Invalid character in exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0f"), "Invalid character in significand");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".."), "String contains multiple dots");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "..0"), "String contains multiple dots");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0.0"), "String contains multiple dots");
}
TEST(APFloatTest, StringDecimalSignificandDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "."), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+."), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-."), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "."), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+."), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-."), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "e"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+e"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-e"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "e"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+e"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-e"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "e1"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+e1"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-e1"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "e1"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+e1"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-e1"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".e1"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+.e1"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-.e1"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".e1"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+.e1"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-.e1"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".e"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+.e"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-.e"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".e"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+.e"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-.e"), "Significand has no digits");
}
TEST(APFloatTest, StringDecimalExponentDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+1.e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-1.e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+1.e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-1.e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+.1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-.1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+.1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-.1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+1.1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-1.1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+1.1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-1.1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1e+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1e-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1e+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1e-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".1e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".1e+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), ".1e-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0e"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0e+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0e-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0e"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0e+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "1.0e-"), "Exponent has no digits");
}
TEST(APFloatTest, StringHexadecimalDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x"), "Invalid string");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x"), "Invalid string");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x"), "Invalid string");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0"), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x0"), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x0"), "Hex strings require an exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0."), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x0."), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x0."), "Hex strings require an exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.0"), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.0"), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.0"), "Hex strings require an exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0.0"), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x0.0"), "Hex strings require an exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x0.0"), "Hex strings require an exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x\0", 3)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\0", 4)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02", 5)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02p1", 7)), "Invalid character in significand");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p\0", 5)), "Invalid character in exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\0", 6)), "Invalid character in exponent");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\02", 7)), "Invalid character in exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p0f"), "Invalid character in exponent");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x..p1"), "String contains multiple dots");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x..0p1"), "String contains multiple dots");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.0.0p1"), "String contains multiple dots");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x"), "Invalid string");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x"), "Invalid string");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x"), "Invalid string");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x0"), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x0"), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x0"), "Hex strings require an exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x0."), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x0."), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x0."), "Hex strings require an exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.0"), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.0"), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.0"), "Hex strings require an exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x0.0"), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x0.0"), "Hex strings require an exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x0.0"), "Hex strings require an exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x\0", 3)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x1\0", 4)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x1\02", 5)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x1\02p1", 7)), "Invalid character in significand");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x1p\0", 5)), "Invalid character in exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x1p1\0", 6)), "Invalid character in exponent");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), StringRef("0x1p1\02", 7)), "Invalid character in exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1p0f"), "Invalid character in exponent");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x..p1"), "String contains multiple dots");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x..0p1"), "String contains multiple dots");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.0.0p1"), "String contains multiple dots");
}
TEST(APFloatTest, StringHexadecimalSignificandDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x."), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x."), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x."), "Significand has no digits");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0xp"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0xp"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0xp"), "Significand has no digits");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0xp+"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0xp+"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0xp+"), "Significand has no digits");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0xp-"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0xp-"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0xp-"), "Significand has no digits");
-
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.p"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.p"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.p"), "Significand has no digits");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.p+"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.p+"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.p+"), "Significand has no digits");
-
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.p-"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.p-"), "Significand has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.p-"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x."), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x."), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x."), "Significand has no digits");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0xp"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0xp"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0xp"), "Significand has no digits");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0xp+"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0xp+"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0xp+"), "Significand has no digits");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0xp-"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0xp-"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0xp-"), "Significand has no digits");
+
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.p"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.p"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.p"), "Significand has no digits");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.p+"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.p+"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.p+"), "Significand has no digits");
+
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.p-"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.p-"), "Significand has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.p-"), "Significand has no digits");
}
TEST(APFloatTest, StringHexadecimalExponentDeath) {
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1.p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1.p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1.p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1.p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1.p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1.p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x.1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x.1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x.1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1.1p"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1.1p"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1.1p+"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1.1p+"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.1p-"), "Exponent has no digits");
- EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "0x1.1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "+0x1.1p-"), "Exponent has no digits");
+ EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), "-0x1.1p-"), "Exponent has no digits");
}
#endif
#endif
@@ -1237,12 +1237,12 @@ TEST(APFloatTest, exactInverse) {
EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(0.5)));
EXPECT_TRUE(APFloat(2.0f).getExactInverse(&inv));
EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(0.5f)));
- EXPECT_TRUE(APFloat(APFloat::IEEEquad, "2.0").getExactInverse(&inv));
- EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::IEEEquad, "0.5")));
- EXPECT_TRUE(APFloat(APFloat::PPCDoubleDouble, "2.0").getExactInverse(&inv));
- EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::PPCDoubleDouble, "0.5")));
- EXPECT_TRUE(APFloat(APFloat::x87DoubleExtended, "2.0").getExactInverse(&inv));
- EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::x87DoubleExtended, "0.5")));
+ EXPECT_TRUE(APFloat(APFloat::IEEEquad(), "2.0").getExactInverse(&inv));
+ EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::IEEEquad(), "0.5")));
+ EXPECT_TRUE(APFloat(APFloat::PPCDoubleDouble(), "2.0").getExactInverse(&inv));
+ EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::PPCDoubleDouble(), "0.5")));
+ EXPECT_TRUE(APFloat(APFloat::x87DoubleExtended(), "2.0").getExactInverse(&inv));
+ EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::x87DoubleExtended(), "0.5")));
// FLT_MIN
EXPECT_TRUE(APFloat(1.17549435e-38f).getExactInverse(&inv));
@@ -1257,7 +1257,7 @@ TEST(APFloatTest, exactInverse) {
}
TEST(APFloatTest, roundToIntegral) {
- APFloat T(-0.5), S(3.14), R(APFloat::getLargest(APFloat::IEEEdouble)), P(0.0);
+ APFloat T(-0.5), S(3.14), R(APFloat::getLargest(APFloat::IEEEdouble())), P(0.0);
P = T;
P.roundToIntegral(APFloat::rmTowardZero);
@@ -1298,19 +1298,19 @@ TEST(APFloatTest, roundToIntegral) {
P.roundToIntegral(APFloat::rmNearestTiesToEven);
EXPECT_EQ(R.convertToDouble(), P.convertToDouble());
- P = APFloat::getZero(APFloat::IEEEdouble);
+ P = APFloat::getZero(APFloat::IEEEdouble());
P.roundToIntegral(APFloat::rmTowardZero);
EXPECT_EQ(0.0, P.convertToDouble());
- P = APFloat::getZero(APFloat::IEEEdouble, true);
+ P = APFloat::getZero(APFloat::IEEEdouble(), true);
P.roundToIntegral(APFloat::rmTowardZero);
EXPECT_EQ(-0.0, P.convertToDouble());
- P = APFloat::getNaN(APFloat::IEEEdouble);
+ P = APFloat::getNaN(APFloat::IEEEdouble());
P.roundToIntegral(APFloat::rmTowardZero);
EXPECT_TRUE(std::isnan(P.convertToDouble()));
- P = APFloat::getInf(APFloat::IEEEdouble);
+ P = APFloat::getInf(APFloat::IEEEdouble());
P.roundToIntegral(APFloat::rmTowardZero);
EXPECT_TRUE(std::isinf(P.convertToDouble()) && P.convertToDouble() > 0.0);
- P = APFloat::getInf(APFloat::IEEEdouble, true);
+ P = APFloat::getInf(APFloat::IEEEdouble(), true);
P.roundToIntegral(APFloat::rmTowardZero);
EXPECT_TRUE(std::isinf(P.convertToDouble()) && P.convertToDouble() < 0.0);
}
@@ -1320,45 +1320,45 @@ TEST(APFloatTest, isInteger) {
EXPECT_TRUE(T.isInteger());
T = APFloat(3.14159);
EXPECT_FALSE(T.isInteger());
- T = APFloat::getNaN(APFloat::IEEEdouble);
+ T = APFloat::getNaN(APFloat::IEEEdouble());
EXPECT_FALSE(T.isInteger());
- T = APFloat::getInf(APFloat::IEEEdouble);
+ T = APFloat::getInf(APFloat::IEEEdouble());
EXPECT_FALSE(T.isInteger());
- T = APFloat::getInf(APFloat::IEEEdouble, true);
+ T = APFloat::getInf(APFloat::IEEEdouble(), true);
EXPECT_FALSE(T.isInteger());
- T = APFloat::getLargest(APFloat::IEEEdouble);
+ T = APFloat::getLargest(APFloat::IEEEdouble());
EXPECT_TRUE(T.isInteger());
}
TEST(APFloatTest, getLargest) {
- EXPECT_EQ(3.402823466e+38f, APFloat::getLargest(APFloat::IEEEsingle).convertToFloat());
- EXPECT_EQ(1.7976931348623158e+308, APFloat::getLargest(APFloat::IEEEdouble).convertToDouble());
+ EXPECT_EQ(3.402823466e+38f, APFloat::getLargest(APFloat::IEEEsingle()).convertToFloat());
+ EXPECT_EQ(1.7976931348623158e+308, APFloat::getLargest(APFloat::IEEEdouble()).convertToDouble());
}
TEST(APFloatTest, getSmallest) {
- APFloat test = APFloat::getSmallest(APFloat::IEEEsingle, false);
- APFloat expected = APFloat(APFloat::IEEEsingle, "0x0.000002p-126");
+ APFloat test = APFloat::getSmallest(APFloat::IEEEsingle(), false);
+ APFloat expected = APFloat(APFloat::IEEEsingle(), "0x0.000002p-126");
EXPECT_FALSE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_TRUE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
- test = APFloat::getSmallest(APFloat::IEEEsingle, true);
- expected = APFloat(APFloat::IEEEsingle, "-0x0.000002p-126");
+ test = APFloat::getSmallest(APFloat::IEEEsingle(), true);
+ expected = APFloat(APFloat::IEEEsingle(), "-0x0.000002p-126");
EXPECT_TRUE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_TRUE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
- test = APFloat::getSmallest(APFloat::IEEEquad, false);
- expected = APFloat(APFloat::IEEEquad, "0x0.0000000000000000000000000001p-16382");
+ test = APFloat::getSmallest(APFloat::IEEEquad(), false);
+ expected = APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382");
EXPECT_FALSE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_TRUE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
- test = APFloat::getSmallest(APFloat::IEEEquad, true);
- expected = APFloat(APFloat::IEEEquad, "-0x0.0000000000000000000000000001p-16382");
+ test = APFloat::getSmallest(APFloat::IEEEquad(), true);
+ expected = APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382");
EXPECT_TRUE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_TRUE(test.isDenormal());
@@ -1366,29 +1366,29 @@ TEST(APFloatTest, getSmallest) {
}
TEST(APFloatTest, getSmallestNormalized) {
- APFloat test = APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
- APFloat expected = APFloat(APFloat::IEEEsingle, "0x1p-126");
+ APFloat test = APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false);
+ APFloat expected = APFloat(APFloat::IEEEsingle(), "0x1p-126");
EXPECT_FALSE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_FALSE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
- test = APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
- expected = APFloat(APFloat::IEEEsingle, "-0x1p-126");
+ test = APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true);
+ expected = APFloat(APFloat::IEEEsingle(), "-0x1p-126");
EXPECT_TRUE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_FALSE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
- test = APFloat::getSmallestNormalized(APFloat::IEEEquad, false);
- expected = APFloat(APFloat::IEEEquad, "0x1p-16382");
+ test = APFloat::getSmallestNormalized(APFloat::IEEEquad(), false);
+ expected = APFloat(APFloat::IEEEquad(), "0x1p-16382");
EXPECT_FALSE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_FALSE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
- test = APFloat::getSmallestNormalized(APFloat::IEEEquad, true);
- expected = APFloat(APFloat::IEEEquad, "-0x1p-16382");
+ test = APFloat::getSmallestNormalized(APFloat::IEEEquad(), true);
+ expected = APFloat(APFloat::IEEEquad(), "-0x1p-16382");
EXPECT_TRUE(test.isNegative());
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_FALSE(test.isDenormal());
@@ -1402,18 +1402,18 @@ TEST(APFloatTest, getZero) {
const unsigned long long bitPattern[2];
const unsigned bitPatternLength;
} const GetZeroTest[] = {
- { &APFloat::IEEEhalf, false, {0, 0}, 1},
- { &APFloat::IEEEhalf, true, {0x8000ULL, 0}, 1},
- { &APFloat::IEEEsingle, false, {0, 0}, 1},
- { &APFloat::IEEEsingle, true, {0x80000000ULL, 0}, 1},
- { &APFloat::IEEEdouble, false, {0, 0}, 1},
- { &APFloat::IEEEdouble, true, {0x8000000000000000ULL, 0}, 1},
- { &APFloat::IEEEquad, false, {0, 0}, 2},
- { &APFloat::IEEEquad, true, {0, 0x8000000000000000ULL}, 2},
- { &APFloat::PPCDoubleDouble, false, {0, 0}, 2},
- { &APFloat::PPCDoubleDouble, true, {0x8000000000000000ULL, 0}, 2},
- { &APFloat::x87DoubleExtended, false, {0, 0}, 2},
- { &APFloat::x87DoubleExtended, true, {0, 0x8000ULL}, 2},
+ { &APFloat::IEEEhalf(), false, {0, 0}, 1},
+ { &APFloat::IEEEhalf(), true, {0x8000ULL, 0}, 1},
+ { &APFloat::IEEEsingle(), false, {0, 0}, 1},
+ { &APFloat::IEEEsingle(), true, {0x80000000ULL, 0}, 1},
+ { &APFloat::IEEEdouble(), false, {0, 0}, 1},
+ { &APFloat::IEEEdouble(), true, {0x8000000000000000ULL, 0}, 1},
+ { &APFloat::IEEEquad(), false, {0, 0}, 2},
+ { &APFloat::IEEEquad(), true, {0, 0x8000000000000000ULL}, 2},
+ { &APFloat::PPCDoubleDouble(), false, {0, 0}, 2},
+ { &APFloat::PPCDoubleDouble(), true, {0x8000000000000000ULL, 0}, 2},
+ { &APFloat::x87DoubleExtended(), false, {0, 0}, 2},
+ { &APFloat::x87DoubleExtended(), true, {0, 0x8000ULL}, 2},
};
const unsigned NumGetZeroTests = 12;
for (unsigned i = 0; i < NumGetZeroTests; ++i) {
@@ -1445,189 +1445,189 @@ TEST(APFloatTest, copySign) {
TEST(APFloatTest, convert) {
bool losesInfo;
- APFloat test(APFloat::IEEEdouble, "1.0");
- test.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &losesInfo);
+ APFloat test(APFloat::IEEEdouble(), "1.0");
+ test.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &losesInfo);
EXPECT_EQ(1.0f, test.convertToFloat());
EXPECT_FALSE(losesInfo);
- test = APFloat(APFloat::x87DoubleExtended, "0x1p-53");
- test.add(APFloat(APFloat::x87DoubleExtended, "1.0"), APFloat::rmNearestTiesToEven);
- test.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &losesInfo);
+ test = APFloat(APFloat::x87DoubleExtended(), "0x1p-53");
+ test.add(APFloat(APFloat::x87DoubleExtended(), "1.0"), APFloat::rmNearestTiesToEven);
+ test.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &losesInfo);
EXPECT_EQ(1.0, test.convertToDouble());
EXPECT_TRUE(losesInfo);
- test = APFloat(APFloat::IEEEquad, "0x1p-53");
- test.add(APFloat(APFloat::IEEEquad, "1.0"), APFloat::rmNearestTiesToEven);
- test.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &losesInfo);
+ test = APFloat(APFloat::IEEEquad(), "0x1p-53");
+ test.add(APFloat(APFloat::IEEEquad(), "1.0"), APFloat::rmNearestTiesToEven);
+ test.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &losesInfo);
EXPECT_EQ(1.0, test.convertToDouble());
EXPECT_TRUE(losesInfo);
- test = APFloat(APFloat::x87DoubleExtended, "0xf.fffffffp+28");
- test.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &losesInfo);
+ test = APFloat(APFloat::x87DoubleExtended(), "0xf.fffffffp+28");
+ test.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &losesInfo);
EXPECT_EQ(4294967295.0, test.convertToDouble());
EXPECT_FALSE(losesInfo);
- test = APFloat::getSNaN(APFloat::IEEEsingle);
- APFloat X87SNaN = APFloat::getSNaN(APFloat::x87DoubleExtended);
- test.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
+ test = APFloat::getSNaN(APFloat::IEEEsingle());
+ APFloat X87SNaN = APFloat::getSNaN(APFloat::x87DoubleExtended());
+ test.convert(APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven,
&losesInfo);
EXPECT_TRUE(test.bitwiseIsEqual(X87SNaN));
EXPECT_FALSE(losesInfo);
- test = APFloat::getQNaN(APFloat::IEEEsingle);
- APFloat X87QNaN = APFloat::getQNaN(APFloat::x87DoubleExtended);
- test.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
+ test = APFloat::getQNaN(APFloat::IEEEsingle());
+ APFloat X87QNaN = APFloat::getQNaN(APFloat::x87DoubleExtended());
+ test.convert(APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven,
&losesInfo);
EXPECT_TRUE(test.bitwiseIsEqual(X87QNaN));
EXPECT_FALSE(losesInfo);
- test = APFloat::getSNaN(APFloat::x87DoubleExtended);
- test.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
+ test = APFloat::getSNaN(APFloat::x87DoubleExtended());
+ test.convert(APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven,
&losesInfo);
EXPECT_TRUE(test.bitwiseIsEqual(X87SNaN));
EXPECT_FALSE(losesInfo);
- test = APFloat::getQNaN(APFloat::x87DoubleExtended);
- test.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
+ test = APFloat::getQNaN(APFloat::x87DoubleExtended());
+ test.convert(APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven,
&losesInfo);
EXPECT_TRUE(test.bitwiseIsEqual(X87QNaN));
EXPECT_FALSE(losesInfo);
}
TEST(APFloatTest, PPCDoubleDouble) {
- APFloat test(APFloat::PPCDoubleDouble, "1.0");
+ APFloat test(APFloat::PPCDoubleDouble(), "1.0");
EXPECT_EQ(0x3ff0000000000000ull, test.bitcastToAPInt().getRawData()[0]);
EXPECT_EQ(0x0000000000000000ull, test.bitcastToAPInt().getRawData()[1]);
- test.divide(APFloat(APFloat::PPCDoubleDouble, "3.0"), APFloat::rmNearestTiesToEven);
+ test.divide(APFloat(APFloat::PPCDoubleDouble(), "3.0"), APFloat::rmNearestTiesToEven);
EXPECT_EQ(0x3fd5555555555555ull, test.bitcastToAPInt().getRawData()[0]);
EXPECT_EQ(0x3c75555555555556ull, test.bitcastToAPInt().getRawData()[1]);
// LDBL_MAX
- test = APFloat(APFloat::PPCDoubleDouble, "1.79769313486231580793728971405301e+308");
+ test = APFloat(APFloat::PPCDoubleDouble(), "1.79769313486231580793728971405301e+308");
EXPECT_EQ(0x7fefffffffffffffull, test.bitcastToAPInt().getRawData()[0]);
EXPECT_EQ(0x7c8ffffffffffffeull, test.bitcastToAPInt().getRawData()[1]);
// LDBL_MIN
- test = APFloat(APFloat::PPCDoubleDouble, "2.00416836000897277799610805135016e-292");
+ test = APFloat(APFloat::PPCDoubleDouble(), "2.00416836000897277799610805135016e-292");
EXPECT_EQ(0x0360000000000000ull, test.bitcastToAPInt().getRawData()[0]);
EXPECT_EQ(0x0000000000000000ull, test.bitcastToAPInt().getRawData()[1]);
// PR30869
{
- auto Result = APFloat(APFloat::PPCDoubleDouble, "1.0") +
- APFloat(APFloat::PPCDoubleDouble, "1.0");
- EXPECT_EQ(&APFloat::PPCDoubleDouble, &Result.getSemantics());
-
- Result = APFloat(APFloat::PPCDoubleDouble, "1.0") -
- APFloat(APFloat::PPCDoubleDouble, "1.0");
- EXPECT_EQ(&APFloat::PPCDoubleDouble, &Result.getSemantics());
-
- Result = APFloat(APFloat::PPCDoubleDouble, "1.0") *
- APFloat(APFloat::PPCDoubleDouble, "1.0");
- EXPECT_EQ(&APFloat::PPCDoubleDouble, &Result.getSemantics());
-
- Result = APFloat(APFloat::PPCDoubleDouble, "1.0") /
- APFloat(APFloat::PPCDoubleDouble, "1.0");
- EXPECT_EQ(&APFloat::PPCDoubleDouble, &Result.getSemantics());
+ auto Result = APFloat(APFloat::PPCDoubleDouble(), "1.0") +
+ APFloat(APFloat::PPCDoubleDouble(), "1.0");
+ EXPECT_EQ(&APFloat::PPCDoubleDouble(), &Result.getSemantics());
+
+ Result = APFloat(APFloat::PPCDoubleDouble(), "1.0") -
+ APFloat(APFloat::PPCDoubleDouble(), "1.0");
+ EXPECT_EQ(&APFloat::PPCDoubleDouble(), &Result.getSemantics());
+
+ Result = APFloat(APFloat::PPCDoubleDouble(), "1.0") *
+ APFloat(APFloat::PPCDoubleDouble(), "1.0");
+ EXPECT_EQ(&APFloat::PPCDoubleDouble(), &Result.getSemantics());
+
+ Result = APFloat(APFloat::PPCDoubleDouble(), "1.0") /
+ APFloat(APFloat::PPCDoubleDouble(), "1.0");
+ EXPECT_EQ(&APFloat::PPCDoubleDouble(), &Result.getSemantics());
int Exp;
- Result = frexp(APFloat(APFloat::PPCDoubleDouble, "1.0"), Exp,
+ Result = frexp(APFloat(APFloat::PPCDoubleDouble(), "1.0"), Exp,
APFloat::rmNearestTiesToEven);
- EXPECT_EQ(&APFloat::PPCDoubleDouble, &Result.getSemantics());
+ EXPECT_EQ(&APFloat::PPCDoubleDouble(), &Result.getSemantics());
- Result = scalbn(APFloat(APFloat::PPCDoubleDouble, "1.0"), 1,
+ Result = scalbn(APFloat(APFloat::PPCDoubleDouble(), "1.0"), 1,
APFloat::rmNearestTiesToEven);
- EXPECT_EQ(&APFloat::PPCDoubleDouble, &Result.getSemantics());
+ EXPECT_EQ(&APFloat::PPCDoubleDouble(), &Result.getSemantics());
}
}
TEST(APFloatTest, isNegative) {
- APFloat t(APFloat::IEEEsingle, "0x1p+0");
+ APFloat t(APFloat::IEEEsingle(), "0x1p+0");
EXPECT_FALSE(t.isNegative());
- t = APFloat(APFloat::IEEEsingle, "-0x1p+0");
+ t = APFloat(APFloat::IEEEsingle(), "-0x1p+0");
EXPECT_TRUE(t.isNegative());
- EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle, false).isNegative());
- EXPECT_TRUE(APFloat::getInf(APFloat::IEEEsingle, true).isNegative());
+ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), false).isNegative());
+ EXPECT_TRUE(APFloat::getInf(APFloat::IEEEsingle(), true).isNegative());
- EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle, false).isNegative());
- EXPECT_TRUE(APFloat::getZero(APFloat::IEEEsingle, true).isNegative());
+ EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), false).isNegative());
+ EXPECT_TRUE(APFloat::getZero(APFloat::IEEEsingle(), true).isNegative());
- EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle, false).isNegative());
- EXPECT_TRUE(APFloat::getNaN(APFloat::IEEEsingle, true).isNegative());
+ EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle(), false).isNegative());
+ EXPECT_TRUE(APFloat::getNaN(APFloat::IEEEsingle(), true).isNegative());
- EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle, false).isNegative());
- EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle, true).isNegative());
+ EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isNegative());
+ EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), true).isNegative());
}
TEST(APFloatTest, isNormal) {
- APFloat t(APFloat::IEEEsingle, "0x1p+0");
+ APFloat t(APFloat::IEEEsingle(), "0x1p+0");
EXPECT_TRUE(t.isNormal());
- EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle, false).isNormal());
- EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle, false).isNormal());
- EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle, false).isNormal());
- EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle, false).isNormal());
- EXPECT_FALSE(APFloat(APFloat::IEEEsingle, "0x1p-149").isNormal());
+ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), false).isNormal());
+ EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), false).isNormal());
+ EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle(), false).isNormal());
+ EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isNormal());
+ EXPECT_FALSE(APFloat(APFloat::IEEEsingle(), "0x1p-149").isNormal());
}
TEST(APFloatTest, isFinite) {
- APFloat t(APFloat::IEEEsingle, "0x1p+0");
+ APFloat t(APFloat::IEEEsingle(), "0x1p+0");
EXPECT_TRUE(t.isFinite());
- EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle, false).isFinite());
- EXPECT_TRUE(APFloat::getZero(APFloat::IEEEsingle, false).isFinite());
- EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle, false).isFinite());
- EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle, false).isFinite());
- EXPECT_TRUE(APFloat(APFloat::IEEEsingle, "0x1p-149").isFinite());
+ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), false).isFinite());
+ EXPECT_TRUE(APFloat::getZero(APFloat::IEEEsingle(), false).isFinite());
+ EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle(), false).isFinite());
+ EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isFinite());
+ EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "0x1p-149").isFinite());
}
TEST(APFloatTest, isInfinity) {
- APFloat t(APFloat::IEEEsingle, "0x1p+0");
+ APFloat t(APFloat::IEEEsingle(), "0x1p+0");
EXPECT_FALSE(t.isInfinity());
- EXPECT_TRUE(APFloat::getInf(APFloat::IEEEsingle, false).isInfinity());
- EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle, false).isInfinity());
- EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle, false).isInfinity());
- EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle, false).isInfinity());
- EXPECT_FALSE(APFloat(APFloat::IEEEsingle, "0x1p-149").isInfinity());
+ EXPECT_TRUE(APFloat::getInf(APFloat::IEEEsingle(), false).isInfinity());
+ EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), false).isInfinity());
+ EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle(), false).isInfinity());
+ EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isInfinity());
+ EXPECT_FALSE(APFloat(APFloat::IEEEsingle(), "0x1p-149").isInfinity());
}
TEST(APFloatTest, isNaN) {
- APFloat t(APFloat::IEEEsingle, "0x1p+0");
+ APFloat t(APFloat::IEEEsingle(), "0x1p+0");
EXPECT_FALSE(t.isNaN());
- EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle, false).isNaN());
- EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle, false).isNaN());
- EXPECT_TRUE(APFloat::getNaN(APFloat::IEEEsingle, false).isNaN());
- EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle, false).isNaN());
- EXPECT_FALSE(APFloat(APFloat::IEEEsingle, "0x1p-149").isNaN());
+ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), false).isNaN());
+ EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), false).isNaN());
+ EXPECT_TRUE(APFloat::getNaN(APFloat::IEEEsingle(), false).isNaN());
+ EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isNaN());
+ EXPECT_FALSE(APFloat(APFloat::IEEEsingle(), "0x1p-149").isNaN());
}
TEST(APFloatTest, isFiniteNonZero) {
// Test positive/negative normal value.
- EXPECT_TRUE(APFloat(APFloat::IEEEsingle, "0x1p+0").isFiniteNonZero());
- EXPECT_TRUE(APFloat(APFloat::IEEEsingle, "-0x1p+0").isFiniteNonZero());
+ EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "0x1p+0").isFiniteNonZero());
+ EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "-0x1p+0").isFiniteNonZero());
// Test positive/negative denormal value.
- EXPECT_TRUE(APFloat(APFloat::IEEEsingle, "0x1p-149").isFiniteNonZero());
- EXPECT_TRUE(APFloat(APFloat::IEEEsingle, "-0x1p-149").isFiniteNonZero());
+ EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "0x1p-149").isFiniteNonZero());
+ EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "-0x1p-149").isFiniteNonZero());
// Test +/- Infinity.
- EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle, false).isFiniteNonZero());
- EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle, true).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), false).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), true).isFiniteNonZero());
// Test +/- Zero.
- EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle, false).isFiniteNonZero());
- EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle, true).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), false).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), true).isFiniteNonZero());
// Test +/- qNaN. +/- dont mean anything with qNaN but paranoia can't hurt in
// this instance.
- EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle, false).isFiniteNonZero());
- EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle, true).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle(), false).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getNaN(APFloat::IEEEsingle(), true).isFiniteNonZero());
// Test +/- sNaN. +/- dont mean anything with sNaN but paranoia can't hurt in
// this instance.
- EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle, false).isFiniteNonZero());
- EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle, true).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isFiniteNonZero());
+ EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), true).isFiniteNonZero());
}
TEST(APFloatTest, add) {
@@ -1638,22 +1638,22 @@ TEST(APFloatTest, add) {
// signaling NaNs should have a result that is a quiet NaN. Currently they
// return sNaN.
- APFloat PInf = APFloat::getInf(APFloat::IEEEsingle, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEsingle, true);
- APFloat PZero = APFloat::getZero(APFloat::IEEEsingle, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEsingle, true);
- APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle, false);
- APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle, false);
- APFloat PNormalValue = APFloat(APFloat::IEEEsingle, "0x1p+0");
- APFloat MNormalValue = APFloat(APFloat::IEEEsingle, "-0x1p+0");
- APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle, false);
- APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle, true);
- APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, false);
- APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, true);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true);
+ APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
+ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
+ APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0");
+ APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0");
+ APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false);
+ APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), true);
+ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false);
+ APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true);
APFloat PSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false);
APFloat MSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true);
const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact;
@@ -1910,7 +1910,7 @@ TEST(APFloatTest, add) {
APFloat y(SpecialCaseTests[i].y);
APFloat::opStatus status = x.add(y, APFloat::rmNearestTiesToEven);
- APFloat result(APFloat::IEEEsingle, SpecialCaseTests[i].result);
+ APFloat result(APFloat::IEEEsingle(), SpecialCaseTests[i].result);
EXPECT_TRUE(result.bitwiseIsEqual(x));
EXPECT_TRUE((int)status == SpecialCaseTests[i].status);
@@ -1926,22 +1926,22 @@ TEST(APFloatTest, subtract) {
// signaling NaNs should have a result that is a quiet NaN. Currently they
// return sNaN.
- APFloat PInf = APFloat::getInf(APFloat::IEEEsingle, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEsingle, true);
- APFloat PZero = APFloat::getZero(APFloat::IEEEsingle, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEsingle, true);
- APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle, false);
- APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle, false);
- APFloat PNormalValue = APFloat(APFloat::IEEEsingle, "0x1p+0");
- APFloat MNormalValue = APFloat(APFloat::IEEEsingle, "-0x1p+0");
- APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle, false);
- APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle, true);
- APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, false);
- APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, true);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true);
+ APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
+ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
+ APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0");
+ APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0");
+ APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false);
+ APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), true);
+ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false);
+ APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true);
APFloat PSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false);
APFloat MSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true);
const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact;
@@ -2198,7 +2198,7 @@ TEST(APFloatTest, subtract) {
APFloat y(SpecialCaseTests[i].y);
APFloat::opStatus status = x.subtract(y, APFloat::rmNearestTiesToEven);
- APFloat result(APFloat::IEEEsingle, SpecialCaseTests[i].result);
+ APFloat result(APFloat::IEEEsingle(), SpecialCaseTests[i].result);
EXPECT_TRUE(result.bitwiseIsEqual(x));
EXPECT_TRUE((int)status == SpecialCaseTests[i].status);
@@ -2214,22 +2214,22 @@ TEST(APFloatTest, multiply) {
// signaling NaNs should have a result that is a quiet NaN. Currently they
// return sNaN.
- APFloat PInf = APFloat::getInf(APFloat::IEEEsingle, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEsingle, true);
- APFloat PZero = APFloat::getZero(APFloat::IEEEsingle, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEsingle, true);
- APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle, false);
- APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle, false);
- APFloat PNormalValue = APFloat(APFloat::IEEEsingle, "0x1p+0");
- APFloat MNormalValue = APFloat(APFloat::IEEEsingle, "-0x1p+0");
- APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle, false);
- APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle, true);
- APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, false);
- APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, true);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true);
+ APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
+ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
+ APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0");
+ APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0");
+ APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false);
+ APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), true);
+ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false);
+ APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true);
APFloat PSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false);
APFloat MSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true);
const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact;
const int UnderflowStatus = APFloat::opUnderflow | APFloat::opInexact;
@@ -2487,7 +2487,7 @@ TEST(APFloatTest, multiply) {
APFloat y(SpecialCaseTests[i].y);
APFloat::opStatus status = x.multiply(y, APFloat::rmNearestTiesToEven);
- APFloat result(APFloat::IEEEsingle, SpecialCaseTests[i].result);
+ APFloat result(APFloat::IEEEsingle(), SpecialCaseTests[i].result);
EXPECT_TRUE(result.bitwiseIsEqual(x));
EXPECT_TRUE((int)status == SpecialCaseTests[i].status);
@@ -2503,22 +2503,22 @@ TEST(APFloatTest, divide) {
// signaling NaNs should have a result that is a quiet NaN. Currently they
// return sNaN.
- APFloat PInf = APFloat::getInf(APFloat::IEEEsingle, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEsingle, true);
- APFloat PZero = APFloat::getZero(APFloat::IEEEsingle, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEsingle, true);
- APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle, false);
- APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle, false);
- APFloat PNormalValue = APFloat(APFloat::IEEEsingle, "0x1p+0");
- APFloat MNormalValue = APFloat(APFloat::IEEEsingle, "-0x1p+0");
- APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle, false);
- APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle, true);
- APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, false);
- APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, true);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true);
+ APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
+ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
+ APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0");
+ APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0");
+ APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false);
+ APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), true);
+ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false);
+ APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true);
APFloat PSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false);
APFloat MSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true);
const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact;
const int UnderflowStatus = APFloat::opUnderflow | APFloat::opInexact;
@@ -2776,7 +2776,7 @@ TEST(APFloatTest, divide) {
APFloat y(SpecialCaseTests[i].y);
APFloat::opStatus status = x.divide(y, APFloat::rmNearestTiesToEven);
- APFloat result(APFloat::IEEEsingle, SpecialCaseTests[i].result);
+ APFloat result(APFloat::IEEEsingle(), SpecialCaseTests[i].result);
EXPECT_TRUE(result.bitwiseIsEqual(x));
EXPECT_TRUE((int)status == SpecialCaseTests[i].status);
@@ -2786,8 +2786,8 @@ TEST(APFloatTest, divide) {
TEST(APFloatTest, operatorOverloads) {
// This is mostly testing that these operator overloads compile.
- APFloat One = APFloat(APFloat::IEEEsingle, "0x1p+0");
- APFloat Two = APFloat(APFloat::IEEEsingle, "0x2p+0");
+ APFloat One = APFloat(APFloat::IEEEsingle(), "0x1p+0");
+ APFloat Two = APFloat(APFloat::IEEEsingle(), "0x2p+0");
EXPECT_TRUE(Two.bitwiseIsEqual(One + One));
EXPECT_TRUE(One.bitwiseIsEqual(Two - One));
EXPECT_TRUE(Two.bitwiseIsEqual(One * Two));
@@ -2795,24 +2795,24 @@ TEST(APFloatTest, operatorOverloads) {
}
TEST(APFloatTest, abs) {
- APFloat PInf = APFloat::getInf(APFloat::IEEEsingle, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEsingle, true);
- APFloat PZero = APFloat::getZero(APFloat::IEEEsingle, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEsingle, true);
- APFloat PQNaN = APFloat::getNaN(APFloat::IEEEsingle, false);
- APFloat MQNaN = APFloat::getNaN(APFloat::IEEEsingle, true);
- APFloat PSNaN = APFloat::getSNaN(APFloat::IEEEsingle, false);
- APFloat MSNaN = APFloat::getSNaN(APFloat::IEEEsingle, true);
- APFloat PNormalValue = APFloat(APFloat::IEEEsingle, "0x1p+0");
- APFloat MNormalValue = APFloat(APFloat::IEEEsingle, "-0x1p+0");
- APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle, false);
- APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle, true);
- APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, false);
- APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle, true);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true);
+ APFloat PQNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
+ APFloat MQNaN = APFloat::getNaN(APFloat::IEEEsingle(), true);
+ APFloat PSNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
+ APFloat MSNaN = APFloat::getSNaN(APFloat::IEEEsingle(), true);
+ APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0");
+ APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0");
+ APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false);
+ APFloat MLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), true);
+ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false);
+ APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true);
APFloat PSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false);
APFloat MSmallestNormalized =
- APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
+ APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true);
EXPECT_TRUE(PInf.bitwiseIsEqual(abs(PInf)));
EXPECT_TRUE(PInf.bitwiseIsEqual(abs(MInf)));
@@ -2833,68 +2833,68 @@ TEST(APFloatTest, abs) {
}
TEST(APFloatTest, ilogb) {
- EXPECT_EQ(-1074, ilogb(APFloat::getSmallest(APFloat::IEEEdouble, false)));
- EXPECT_EQ(-1074, ilogb(APFloat::getSmallest(APFloat::IEEEdouble, true)));
- EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep-1024")));
- EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep-1023")));
- EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble, "-0x1.ffffffffffffep-1023")));
- EXPECT_EQ(-51, ilogb(APFloat(APFloat::IEEEdouble, "0x1p-51")));
- EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp-1023")));
- EXPECT_EQ(-2, ilogb(APFloat(APFloat::IEEEdouble, "0x0.ffffp-1")));
- EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble, "0x1.fffep-1023")));
- EXPECT_EQ(1023, ilogb(APFloat::getLargest(APFloat::IEEEdouble, false)));
- EXPECT_EQ(1023, ilogb(APFloat::getLargest(APFloat::IEEEdouble, true)));
-
-
- EXPECT_EQ(0, ilogb(APFloat(APFloat::IEEEsingle, "0x1p+0")));
- EXPECT_EQ(0, ilogb(APFloat(APFloat::IEEEsingle, "-0x1p+0")));
- EXPECT_EQ(42, ilogb(APFloat(APFloat::IEEEsingle, "0x1p+42")));
- EXPECT_EQ(-42, ilogb(APFloat(APFloat::IEEEsingle, "0x1p-42")));
+ EXPECT_EQ(-1074, ilogb(APFloat::getSmallest(APFloat::IEEEdouble(), false)));
+ EXPECT_EQ(-1074, ilogb(APFloat::getSmallest(APFloat::IEEEdouble(), true)));
+ EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1024")));
+ EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1023")));
+ EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1023")));
+ EXPECT_EQ(-51, ilogb(APFloat(APFloat::IEEEdouble(), "0x1p-51")));
+ EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1023")));
+ EXPECT_EQ(-2, ilogb(APFloat(APFloat::IEEEdouble(), "0x0.ffffp-1")));
+ EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.fffep-1023")));
+ EXPECT_EQ(1023, ilogb(APFloat::getLargest(APFloat::IEEEdouble(), false)));
+ EXPECT_EQ(1023, ilogb(APFloat::getLargest(APFloat::IEEEdouble(), true)));
+
+
+ EXPECT_EQ(0, ilogb(APFloat(APFloat::IEEEsingle(), "0x1p+0")));
+ EXPECT_EQ(0, ilogb(APFloat(APFloat::IEEEsingle(), "-0x1p+0")));
+ EXPECT_EQ(42, ilogb(APFloat(APFloat::IEEEsingle(), "0x1p+42")));
+ EXPECT_EQ(-42, ilogb(APFloat(APFloat::IEEEsingle(), "0x1p-42")));
EXPECT_EQ(APFloat::IEK_Inf,
- ilogb(APFloat::getInf(APFloat::IEEEsingle, false)));
+ ilogb(APFloat::getInf(APFloat::IEEEsingle(), false)));
EXPECT_EQ(APFloat::IEK_Inf,
- ilogb(APFloat::getInf(APFloat::IEEEsingle, true)));
+ ilogb(APFloat::getInf(APFloat::IEEEsingle(), true)));
EXPECT_EQ(APFloat::IEK_Zero,
- ilogb(APFloat::getZero(APFloat::IEEEsingle, false)));
+ ilogb(APFloat::getZero(APFloat::IEEEsingle(), false)));
EXPECT_EQ(APFloat::IEK_Zero,
- ilogb(APFloat::getZero(APFloat::IEEEsingle, true)));
+ ilogb(APFloat::getZero(APFloat::IEEEsingle(), true)));
EXPECT_EQ(APFloat::IEK_NaN,
- ilogb(APFloat::getNaN(APFloat::IEEEsingle, false)));
+ ilogb(APFloat::getNaN(APFloat::IEEEsingle(), false)));
EXPECT_EQ(APFloat::IEK_NaN,
- ilogb(APFloat::getSNaN(APFloat::IEEEsingle, false)));
+ ilogb(APFloat::getSNaN(APFloat::IEEEsingle(), false)));
- EXPECT_EQ(127, ilogb(APFloat::getLargest(APFloat::IEEEsingle, false)));
- EXPECT_EQ(127, ilogb(APFloat::getLargest(APFloat::IEEEsingle, true)));
+ EXPECT_EQ(127, ilogb(APFloat::getLargest(APFloat::IEEEsingle(), false)));
+ EXPECT_EQ(127, ilogb(APFloat::getLargest(APFloat::IEEEsingle(), true)));
- EXPECT_EQ(-149, ilogb(APFloat::getSmallest(APFloat::IEEEsingle, false)));
- EXPECT_EQ(-149, ilogb(APFloat::getSmallest(APFloat::IEEEsingle, true)));
+ EXPECT_EQ(-149, ilogb(APFloat::getSmallest(APFloat::IEEEsingle(), false)));
+ EXPECT_EQ(-149, ilogb(APFloat::getSmallest(APFloat::IEEEsingle(), true)));
EXPECT_EQ(-126,
- ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle, false)));
+ ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false)));
EXPECT_EQ(-126,
- ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle, true)));
+ ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true)));
}
TEST(APFloatTest, scalbn) {
const APFloat::roundingMode RM = APFloat::rmNearestTiesToEven;
EXPECT_TRUE(
- APFloat(APFloat::IEEEsingle, "0x1p+0")
- .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle, "0x1p+0"), 0, RM)));
+ APFloat(APFloat::IEEEsingle(), "0x1p+0")
+ .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 0, RM)));
EXPECT_TRUE(
- APFloat(APFloat::IEEEsingle, "0x1p+42")
- .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle, "0x1p+0"), 42, RM)));
+ APFloat(APFloat::IEEEsingle(), "0x1p+42")
+ .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 42, RM)));
EXPECT_TRUE(
- APFloat(APFloat::IEEEsingle, "0x1p-42")
- .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle, "0x1p+0"), -42, RM)));
+ APFloat(APFloat::IEEEsingle(), "0x1p-42")
+ .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), -42, RM)));
- APFloat PInf = APFloat::getInf(APFloat::IEEEsingle, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEsingle, true);
- APFloat PZero = APFloat::getZero(APFloat::IEEEsingle, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEsingle, true);
- APFloat QPNaN = APFloat::getNaN(APFloat::IEEEsingle, false);
- APFloat QMNaN = APFloat::getNaN(APFloat::IEEEsingle, true);
- APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle, false);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true);
+ APFloat QPNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
+ APFloat QMNaN = APFloat::getNaN(APFloat::IEEEsingle(), true);
+ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
EXPECT_TRUE(PInf.bitwiseIsEqual(scalbn(PInf, 0, RM)));
EXPECT_TRUE(MInf.bitwiseIsEqual(scalbn(MInf, 0, RM)));
@@ -2913,57 +2913,57 @@ TEST(APFloatTest, scalbn) {
(UINT64_C(1234) << 32) |
1);
- APFloat SNaNWithPayload = APFloat::getSNaN(APFloat::IEEEdouble, false,
+ APFloat SNaNWithPayload = APFloat::getSNaN(APFloat::IEEEdouble(), false,
&Payload);
APFloat QuietPayload = scalbn(SNaNWithPayload, 1, RM);
EXPECT_TRUE(QuietPayload.isNaN() && !QuietPayload.isSignaling());
EXPECT_EQ(Payload, QuietPayload.bitcastToAPInt().getLoBits(51));
EXPECT_TRUE(PInf.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "0x1p+0"), 128, RM)));
+ scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 128, RM)));
EXPECT_TRUE(MInf.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "-0x1p+0"), 128, RM)));
+ scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p+0"), 128, RM)));
EXPECT_TRUE(PInf.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "0x1p+127"), 1, RM)));
+ scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+127"), 1, RM)));
EXPECT_TRUE(PZero.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "0x1p-127"), -127, RM)));
+ scalbn(APFloat(APFloat::IEEEsingle(), "0x1p-127"), -127, RM)));
EXPECT_TRUE(MZero.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "-0x1p-127"), -127, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEsingle, "-0x1p-149").bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "-0x1p-127"), -22, RM)));
+ scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p-127"), -127, RM)));
+ EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "-0x1p-149").bitwiseIsEqual(
+ scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p-127"), -22, RM)));
EXPECT_TRUE(PZero.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEsingle, "0x1p-126"), -24, RM)));
+ scalbn(APFloat(APFloat::IEEEsingle(), "0x1p-126"), -24, RM)));
- APFloat SmallestF64 = APFloat::getSmallest(APFloat::IEEEdouble, false);
- APFloat NegSmallestF64 = APFloat::getSmallest(APFloat::IEEEdouble, true);
+ APFloat SmallestF64 = APFloat::getSmallest(APFloat::IEEEdouble(), false);
+ APFloat NegSmallestF64 = APFloat::getSmallest(APFloat::IEEEdouble(), true);
- APFloat LargestF64 = APFloat::getLargest(APFloat::IEEEdouble, false);
- APFloat NegLargestF64 = APFloat::getLargest(APFloat::IEEEdouble, true);
+ APFloat LargestF64 = APFloat::getLargest(APFloat::IEEEdouble(), false);
+ APFloat NegLargestF64 = APFloat::getLargest(APFloat::IEEEdouble(), true);
APFloat SmallestNormalizedF64
- = APFloat::getSmallestNormalized(APFloat::IEEEdouble, false);
+ = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false);
APFloat NegSmallestNormalizedF64
- = APFloat::getSmallestNormalized(APFloat::IEEEdouble, true);
+ = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true);
- APFloat LargestDenormalF64(APFloat::IEEEdouble, "0x1.ffffffffffffep-1023");
- APFloat NegLargestDenormalF64(APFloat::IEEEdouble, "-0x1.ffffffffffffep-1023");
+ APFloat LargestDenormalF64(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1023");
+ APFloat NegLargestDenormalF64(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1023");
EXPECT_TRUE(SmallestF64.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEdouble, "0x1p-1074"), 0, RM)));
+ scalbn(APFloat(APFloat::IEEEdouble(), "0x1p-1074"), 0, RM)));
EXPECT_TRUE(NegSmallestF64.bitwiseIsEqual(
- scalbn(APFloat(APFloat::IEEEdouble, "-0x1p-1074"), 0, RM)));
+ scalbn(APFloat(APFloat::IEEEdouble(), "-0x1p-1074"), 0, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p+1023")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+1023")
.bitwiseIsEqual(scalbn(SmallestF64, 2097, RM)));
EXPECT_TRUE(scalbn(SmallestF64, -2097, RM).isPosZero());
EXPECT_TRUE(scalbn(SmallestF64, -2098, RM).isPosZero());
EXPECT_TRUE(scalbn(SmallestF64, -2099, RM).isPosZero());
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p+1022")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+1022")
.bitwiseIsEqual(scalbn(SmallestF64, 2096, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p+1023")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+1023")
.bitwiseIsEqual(scalbn(SmallestF64, 2097, RM)));
EXPECT_TRUE(scalbn(SmallestF64, 2098, RM).isInfinity());
EXPECT_TRUE(scalbn(SmallestF64, 2099, RM).isInfinity());
@@ -2977,12 +2977,12 @@ TEST(APFloatTest, scalbn) {
EXPECT_TRUE(NegLargestDenormalF64
.bitwiseIsEqual(scalbn(NegLargestDenormalF64, 0, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep-1022")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1022")
.bitwiseIsEqual(scalbn(LargestDenormalF64, 1, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-0x1.ffffffffffffep-1021")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1021")
.bitwiseIsEqual(scalbn(NegLargestDenormalF64, 2, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep+1")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep+1")
.bitwiseIsEqual(scalbn(LargestDenormalF64, 1024, RM)));
EXPECT_TRUE(scalbn(LargestDenormalF64, -1023, RM).isPosZero());
EXPECT_TRUE(scalbn(LargestDenormalF64, -1024, RM).isPosZero());
@@ -2991,25 +2991,25 @@ TEST(APFloatTest, scalbn) {
EXPECT_TRUE(scalbn(LargestDenormalF64, 2098, RM).isInfinity());
EXPECT_TRUE(scalbn(LargestDenormalF64, 2099, RM).isInfinity());
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep-2")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-2")
.bitwiseIsEqual(scalbn(LargestDenormalF64, 1021, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep-1")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1")
.bitwiseIsEqual(scalbn(LargestDenormalF64, 1022, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep+0")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep+0")
.bitwiseIsEqual(scalbn(LargestDenormalF64, 1023, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep+1023")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep+1023")
.bitwiseIsEqual(scalbn(LargestDenormalF64, 2046, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p+974")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+974")
.bitwiseIsEqual(scalbn(SmallestF64, 2048, RM)));
- APFloat RandomDenormalF64(APFloat::IEEEdouble, "0x1.c60f120d9f87cp+51");
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp-972")
+ APFloat RandomDenormalF64(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+51");
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-972")
.bitwiseIsEqual(scalbn(RandomDenormalF64, -1023, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp-1")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1")
.bitwiseIsEqual(scalbn(RandomDenormalF64, -52, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp-2")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-2")
.bitwiseIsEqual(scalbn(RandomDenormalF64, -53, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp+0")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+0")
.bitwiseIsEqual(scalbn(RandomDenormalF64, -51, RM)));
EXPECT_TRUE(scalbn(RandomDenormalF64, -2097, RM).isPosZero());
@@ -3017,60 +3017,60 @@ TEST(APFloatTest, scalbn) {
EXPECT_TRUE(
- APFloat(APFloat::IEEEdouble, "-0x1p-1073")
+ APFloat(APFloat::IEEEdouble(), "-0x1p-1073")
.bitwiseIsEqual(scalbn(NegLargestF64, -2097, RM)));
EXPECT_TRUE(
- APFloat(APFloat::IEEEdouble, "-0x1p-1024")
+ APFloat(APFloat::IEEEdouble(), "-0x1p-1024")
.bitwiseIsEqual(scalbn(NegLargestF64, -2048, RM)));
EXPECT_TRUE(
- APFloat(APFloat::IEEEdouble, "0x1p-1073")
+ APFloat(APFloat::IEEEdouble(), "0x1p-1073")
.bitwiseIsEqual(scalbn(LargestF64, -2097, RM)));
EXPECT_TRUE(
- APFloat(APFloat::IEEEdouble, "0x1p-1074")
+ APFloat(APFloat::IEEEdouble(), "0x1p-1074")
.bitwiseIsEqual(scalbn(LargestF64, -2098, RM)));
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-0x1p-1074")
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1074")
.bitwiseIsEqual(scalbn(NegLargestF64, -2098, RM)));
EXPECT_TRUE(scalbn(NegLargestF64, -2099, RM).isNegZero());
EXPECT_TRUE(scalbn(LargestF64, 1, RM).isInfinity());
EXPECT_TRUE(
- APFloat(APFloat::IEEEdouble, "0x1p+0")
- .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEdouble, "0x1p+52"), -52, RM)));
+ APFloat(APFloat::IEEEdouble(), "0x1p+0")
+ .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEdouble(), "0x1p+52"), -52, RM)));
EXPECT_TRUE(
- APFloat(APFloat::IEEEdouble, "0x1p-103")
- .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEdouble, "0x1p-51"), -52, RM)));
+ APFloat(APFloat::IEEEdouble(), "0x1p-103")
+ .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEdouble(), "0x1p-51"), -52, RM)));
}
TEST(APFloatTest, frexp) {
const APFloat::roundingMode RM = APFloat::rmNearestTiesToEven;
- APFloat PZero = APFloat::getZero(APFloat::IEEEdouble, false);
- APFloat MZero = APFloat::getZero(APFloat::IEEEdouble, true);
+ APFloat PZero = APFloat::getZero(APFloat::IEEEdouble(), false);
+ APFloat MZero = APFloat::getZero(APFloat::IEEEdouble(), true);
APFloat One(1.0);
APFloat MOne(-1.0);
APFloat Two(2.0);
APFloat MTwo(-2.0);
- APFloat LargestDenormal(APFloat::IEEEdouble, "0x1.ffffffffffffep-1023");
- APFloat NegLargestDenormal(APFloat::IEEEdouble, "-0x1.ffffffffffffep-1023");
+ APFloat LargestDenormal(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1023");
+ APFloat NegLargestDenormal(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1023");
- APFloat Smallest = APFloat::getSmallest(APFloat::IEEEdouble, false);
- APFloat NegSmallest = APFloat::getSmallest(APFloat::IEEEdouble, true);
+ APFloat Smallest = APFloat::getSmallest(APFloat::IEEEdouble(), false);
+ APFloat NegSmallest = APFloat::getSmallest(APFloat::IEEEdouble(), true);
- APFloat Largest = APFloat::getLargest(APFloat::IEEEdouble, false);
- APFloat NegLargest = APFloat::getLargest(APFloat::IEEEdouble, true);
+ APFloat Largest = APFloat::getLargest(APFloat::IEEEdouble(), false);
+ APFloat NegLargest = APFloat::getLargest(APFloat::IEEEdouble(), true);
- APFloat PInf = APFloat::getInf(APFloat::IEEEdouble, false);
- APFloat MInf = APFloat::getInf(APFloat::IEEEdouble, true);
+ APFloat PInf = APFloat::getInf(APFloat::IEEEdouble(), false);
+ APFloat MInf = APFloat::getInf(APFloat::IEEEdouble(), true);
- APFloat QPNaN = APFloat::getNaN(APFloat::IEEEdouble, false);
- APFloat QMNaN = APFloat::getNaN(APFloat::IEEEdouble, true);
- APFloat SNaN = APFloat::getSNaN(APFloat::IEEEdouble, false);
+ APFloat QPNaN = APFloat::getNaN(APFloat::IEEEdouble(), false);
+ APFloat QMNaN = APFloat::getNaN(APFloat::IEEEdouble(), true);
+ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEdouble(), false);
// Make sure highest bit of payload is preserved.
const APInt Payload(64, (UINT64_C(1) << 50) |
@@ -3078,16 +3078,16 @@ TEST(APFloatTest, frexp) {
(UINT64_C(1234) << 32) |
1);
- APFloat SNaNWithPayload = APFloat::getSNaN(APFloat::IEEEdouble, false,
+ APFloat SNaNWithPayload = APFloat::getSNaN(APFloat::IEEEdouble(), false,
&Payload);
APFloat SmallestNormalized
- = APFloat::getSmallestNormalized(APFloat::IEEEdouble, false);
+ = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false);
APFloat NegSmallestNormalized
- = APFloat::getSmallestNormalized(APFloat::IEEEdouble, true);
+ = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true);
int Exp;
- APFloat Frac(APFloat::IEEEdouble);
+ APFloat Frac(APFloat::IEEEdouble());
Frac = frexp(PZero, Exp, RM);
@@ -3101,37 +3101,37 @@ TEST(APFloatTest, frexp) {
Frac = frexp(One, Exp, RM);
EXPECT_EQ(1, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1").bitwiseIsEqual(Frac));
Frac = frexp(MOne, Exp, RM);
EXPECT_EQ(1, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-0x1p-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1").bitwiseIsEqual(Frac));
Frac = frexp(LargestDenormal, Exp, RM);
EXPECT_EQ(-1022, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.ffffffffffffep-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1").bitwiseIsEqual(Frac));
Frac = frexp(NegLargestDenormal, Exp, RM);
EXPECT_EQ(-1022, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-0x1.ffffffffffffep-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1").bitwiseIsEqual(Frac));
Frac = frexp(Smallest, Exp, RM);
EXPECT_EQ(-1073, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1").bitwiseIsEqual(Frac));
Frac = frexp(NegSmallest, Exp, RM);
EXPECT_EQ(-1073, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-0x1p-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1").bitwiseIsEqual(Frac));
Frac = frexp(Largest, Exp, RM);
EXPECT_EQ(1024, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.fffffffffffffp-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.fffffffffffffp-1").bitwiseIsEqual(Frac));
Frac = frexp(NegLargest, Exp, RM);
EXPECT_EQ(1024, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-0x1.fffffffffffffp-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.fffffffffffffp-1").bitwiseIsEqual(Frac));
Frac = frexp(PInf, Exp, RM);
@@ -3159,17 +3159,17 @@ TEST(APFloatTest, frexp) {
EXPECT_TRUE(Frac.isNaN() && !Frac.isSignaling());
EXPECT_EQ(Payload, Frac.bitcastToAPInt().getLoBits(51));
- Frac = frexp(APFloat(APFloat::IEEEdouble, "0x0.ffffp-1"), Exp, RM);
+ Frac = frexp(APFloat(APFloat::IEEEdouble(), "0x0.ffffp-1"), Exp, RM);
EXPECT_EQ(-1, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.fffep-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.fffep-1").bitwiseIsEqual(Frac));
- Frac = frexp(APFloat(APFloat::IEEEdouble, "0x1p-51"), Exp, RM);
+ Frac = frexp(APFloat(APFloat::IEEEdouble(), "0x1p-51"), Exp, RM);
EXPECT_EQ(-50, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1p-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1").bitwiseIsEqual(Frac));
- Frac = frexp(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp+51"), Exp, RM);
+ Frac = frexp(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+51"), Exp, RM);
EXPECT_EQ(52, Exp);
- EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "0x1.c60f120d9f87cp-1").bitwiseIsEqual(Frac));
+ EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1").bitwiseIsEqual(Frac));
}
TEST(APFloatTest, PPCDoubleDoubleAddSpecial) {
More information about the llvm-commits
mailing list