diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-12-14 11:57:17 +0000 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-12-14 11:57:17 +0000 |
commit | 17c7f703620f5c788322c45408236a04332e5c8b (patch) | |
tree | 4b772470b19084796d0d8692ce259eb64ebc2f57 /llvm/lib | |
parent | f3ee444010a3fe11f1e631a10a6db4bde290b415 (diff) | |
download | bcm5719-llvm-17c7f703620f5c788322c45408236a04332e5c8b.tar.gz bcm5719-llvm-17c7f703620f5c788322c45408236a04332e5c8b.zip |
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
llvm-svn: 289647
Diffstat (limited to 'llvm/lib')
32 files changed, 252 insertions, 230 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 1c0bf01af1d..cf0d5e4ec79 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1442,7 +1442,7 @@ Constant *GetConstantFoldFPValue(double V, Type *Ty) { 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(StringRef Name, unsigned IntrinsicID, Type *Ty, 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(StringRef Name, unsigned IntrinsicID, Type *Ty, 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( diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index ca30a4f1c78..bed5306cc07 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -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; } diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index d73818d2b86..d4de28e2c1f 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -4460,13 +4460,13 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V, // 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); diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 1bf758b4122..36f3239c2e0 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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); diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index b43d73988f4..7adac4cbf94 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -758,7 +758,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) { // 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(); } diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 4567654b5e0..56fa41ebf4d 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -401,7 +401,7 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST, } 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(); diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index 37163650474..72b56d84d94 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -1466,7 +1466,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo, // 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_FP_TO_UINT(SDNode *N) { 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. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 33c40f27c77..8c98eacdf1a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3191,13 +3191,13 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT, } 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(), diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 3c9862d7205..50ddc4bfd46 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4172,7 +4172,7 @@ static SDValue GetExponent(SelectionDAG &DAG, SDValue Op, /// 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); } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp index 07e01c309f1..340088a5fc9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @@ -425,9 +425,9 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const { } 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("; diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 1dd1812ce14..b4bed325f49 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -692,7 +692,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { 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::getConstantValue(const Constant *C) { 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::getConstantValue(const Constant *C) { 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, diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 5eb93ceda32..d58618f99ff 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1106,15 +1106,15 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV, } 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_ostream &Out, const Constant *CV, ((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_ostream &Out, const Constant *CV, 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_ostream &Out, const Constant *CV, // 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); diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index e14ea78c27f..098ff90a0a9 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -590,13 +590,13 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V, 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); } diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index a3db1525931..533b9245277 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -198,22 +198,22 @@ Constant *Constant::getNullValue(Type *Ty) { 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 &Context, const APFloat& V) { 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(Type *Ty, const APFloat& Val) { // 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::getElementAsAPFloat(unsigned Elt) const { 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)); } } } diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 7f1d5d249e2..00bb476c0b3 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -983,7 +983,7 @@ double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo) { 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(); } diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 20f00e2ac43..f1cc12a2902 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -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)); } diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 037506a389c..34f7bf16849 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -4030,7 +4030,7 @@ void Verifier::visitInstruction(Instruction &I) { 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); diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 90a210f364d..da54155b3b9 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -1042,7 +1042,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) { 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(ParseStatementInfo &Info, 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(ParseStatementInfo &Info, 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) + diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 3549aa303fd..4ad6b07ed2b 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -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 Negative, const APInt *fill) { // 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=(IEEEFloat &&rhs) { category = rhs.category; sign = rhs.sign; - rhs.semantics = &Bogus; + rhs.semantics = &semBogus; return *this; } @@ -830,7 +852,7 @@ IEEEFloat::IEEEFloat(const IEEEFloat &rhs) { 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(const fltSemantics &toSemantics, 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(const fltSemantics &toSemantics, // 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 &Arg) { // 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::convertF80LongDoubleAPFloatToAPInt() const { } 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::convertPPCDoubleDoubleAPFloatToAPInt() const { // 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::convertPPCDoubleDoubleAPFloatToAPInt() const { 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::convertPPCDoubleDoubleAPFloatToAPInt() const { } 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::convertQuadrupleAPFloatToAPInt() const { } 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::convertDoubleAPFloatToAPInt() const { } 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::convertFloatAPFloatToAPInt() const { } 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::convertHalfAPFloatToAPInt() const { // 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::initFromF80LongDoubleAPInt(const APInt &api) { 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::initFromPPCDoubleDoubleAPInt(const APInt &api) { // 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(const APInt &api) { 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(const APInt &api) { 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 APInt &api) { 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 APInt &api) { 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 APInt &api) { /// 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 &Sem, const APInt &API) { } 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, int &Exp, IEEEFloat::roundingMode RM) { } 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 DoubleAPFloat &RHS) 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::addWithSpecial(const DoubleAPFloat &LHS, // 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, const fltSemantics &Semantics) { } 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 fltSemantics &ToSemantics, 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(unsigned BitWidth, bool isIEEE) { 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)); } } diff --git a/llvm/lib/Support/ScaledNumber.cpp b/llvm/lib/Support/ScaledNumber.cpp index b9432d46f9b..807c9fa521d 100644 --- a/llvm/lib/Support/ScaledNumber.cpp +++ b/llvm/lib/Support/ScaledNumber.cpp @@ -183,7 +183,7 @@ static std::string toStringAPFloat(uint64_t D, int E, unsigned Precision) { // 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()); diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index 402b1e3e223..1a7cc023bd6 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -2206,7 +2206,7 @@ AArch64AsmParser::tryParseFPImm(OperandVector &Operands) { 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(OperandVector &Operands) { 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(OperandVector &Operands, bool isCondCode, // 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" && diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index d9abecd8224..baf27971dd7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -1614,7 +1614,7 @@ SDValue AMDGPUTargetLowering::LowerFRINT(SDValue Op, SelectionDAG &DAG) const { 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 Op, SelectionDAG &DAG) const { 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 = diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 80c815e830b..55eee67a9ee 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -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 type) const { 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 type) const { 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(MCInst &Inst, int64_t Val) const { 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(MCInst &Inst, unsigned N) const { } 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())); diff --git a/llvm/lib/Target/ARM/ARMMCInstLower.cpp b/llvm/lib/Target/ARM/ARMMCInstLower.cpp index dde91a7e04e..d5848e6cd06 100644 --- a/llvm/lib/Target/ARM/ARMMCInstLower.cpp +++ b/llvm/lib/Target/ARM/ARMMCInstLower.cpp @@ -99,7 +99,7 @@ bool ARMAsmPrinter::lowerOperand(const MachineOperand &MO, 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; } diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 61062e44a02..159c79e8273 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5295,7 +5295,7 @@ ARMAsmParser::parseFPImm(OperandVector &Operands) { 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; diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index 0b4dc15708b..9d21629016a 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -1723,11 +1723,11 @@ void NVPTXAsmPrinter::printFPConstant(const ConstantFP *Fp, raw_ostream &O) { 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"); diff --git a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td index dee0eca4d27..92a88c7f250 100644 --- a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td +++ b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td @@ -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; }]>; diff --git a/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp b/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp index 84d5239ec09..eab5ee80561 100644 --- a/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp @@ -30,12 +30,12 @@ void NVPTXFloatMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const { 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; } diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index d0a12b53a4c..faed8140bc2 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -599,14 +599,14 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM, 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<APInt> Bits, SmallBitVector &Undefs, 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_FP_i64(SDValue Op, 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(SDValue Op, SelectionDAG &DAG, // 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(SDValue Op, SelectionDAG &DAG, // 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 Op, SelectionDAG &DAG) { 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, SelectionDAG &DAG) { 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. diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 445f72f4353..e74b590e2b7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -1239,14 +1239,14 @@ static Value *lookThroughFPExtensions(Value *V) { 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. } diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index c6100027abc..400e008dc13 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -4661,17 +4661,17 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { 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; diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 221947e1976..121693b9d6c 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -900,7 +900,7 @@ static Value *valueHasFloatPrecision(Value *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(CallInst *CI, IRBuilder<> &B) { // 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); |