From: Nemanja Ivanovic Date: Fri, 15 Apr 2016 18:04:13 +0000 (+0000) Subject: Revert 266186 as it breaks anything that includes type_traits on some platforms X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c74bb5e707bc42a010ab107fbe3515c2f39385c1;p=clang Revert 266186 as it breaks anything that includes type_traits on some platforms Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266460 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index dac71916d3..4d450eca18 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1685,7 +1685,6 @@ TypeKind.DEPENDENT = TypeKind(26) TypeKind.OBJCID = TypeKind(27) TypeKind.OBJCCLASS = TypeKind(28) TypeKind.OBJCSEL = TypeKind(29) -TypeKind.FLOAT128 = TypeKind(30) TypeKind.COMPLEX = TypeKind(100) TypeKind.POINTER = TypeKind(101) TypeKind.BLOCKPOINTER = TypeKind(102) diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index e9f93364af..9c9bc7a998 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -2929,7 +2929,6 @@ enum CXTypeKind { CXType_ObjCId = 27, CXType_ObjCClass = 28, CXType_ObjCSel = 29, - CXType_Float128 = 30, CXType_FirstBuiltin = CXType_Void, CXType_LastBuiltin = CXType_ObjCSel, diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 4e4a98d801..e04d976441 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -893,10 +893,9 @@ public: CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty; CanQualType UnsignedCharTy, UnsignedShortTy, UnsignedIntTy, UnsignedLongTy; CanQualType UnsignedLongLongTy, UnsignedInt128Ty; - CanQualType FloatTy, DoubleTy, LongDoubleTy, Float128Ty; + CanQualType FloatTy, DoubleTy, LongDoubleTy; CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy; - CanQualType Float128ComplexTy; CanQualType VoidPtrTy, NullPtrTy; CanQualType DependentTy, OverloadTy, BoundMemberTy, UnknownAnyTy; CanQualType BuiltinFnTy; @@ -969,6 +968,9 @@ public: /// \brief Retrieve the declaration for the 128-bit unsigned integer type. TypedefDecl *getUInt128Decl() const; + /// \brief Retrieve the declaration for a 128-bit float stub type. + TypeDecl *getFloat128StubType() const; + //===--------------------------------------------------------------------===// // Type Constructors //===--------------------------------------------------------------------===// diff --git a/include/clang/AST/BuiltinTypes.def b/include/clang/AST/BuiltinTypes.def index c0c6819280..dcca44df17 100644 --- a/include/clang/AST/BuiltinTypes.def +++ b/include/clang/AST/BuiltinTypes.def @@ -133,9 +133,6 @@ FLOATING_TYPE(Double, DoubleTy) // 'long double' FLOATING_TYPE(LongDouble, LongDoubleTy) -// '__float128' -FLOATING_TYPE(Float128, Float128Ty) - //===- Language-specific types --------------------------------------------===// // This is the type of C++0x 'nullptr'. diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 71004fc572..4f64d4cf86 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -2051,7 +2051,7 @@ public: } bool isFloatingPoint() const { - return getKind() >= Half && getKind() <= Float128; + return getKind() >= Half && getKind() <= LongDouble; } /// Determines whether the given kind corresponds to a placeholder type. diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index 67adf4a638..ba3f848958 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -538,7 +538,7 @@ public: bool needsExtraLocalData() const { BuiltinType::Kind bk = getTypePtr()->getKind(); return (bk >= BuiltinType::UShort && bk <= BuiltinType::UInt128) - || (bk >= BuiltinType::Short && bk <= BuiltinType::Float128) + || (bk >= BuiltinType::Short && bk <= BuiltinType::LongDouble) || bk == BuiltinType::UChar || bk == BuiltinType::SChar; } diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index d5d6e874dd..822124f0dd 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -5246,6 +5246,8 @@ def err_typecheck_pointer_arith_void_type : Error< "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">; def err_typecheck_decl_incomplete_type : Error< "variable has incomplete type %0">; +def err_typecheck_decl_incomplete_type___float128 : Error< + "support for type '__float128' is not yet implemented">; def ext_typecheck_decl_incomplete_type : ExtWarn< "tentative definition of variable with internal linkage has incomplete non-array type %0">, InGroup>; @@ -7599,8 +7601,8 @@ def err_c99_array_usage_cxx : Error< "feature, not permitted in C++">; def err_type_requires_extension : Error< "use of type %0 requires %1 extension to be enabled">; -def err_type_unsupported : Error< - "%0 is not supported on this target">; +def err_int128_unsupported : Error< + "__int128 is not supported on this target">; def err_nsconsumed_attribute_mismatch : Error< "overriding method has mismatched ns_consumed attribute on its" " parameter">; diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index b2965782de..334719cd7d 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -54,7 +54,6 @@ namespace clang { TST_half, // OpenCL half, ARM NEON __fp16 TST_float, TST_double, - TST_float128, TST_bool, // _Bool TST_decimal32, // _Decimal32 TST_decimal64, // _Decimal64 diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 008723f426..b98a5d6c41 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -64,7 +64,7 @@ protected: unsigned char HalfWidth, HalfAlign; unsigned char FloatWidth, FloatAlign; unsigned char DoubleWidth, DoubleAlign; - unsigned char LongDoubleWidth, LongDoubleAlign, Float128Align; + unsigned char LongDoubleWidth, LongDoubleAlign; unsigned char LargeArrayMinWidth, LargeArrayAlign; unsigned char LongWidth, LongAlign; unsigned char LongLongWidth, LongLongAlign; @@ -78,7 +78,7 @@ protected: std::unique_ptr DataLayout; const char *MCountName; const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat, - *LongDoubleFormat, *Float128Format; + *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; TargetCXXABI TheCXXABI; const LangAS::Map *AddrSpaceMap; @@ -136,8 +136,7 @@ public: NoFloat = 255, Float = 0, Double, - LongDouble, - Float128 + LongDouble }; /// \brief The different kinds of __builtin_va_list types defined by @@ -328,11 +327,6 @@ public: return getPointerWidth(0) >= 64; } // FIXME - /// \brief Determine whether the __float128 type is supported on this target. - virtual bool hasFloat128Type() const { - return false; - } - /// \brief Return the alignment that is suitable for storing any /// object with a fundamental alignment requirement. unsigned getSuitableAlign() const { return SuitableAlign; } @@ -385,14 +379,6 @@ public: return *LongDoubleFormat; } - /// getFloat128Width/Align/Format - Return the size/align/format of - /// '__float128'. - unsigned getFloat128Width() const { return 128; } - unsigned getFloat128Align() const { return Float128Align; } - const llvm::fltSemantics &getFloat128Format() const { - return *Float128Format; - } - /// \brief Return true if the 'long double' type should be mangled like /// __float128. virtual bool useFloat128ManglingForLongDouble() const { return false; } diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 9d97a81773..3d0c65718f 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -380,7 +380,6 @@ KEYWORD(__builtin_offsetof , KEYALL) TYPE_TRAIT_2(__builtin_types_compatible_p, TypeCompatible, KEYNOCXX) KEYWORD(__builtin_va_arg , KEYALL) KEYWORD(__extension__ , KEYALL) -KEYWORD(__float128 , KEYALL) KEYWORD(__imag , KEYALL) KEYWORD(__int128 , KEYALL) KEYWORD(__label__ , KEYALL) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 21bfa3a254..1a8c7c606d 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1495,10 +1495,6 @@ def minvariant_function_descriptors : def mno_invariant_function_descriptors : Flag<["-"], "mno-invariant-function-descriptors">, Group; -def mfloat128: Flag<["-"], "mfloat128">, - Group; -def mno_float128 : Flag<["-"], "mno-float128">, - Group; def faltivec : Flag<["-"], "faltivec">, Group, Flags<[CC1Option]>, HelpText<"Enable AltiVec vector initializer syntax">; diff --git a/include/clang/Lex/LiteralSupport.h b/include/clang/Lex/LiteralSupport.h index 2bbcd262a7..3a2e8d276e 100644 --- a/include/clang/Lex/LiteralSupport.h +++ b/include/clang/Lex/LiteralSupport.h @@ -64,7 +64,6 @@ public: bool isHalf : 1; // 1.0h bool isFloat : 1; // 1.0f bool isImaginary : 1; // 1.0i - bool isFloat128 : 1; // 1.0q uint8_t MicrosoftInteger; // Microsoft suffix extension i8, i16, i32, or i64. bool isIntegerLiteral() const { diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index d296e74b07..b9e432b5ee 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -280,7 +280,6 @@ public: static const TST TST_half = clang::TST_half; static const TST TST_float = clang::TST_float; static const TST TST_double = clang::TST_double; - static const TST TST_float128 = clang::TST_float128; static const TST TST_bool = clang::TST_bool; static const TST TST_decimal32 = clang::TST_decimal32; static const TST TST_decimal64 = clang::TST_decimal64; diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index adec5001e9..ef8b47b519 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -794,8 +794,6 @@ namespace clang { PREDEF_TYPE_RESERVE_ID_ID = 42, /// \brief The placeholder type for OpenMP array section. PREDEF_TYPE_OMP_ARRAY_SECTION = 43, - /// \brief The '__float128' type - PREDEF_TYPE_FLOAT128_ID = 44, /// \brief OpenCL image types with auto numeration #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ PREDEF_TYPE_##Id##_ID, diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 2b103308bb..fb4c80bd7f 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -58,7 +58,7 @@ unsigned ASTContext::NumImplicitDestructors; unsigned ASTContext::NumImplicitDestructorsDeclared; enum FloatingRank { - HalfRank, FloatRank, DoubleRank, LongDoubleRank, Float128Rank + HalfRank, FloatRank, DoubleRank, LongDoubleRank }; RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const { @@ -967,6 +967,14 @@ TypedefDecl *ASTContext::getUInt128Decl() const { return UInt128Decl; } +TypeDecl *ASTContext::getFloat128StubType() const { + assert(LangOpts.CPlusPlus && "should only be called for c++"); + if (!Float128StubDecl) + Float128StubDecl = buildImplicitRecord("__float128"); + + return Float128StubDecl; +} + void ASTContext::InitBuiltinType(CanQualType &R, BuiltinType::Kind K) { BuiltinType *Ty = new (*this, TypeAlignment) BuiltinType(K); R = CanQualType::CreateUnsafe(QualType(Ty, 0)); @@ -1015,9 +1023,6 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, InitBuiltinType(DoubleTy, BuiltinType::Double); InitBuiltinType(LongDoubleTy, BuiltinType::LongDouble); - // GNU extension, __float128 for IEEE quadruple precision - InitBuiltinType(Float128Ty, BuiltinType::Float128); - // GNU extension, 128-bit integers. InitBuiltinType(Int128Ty, BuiltinType::Int128); InitBuiltinType(UnsignedInt128Ty, BuiltinType::UInt128); @@ -1079,7 +1084,6 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, FloatComplexTy = getComplexType(FloatTy); DoubleComplexTy = getComplexType(DoubleTy); LongDoubleComplexTy = getComplexType(LongDoubleTy); - Float128ComplexTy = getComplexType(Float128Ty); // Builtin types for 'id', 'Class', and 'SEL'. InitBuiltinType(ObjCBuiltinIdTy, BuiltinType::ObjCId); @@ -1337,7 +1341,6 @@ const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType T) const { case BuiltinType::Float: return Target->getFloatFormat(); case BuiltinType::Double: return Target->getDoubleFormat(); case BuiltinType::LongDouble: return Target->getLongDoubleFormat(); - case BuiltinType::Float128: return Target->getFloat128Format(); } } @@ -1648,10 +1651,6 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { Width = Target->getLongDoubleWidth(); Align = Target->getLongDoubleAlign(); break; - case BuiltinType::Float128: - Width = Target->getFloat128Width(); - Align = Target->getFloat128Align(); - break; case BuiltinType::NullPtr: Width = Target->getPointerWidth(0); // C++ 3.9.1p11: sizeof(nullptr_t) Align = Target->getPointerAlign(0); // == sizeof(void*) @@ -4636,7 +4635,6 @@ static FloatingRank getFloatingRank(QualType T) { case BuiltinType::Float: return FloatRank; case BuiltinType::Double: return DoubleRank; case BuiltinType::LongDouble: return LongDoubleRank; - case BuiltinType::Float128: return Float128Rank; } } @@ -4653,7 +4651,6 @@ QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size, case FloatRank: return FloatComplexTy; case DoubleRank: return DoubleComplexTy; case LongDoubleRank: return LongDoubleComplexTy; - case Float128Rank: return Float128ComplexTy; } } @@ -4663,7 +4660,6 @@ QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size, case FloatRank: return FloatTy; case DoubleRank: return DoubleTy; case LongDoubleRank: return LongDoubleTy; - case Float128Rank: return Float128Ty; } llvm_unreachable("getFloatingRank(): illegal value for rank"); } @@ -5493,7 +5489,6 @@ static char getObjCEncodingForPrimitiveKind(const ASTContext *C, case BuiltinType::LongDouble: return 'D'; case BuiltinType::NullPtr: return '*'; // like char* - case BuiltinType::Float128: case BuiltinType::Half: // FIXME: potentially need @encodes for these! return ' '; @@ -8684,8 +8679,6 @@ QualType ASTContext::getRealTypeForBitwidth(unsigned DestWidth) const { return DoubleTy; case TargetInfo::LongDouble: return LongDoubleTy; - case TargetInfo::Float128: - return Float128Ty; case TargetInfo::NoFloat: return QualType(); } diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index 67f5a57263..7ad464e1d9 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -1992,7 +1992,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { // ::= f # float // ::= d # double // ::= e # long double, __float80 - // ::= g # __float128 + // UNSUPPORTED: ::= g # __float128 // UNSUPPORTED: ::= Dd # IEEE 754r decimal floating point (64 bits) // UNSUPPORTED: ::= De # IEEE 754r decimal floating point (128 bits) // UNSUPPORTED: ::= Df # IEEE 754r decimal floating point (32 bits) @@ -2073,12 +2073,6 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { ? 'g' : 'e'); break; - case BuiltinType::Float128: - if (getASTContext().getTargetInfo().useFloat128ManglingForLongDouble()) - Out << "U10__float128"; // Match the GCC mangling - else - Out << 'g'; - break; case BuiltinType::NullPtr: Out << "Dn"; break; diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index c9caddbb6f..b63b5e5651 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -1751,7 +1751,6 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers, Out << "$$T"; break; - case BuiltinType::Float128: case BuiltinType::Half: { DiagnosticsEngine &Diags = Context.getDiags(); unsigned DiagID = Diags.getCustomDiagID( diff --git a/lib/AST/NSAPI.cpp b/lib/AST/NSAPI.cpp index ac2a8d3542..4c49e4c9f6 100644 --- a/lib/AST/NSAPI.cpp +++ b/lib/AST/NSAPI.cpp @@ -441,7 +441,6 @@ NSAPI::getNSNumberFactoryMethodKind(QualType T) const { case BuiltinType::Int128: case BuiltinType::LongDouble: case BuiltinType::UInt128: - case BuiltinType::Float128: case BuiltinType::NullPtr: case BuiltinType::ObjCClass: case BuiltinType::ObjCId: diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index 0b3f908790..cc38374092 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -1310,7 +1310,6 @@ static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node, case BuiltinType::Double: break; // no suffix. case BuiltinType::Float: OS << 'F'; break; case BuiltinType::LongDouble: OS << 'L'; break; - case BuiltinType::Float128: OS << 'Q'; break; } } diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 0262f5ba4a..1c6ae2a2b9 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1777,7 +1777,7 @@ bool Type::hasUnsignedIntegerRepresentation() const { bool Type::isFloatingType() const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Half && - BT->getKind() <= BuiltinType::Float128; + BT->getKind() <= BuiltinType::LongDouble; if (const ComplexType *CT = dyn_cast(CanonicalType)) return CT->getElementType()->isFloatingType(); return false; @@ -1799,7 +1799,7 @@ bool Type::isRealFloatingType() const { bool Type::isRealType() const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && - BT->getKind() <= BuiltinType::Float128; + BT->getKind() <= BuiltinType::LongDouble; if (const EnumType *ET = dyn_cast(CanonicalType)) return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped(); return false; @@ -1808,7 +1808,7 @@ bool Type::isRealType() const { bool Type::isArithmeticType() const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && - BT->getKind() <= BuiltinType::Float128; + BT->getKind() <= BuiltinType::LongDouble; if (const EnumType *ET = dyn_cast(CanonicalType)) // GCC allows forward declaration of enum types (forbid by C99 6.7.2.3p2). // If a body isn't seen by the time we get here, return false. @@ -2552,8 +2552,6 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const { return "double"; case LongDouble: return "long double"; - case Float128: - return "__float128"; case WChar_S: case WChar_U: return Policy.MSWChar ? "__wchar_t" : "wchar_t"; diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp index 78947d18f9..05e5a627b7 100644 --- a/lib/AST/TypeLoc.cpp +++ b/lib/AST/TypeLoc.cpp @@ -320,7 +320,6 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const { case BuiltinType::Float: case BuiltinType::Double: case BuiltinType::LongDouble: - case BuiltinType::Float128: llvm_unreachable("Builtin type needs extra local data!"); // Fall through, if the impossible happens. diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index ac6cef9d08..ff44a570de 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -616,7 +616,6 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt, case BuiltinType::UInt128: case BuiltinType::Int128: case BuiltinType::Half: - case BuiltinType::Float128: // Various types which are non-trivial to correct. return false; diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index c287073ead..40d6001e53 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -46,7 +46,6 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) { DoubleAlign = 64; LongDoubleWidth = 64; LongDoubleAlign = 64; - Float128Align = 128; LargeArrayMinWidth = 0; LargeArrayAlign = 0; MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0; @@ -73,7 +72,6 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) { FloatFormat = &llvm::APFloat::IEEEsingle; DoubleFormat = &llvm::APFloat::IEEEdouble; LongDoubleFormat = &llvm::APFloat::IEEEdouble; - Float128Format = &llvm::APFloat::IEEEquad; MCountName = "mcount"; RegParmMax = 0; SSERegParmMax = 0; @@ -225,8 +223,6 @@ TargetInfo::RealType TargetInfo::getRealTypeByWidth(unsigned BitWidth) const { if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble || &getLongDoubleFormat() == &llvm::APFloat::IEEEquad) return LongDouble; - if (hasFloat128Type()) - return Float128; break; } diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 4cce9cbd8a..7639b04d25 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -806,7 +806,6 @@ class PPCTargetInfo : public TargetInfo { bool HasHTM; bool HasBPERMD; bool HasExtDiv; - bool HasFloat128; protected: std::string ABI; @@ -815,7 +814,7 @@ public: PPCTargetInfo(const llvm::Triple &Triple, const TargetOptions &) : TargetInfo(Triple), HasVSX(false), HasP8Vector(false), HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false), - HasBPERMD(false), HasExtDiv(false), HasFloat128(false) { + HasBPERMD(false), HasExtDiv(false) { BigEndian = (Triple.getArch() != llvm::Triple::ppc64le); SimdDefaultAlign = 128; LongDoubleWidth = LongDoubleAlign = 128; @@ -1059,9 +1058,6 @@ public: LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble && getTriple().isOSBinFormatELF(); } - bool hasFloat128Type() const override { - return HasFloat128; - } }; const Builtin::Info PPCTargetInfo::BuiltinInfo[] = { @@ -1093,8 +1089,6 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector &Features, HasQPX = true; } else if (Feature == "+htm") { HasHTM = true; - } else if (Feature == "+float128") { - HasFloat128 = true; } // TODO: Finish this list and add an assert that we've handled them // all. @@ -1252,8 +1246,6 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__CRYPTO__"); if (HasHTM) Builder.defineMacro("__HTM__"); - if (HasFloat128) - Builder.defineMacro("__FLOAT128__"); Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); @@ -1304,13 +1296,6 @@ static bool ppcUserFeaturesCheck(DiagnosticsEngine &Diags, << "-mno-vsx"; return false; } - - if (std::find(FeaturesVec.begin(), FeaturesVec.end(), "+float128") != - FeaturesVec.end()) { - Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128" - << "-mno-vsx"; - return false; - } } return true; @@ -1379,7 +1364,6 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const { .Case("htm", HasHTM) .Case("bpermd", HasBPERMD) .Case("extdiv", HasExtDiv) - .Case("float128", HasFloat128) .Default(false); } @@ -1389,19 +1373,19 @@ void PPCTargetInfo::setFeatureEnabled(llvm::StringMap &Features, // as well. Do the inverse if we're disabling vsx. We'll diagnose any user // incompatible options. if (Enabled) { - if (Name == "direct-move") { + if (Name == "vsx") { + Features[Name] = true; + } else if (Name == "direct-move") { Features[Name] = Features["vsx"] = true; } else if (Name == "power8-vector") { Features[Name] = Features["vsx"] = true; - } else if (Name == "float128") { - Features[Name] = Features["vsx"] = true; } else { Features[Name] = true; } } else { if (Name == "vsx") { Features[Name] = Features["direct-move"] = Features["power8-vector"] = - Features["float128"] = false; + false; } else { Features[Name] = false; } diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 54b5f2fc42..6fd0032f84 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -528,13 +528,7 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { case BuiltinType::Half: case BuiltinType::Float: case BuiltinType::LongDouble: - case BuiltinType::Float128: case BuiltinType::Double: - // FIXME: For targets where long double and __float128 have the same size, - // they are currently indistinguishable in the debugger without some - // special treatment. However, there is currently no consensus on encoding - // and this should be updated once a DWARF encoding exists for distinct - // floating point types of the same size. Encoding = llvm::dwarf::DW_ATE_float; break; } diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 8f122963a1..1fd79d0e0e 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1796,19 +1796,15 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, amt = llvm::ConstantFP::get(VMContext, llvm::APFloat(static_cast(amount))); else { - // Remaining types are Half, LongDouble or __float128. Convert from float. + // Remaining types are either Half or LongDouble. Convert from float. llvm::APFloat F(static_cast(amount)); bool ignored; - const llvm::fltSemantics *FS; // Don't use getFloatTypeSemantics because Half isn't // necessarily represented using the "half" LLVM type. - if (value->getType()->isFP128Ty()) - FS = &CGF.getTarget().getFloat128Format(); - else if (value->getType()->isHalfTy()) - FS = &CGF.getTarget().getHalfFormat(); - else - FS = &CGF.getTarget().getLongDoubleFormat(); - F.convert(*FS, llvm::APFloat::rmTowardZero, &ignored); + F.convert(value->getType()->isHalfTy() + ? CGF.getTarget().getHalfFormat() + : CGF.getTarget().getLongDoubleFormat(), + llvm::APFloat::rmTowardZero, &ignored); amt = llvm::ConstantFP::get(VMContext, F); } value = Builder.CreateFAdd(value, amt, isInc ? "inc" : "dec"); diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index ebe55c70d8..33e53a6cbe 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -449,7 +449,6 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { case BuiltinType::Float: case BuiltinType::Double: case BuiltinType::LongDouble: - case BuiltinType::Float128: ResultType = getTypeForFormat(getLLVMContext(), Context.getFloatTypeSemantics(T), /* UseNativeHalf = */ false); diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 52e519f304..b44e840533 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -2530,7 +2530,6 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) { case BuiltinType::Float: case BuiltinType::Double: case BuiltinType::LongDouble: - case BuiltinType::Float128: case BuiltinType::Char16: case BuiltinType::Char32: case BuiltinType::Int128: @@ -3350,8 +3349,8 @@ void ItaniumCXXABI::EmitFundamentalRTTIDescriptors() { getContext().UnsignedLongLongTy, getContext().Int128Ty, getContext().UnsignedInt128Ty, getContext().HalfTy, getContext().FloatTy, getContext().DoubleTy, - getContext().LongDoubleTy, getContext().Float128Ty, - getContext().Char16Ty, getContext().Char32Ty + getContext().LongDoubleTy, getContext().Char16Ty, + getContext().Char32Ty, }; for (const QualType &FundamentalType : FundamentalTypes) EmitFundamentalRTTIDescriptor(FundamentalType); diff --git a/lib/Format/FormatToken.cpp b/lib/Format/FormatToken.cpp index 2ae4ddcfd0..d6cd450d89 100644 --- a/lib/Format/FormatToken.cpp +++ b/lib/Format/FormatToken.cpp @@ -53,7 +53,6 @@ bool FormatToken::isSimpleTypeSpecifier() const { case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_wchar_t: case tok::kw_bool: case tok::kw___underlying_type: diff --git a/lib/Index/USRGeneration.cpp b/lib/Index/USRGeneration.cpp index 40283dcd68..65de75b5c4 100644 --- a/lib/Index/USRGeneration.cpp +++ b/lib/Index/USRGeneration.cpp @@ -618,8 +618,6 @@ void USRGenerator::VisitType(QualType T) { c = 'd'; break; case BuiltinType::LongDouble: c = 'D'; break; - case BuiltinType::Float128: - c = 'Q'; break; case BuiltinType::NullPtr: c = 'n'; break; #define BUILTIN_TYPE(Id, SingletonId) diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index e68b82fb49..27c80b9301 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -525,7 +525,6 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling, isHalf = false; isFloat = false; isImaginary = false; - isFloat128 = false; MicrosoftInteger = 0; hadError = false; @@ -568,17 +567,9 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling, case 'f': // FP Suffix for "float" case 'F': if (!isFPConstant) break; // Error for integer constant. - if (isHalf || isFloat || isLong || isFloat128) - break; // HF, FF, LF, QF invalid. + if (isHalf || isFloat || isLong) break; // HF, FF, LF invalid. isFloat = true; continue; // Success. - case 'q': // FP Suffix for "__float128" - case 'Q': - if (!isFPConstant) break; // Error for integer constant. - if (isHalf || isFloat || isLong || isFloat128) - break; // HQ, FQ, LQ, QQ invalid. - isFloat128 = true; - continue; // Success. case 'u': case 'U': if (isFPConstant) break; // Error for floating constant. @@ -588,7 +579,7 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling, case 'l': case 'L': if (isLong || isLongLong) break; // Cannot be repeated. - if (isHalf || isFloat || isFloat128) break; // LH, LF, LQ invalid. + if (isHalf || isFloat) break; // LH, LF invalid. // Check for long long. The L's need to be adjacent and the same case. if (s[1] == s[0]) { diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index ebe26cfb2d..b06eda9d23 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -3306,10 +3306,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, isInvalid = DS.SetTypeSpecType(DeclSpec::TST_double, Loc, PrevSpec, DiagID, Policy); break; - case tok::kw___float128: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_float128, Loc, PrevSpec, - DiagID, Policy); - break; case tok::kw_wchar_t: isInvalid = DS.SetTypeSpecType(DeclSpec::TST_wchar, Loc, PrevSpec, DiagID, Policy); @@ -4304,7 +4300,6 @@ bool Parser::isKnownToBeTypeSpecifier(const Token &Tok) const { case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_bool: case tok::kw__Bool: case tok::kw__Decimal32: @@ -4379,7 +4374,6 @@ bool Parser::isTypeSpecifierQualifier() { case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_bool: case tok::kw__Bool: case tok::kw__Decimal32: @@ -4534,7 +4528,6 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_bool: case tok::kw__Bool: case tok::kw__Decimal32: diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 5b7c839454..2745c33776 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -1166,7 +1166,6 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_void: case tok::kw_typename: case tok::kw_typeof: diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index b569e7aeba..afed9b1ab4 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -1928,9 +1928,6 @@ void Parser::ParseCXXSimpleTypeSpecifier(DeclSpec &DS) { case tok::kw_double: DS.SetTypeSpecType(DeclSpec::TST_double, Loc, PrevSpec, DiagID, Policy); break; - case tok::kw___float128: - DS.SetTypeSpecType(DeclSpec::TST_float128, Loc, PrevSpec, DiagID, Policy); - break; case tok::kw_wchar_t: DS.SetTypeSpecType(DeclSpec::TST_wchar, Loc, PrevSpec, DiagID, Policy); break; diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index 4d4bd806f3..747d0a982c 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -946,7 +946,6 @@ Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) { case tok::kw_char: case tok::kw_const: case tok::kw_double: - case tok::kw___float128: case tok::kw_enum: case tok::kw_half: case tok::kw_float: @@ -1427,7 +1426,6 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult, case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_void: case tok::annot_decltype: if (NextToken().is(tok::l_paren)) @@ -1519,7 +1517,6 @@ bool Parser::isCXXDeclarationSpecifierAType() { case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_void: case tok::kw___unknown_anytype: case tok::kw___auto_type: diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index ddfe6257cf..4bc1d3423b 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -289,7 +289,6 @@ bool Declarator::isDeclarationOfFunction() const { case TST_decimal32: case TST_decimal64: case TST_double: - case TST_float128: case TST_enum: case TST_error: case TST_float: @@ -458,7 +457,6 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T, case DeclSpec::TST_half: return "half"; case DeclSpec::TST_float: return "float"; case DeclSpec::TST_double: return "double"; - case DeclSpec::TST_float128: return "__float128"; case DeclSpec::TST_bool: return Policy.Bool ? "bool" : "_Bool"; case DeclSpec::TST_decimal32: return "_Decimal32"; case DeclSpec::TST_decimal64: return "_Decimal64"; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 13002ba19a..b0e79f6f0e 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -108,7 +108,6 @@ bool Sema::isSimpleTypeSpecifier(tok::TokenKind Kind) const { case tok::kw_half: case tok::kw_float: case tok::kw_double: - case tok::kw___float128: case tok::kw_wchar_t: case tok::kw_bool: case tok::kw___underlying_type: diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index bd56596446..0f47e9e099 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1155,48 +1155,6 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS, /*convertFloat=*/!IsCompAssign); } -/// \brief Diagnose attempts to convert between __float128 and long double if -/// there is no support for such conversion. Helper function of -/// UsualArithmeticConversions(). -static bool unsupportedTypeConversion(const Sema &S, QualType LHSType, - QualType RHSType) { - /* No issue converting if at least one of the types is not a floating point - type or the two types have the same rank. - */ - if (!LHSType->isFloatingType() || !RHSType->isFloatingType() || - S.Context.getFloatingTypeOrder(LHSType, RHSType) == 0) - return false; - - assert(LHSType->isFloatingType() && RHSType->isFloatingType() && - "The remaining types must be floating point types."); - - auto *LHSComplex = LHSType->getAs(); - auto *RHSComplex = RHSType->getAs(); - - QualType LHSElemType = LHSComplex ? - LHSComplex->getElementType() : LHSType; - QualType RHSElemType = RHSComplex ? - RHSComplex->getElementType() : RHSType; - - // No issue if the two types have the same representation - if (&S.Context.getFloatTypeSemantics(LHSElemType) == - &S.Context.getFloatTypeSemantics(RHSElemType)) - return false; - - bool Float128AndLongDouble = (LHSElemType == S.Context.Float128Ty && - RHSElemType == S.Context.LongDoubleTy); - Float128AndLongDouble |= (LHSElemType == S.Context.LongDoubleTy && - RHSElemType == S.Context.Float128Ty); - - /* We've handled the situation where __float128 and long double have the same - representation. The only other allowable conversion is if long double is - really just double. - */ - return Float128AndLongDouble && - (&S.Context.getFloatTypeSemantics(S.Context.LongDoubleTy) != - &llvm::APFloat::IEEEdouble); -} - typedef ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType); namespace { @@ -1360,11 +1318,6 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, // At this point, we have two different arithmetic types. - // Diagnose attempts to convert between __float128 and long double where - // such conversions currently can't be handled. - if (unsupportedTypeConversion(*this, LHSType, RHSType)) - return QualType(); - // Handle complex types first (C99 6.3.1.8p1). if (LHSType->isComplexType() || RHSType->isComplexType()) return handleComplexFloatConversion(*this, LHS, RHS, LHSType, RHSType, @@ -3372,12 +3325,10 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { } } else if (Literal.isFloat) Ty = Context.FloatTy; - else if (Literal.isLong) - Ty = Context.LongDoubleTy; - else if (Literal.isFloat128) - Ty = Context.Float128Ty; - else + else if (!Literal.isLong) Ty = Context.DoubleTy; + else + Ty = Context.LongDoubleTy; Res = BuildFloatingLiteral(*this, Literal, Ty, Tok.getLocation()); @@ -6651,15 +6602,6 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, QualType LHSTy = LHS.get()->getType(); QualType RHSTy = RHS.get()->getType(); - // Diagnose attempts to convert between __float128 and long double where - // such conversions currently can't be handled. - if (unsupportedTypeConversion(*this, LHSTy, RHSTy)) { - Diag(QuestionLoc, - diag::err_typecheck_cond_incompatible_operands) << LHSTy << RHSTy - << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); - return QualType(); - } - // OpenCL v2.0 s6.12.5 - Blocks cannot be used as expressions of the ternary // selection operator (?:). if (getLangOpts().OpenCL && @@ -7393,11 +7335,6 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, return Incompatible; } - // Diagnose attempts to convert between __float128 and long double where - // such conversions currently can't be handled. - if (unsupportedTypeConversion(*this, LHSType, RHSType)) - return Incompatible; - // Arithmetic conversions. if (LHSType->isArithmeticType() && RHSType->isArithmeticType() && !(getLangOpts().CPlusPlus && LHSType->isEnumeralType())) { diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 0b09809688..4c677e33e9 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -5172,12 +5172,6 @@ QualType Sema::CXXCheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, QualType ResTy = UsualArithmeticConversions(LHS, RHS); if (LHS.isInvalid() || RHS.isInvalid()) return QualType(); - if (ResTy.isNull()) { - Diag(QuestionLoc, - diag::err_typecheck_cond_incompatible_operands) << LTy << RTy - << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); - return QualType(); - } LHS = ImpCastExprToType(LHS.get(), ResTy, PrepareScalarCast(LHS, ResTy)); RHS = ImpCastExprToType(RHS.get(), ResTy, PrepareScalarCast(RHS, ResTy)); diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index fdf5346d92..08133d6889 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -681,6 +681,13 @@ static bool LookupBuiltin(Sema &S, LookupResult &R) { NameKind == Sema::LookupRedeclarationWithLinkage) { IdentifierInfo *II = R.getLookupName().getAsIdentifierInfo(); if (II) { + if (S.getLangOpts().CPlusPlus11 && S.getLangOpts().GNUMode && + II == S.getFloat128Identifier()) { + // libstdc++4.7's type_traits expects type __float128 to exist, so + // insert a dummy type to make that header build in gnu++11 mode. + R.addDecl(S.getASTContext().getFloat128StubType()); + return true; + } if (S.getLangOpts().CPlusPlus && NameKind == Sema::LookupOrdinaryName && II == S.getASTContext().getMakeIntegerSeqName()) { R.addDecl(S.getASTContext().getMakeIntegerSeqDecl()); diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index e3a72c1e22..034b090fdf 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1671,20 +1671,6 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, SCS.Second = ICK_Complex_Real; FromType = ToType.getUnqualifiedType(); } else if (FromType->isRealFloatingType() && ToType->isRealFloatingType()) { - // FIXME: disable conversions between long double and __float128 if - // their representation is different until there is back end support - // We of course allow this conversion if long double is really double. - if (&S.Context.getFloatTypeSemantics(FromType) != - &S.Context.getFloatTypeSemantics(ToType)) { - bool Float128AndLongDouble = ((FromType == S.Context.Float128Ty && - ToType == S.Context.LongDoubleTy) || - (FromType == S.Context.LongDoubleTy && - ToType == S.Context.Float128Ty)); - if (Float128AndLongDouble && - (&S.Context.getFloatTypeSemantics(S.Context.LongDoubleTy) != - &llvm::APFloat::IEEEdouble)) - return false; - } // Floating point conversions (C++ 4.8). SCS.Second = ICK_Floating_Conversion; FromType = ToType.getUnqualifiedType(); @@ -1987,8 +1973,7 @@ bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) { if (!getLangOpts().CPlusPlus && (FromBuiltin->getKind() == BuiltinType::Float || FromBuiltin->getKind() == BuiltinType::Double) && - (ToBuiltin->getKind() == BuiltinType::LongDouble || - ToBuiltin->getKind() == BuiltinType::Float128)) + (ToBuiltin->getKind() == BuiltinType::LongDouble)) return true; // Half can be promoted to float. @@ -7213,13 +7198,13 @@ class BuiltinOperatorOverloadBuilder { // provided via the getArithmeticType() method below. // The "promoted arithmetic types" are the arithmetic // types are that preserved by promotion (C++ [over.built]p2). - static const unsigned FirstIntegralType = 4; - static const unsigned LastIntegralType = 21; - static const unsigned FirstPromotedIntegralType = 4, - LastPromotedIntegralType = 12; + static const unsigned FirstIntegralType = 3; + static const unsigned LastIntegralType = 20; + static const unsigned FirstPromotedIntegralType = 3, + LastPromotedIntegralType = 11; static const unsigned FirstPromotedArithmeticType = 0, - LastPromotedArithmeticType = 12; - static const unsigned NumArithmeticTypes = 21; + LastPromotedArithmeticType = 11; + static const unsigned NumArithmeticTypes = 20; /// \brief Get the canonical type for a given arithmetic type index. CanQualType getArithmeticType(unsigned index) { @@ -7230,7 +7215,6 @@ class BuiltinOperatorOverloadBuilder { &ASTContext::FloatTy, &ASTContext::DoubleTy, &ASTContext::LongDoubleTy, - &ASTContext::Float128Ty, // Start of integral types. &ASTContext::IntTy, diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index 52a1ad545a..c23b5a2adc 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -727,7 +727,6 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) { case TST_half: case TST_float: case TST_double: - case TST_float128: case TST_bool: case TST_decimal32: case TST_decimal64: diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 85a27afb26..6fe78cd466 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1354,8 +1354,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { } case DeclSpec::TST_int128: if (!S.Context.getTargetInfo().hasInt128Type()) - S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported) - << "__int128"; + S.Diag(DS.getTypeSpecTypeLoc(), diag::err_int128_unsupported); if (DS.getTypeSpecSign() == DeclSpec::TSS_unsigned) Result = Context.UnsignedInt128Ty; else @@ -1377,12 +1376,6 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { declarator.setInvalidType(true); } break; - case DeclSpec::TST_float128: - if (!S.Context.getTargetInfo().hasFloat128Type()) - S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported) - << "__float128"; - Result = Context.Float128Ty; - break; case DeclSpec::TST_bool: Result = Context.BoolTy; break; // _Bool or bool break; case DeclSpec::TST_decimal32: // _Decimal32 @@ -6965,6 +6958,13 @@ bool Sema::RequireCompleteTypeImpl(SourceLocation Loc, QualType T, if (!Diagnoser) return true; + // We have an incomplete type. Produce a diagnostic. + if (Ident___float128 && + T == Context.getTypeDeclType(Context.getFloat128StubType())) { + Diag(Loc, diag::err_typecheck_decl_incomplete_type___float128); + return true; + } + Diagnoser->diagnose(*this, Loc, T); // If the type was a forward declaration of a class/struct/union diff --git a/lib/Serialization/ASTCommon.cpp b/lib/Serialization/ASTCommon.cpp index 792fac99e5..2382f8ea4b 100644 --- a/lib/Serialization/ASTCommon.cpp +++ b/lib/Serialization/ASTCommon.cpp @@ -91,9 +91,6 @@ serialization::TypeIdxFromBuiltin(const BuiltinType *BT) { case BuiltinType::LongDouble: ID = PREDEF_TYPE_LONGDOUBLE_ID; break; - case BuiltinType::Float128: - ID = PREDEF_TYPE_FLOAT128_ID; - break; case BuiltinType::NullPtr: ID = PREDEF_TYPE_NULLPTR_ID; break; diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 5c4371bfef..5cf0eb43dc 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -6037,9 +6037,6 @@ QualType ASTReader::GetType(TypeID ID) { case PREDEF_TYPE_LONGDOUBLE_ID: T = Context.LongDoubleTy; break; - case PREDEF_TYPE_FLOAT128_ID: - T = Context.Float128Ty; - break; case PREDEF_TYPE_OVERLOAD_ID: T = Context.OverloadTy; break; diff --git a/test/CodeGenCXX/float128-declarations.cpp b/test/CodeGenCXX/float128-declarations.cpp deleted file mode 100644 index 638f56fd0d..0000000000 --- a/test/CodeGenCXX/float128-declarations.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm -triple powerpc64-unknown-unknown \ -// RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown \ -// RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s -// -/* Various contexts where type __float128 can appear. */ - -/* Namespace */ -namespace { - __float128 f1n; - __float128 f2n = 33.q; - __float128 arr1n[10]; - __float128 arr2n[] = { 1.2q, 3.0q, 3.e11q }; - const volatile __float128 func1n(const __float128 &arg) { - return arg + f2n + arr1n[4] - arr2n[1]; - } -} - -/* File */ -__float128 f1f; -__float128 f2f = 32.4q; -static __float128 f3f = f2f; -__float128 arr1f[10]; -__float128 arr2f[] = { -1.2q, -3.0q, -3.e11q }; -__float128 func1f(__float128 arg); - -/* Class */ -class C1 { - __float128 f1c; - static const __float128 f2c; - volatile __float128 f3c; -public: - C1(__float128 arg) : f1c(arg), f3c(arg) { } - __float128 func1c(__float128 arg ) { - return f1c + arg; - } - static __float128 func2c(__float128 arg) { - return arg * C1::f2c; - } -}; - -/* Template */ -template C func1t(C arg) { return arg * 2.q; } -template struct S1 { - C mem1; -}; -template <> struct S1<__float128> { - __float128 mem2; -}; - -/* Local */ -int main(void) { - __float128 f1l = 123e220q; - __float128 f2l = -0.q; - __float128 f3l = 1.189731495357231765085759326628007e4932q; - C1 c1(f1l); - S1<__float128> s1 = { 132.q }; - __float128 f4l = func1n(f1l) + func1f(f2l) + c1.func1c(f3l) + c1.func2c(f1l) + - func1t(f1l) + s1.mem2 - f1n + f2n; -#if (__cplusplus >= 201103L) - auto f5l = -1.q, *f6l = &f2l, f7l = func1t(f3l); -#endif - __float128 f8l = f4l++; - __float128 arr1l[] = { -1.q, -0.q, -11.q }; -} -// CHECK-DAG: @_ZN12_GLOBAL__N_13f1nE = internal global fp128 0xL00000000000000000000000000000000 -// CHECK-DAG: @_ZN12_GLOBAL__N_13f2nE = internal global fp128 0xL00000000000000004004080000000000 -// CHECK-DAG: @_ZN12_GLOBAL__N_15arr1nE = internal global [10 x fp128] -// CHECK-DAG: @_ZN12_GLOBAL__N_15arr2nE = internal global [3 x fp128] [fp128 0xL33333333333333333FFF333333333333, fp128 0xL00000000000000004000800000000000, fp128 0xL00000000000000004025176592E00000] -// CHECK-DAG: define internal fp128 @_ZN12_GLOBAL__N_16func1nERKU10__float128(fp128* -// CHECK-DAG: @f1f = global fp128 0xL00000000000000000000000000000000 -// CHECK-DAG: @f2f = global fp128 0xL33333333333333334004033333333333 -// CHECK-DAG: @arr1f = global [10 x fp128] -// CHECK-DAG: @arr2f = global [3 x fp128] [fp128 0xL3333333333333333BFFF333333333333, fp128 0xL0000000000000000C000800000000000, fp128 0xL0000000000000000C025176592E00000] -// CHECK-DAG: declare fp128 @_Z6func1fU10__float128(fp128) -// CHECK-DAG: define linkonce_odr void @_ZN2C1C2EU10__float128(%class.C1* %this, fp128 %arg) -// CHECK-DAG: define linkonce_odr fp128 @_ZN2C16func2cEU10__float128(fp128 %arg) -// CHECK-DAG: define linkonce_odr fp128 @_Z6func1tIU10__float128ET_S0_(fp128 %arg) -// CHECK-DAG: @_ZZ4mainE2s1 = private unnamed_addr constant %struct.S1 { fp128 0xL00000000000000004006080000000000 } -// CHECK-DAG: store fp128 0xLF0AFD0EBFF292DCE42E0B38CDD83F26F, fp128* %f1l, align 16 -// CHECK-DAG: store fp128 0xL00000000000000008000000000000000, fp128* %f2l, align 16 -// CHECK-DAG: store fp128 0xLFFFFFFFFFFFFFFFF7FFEFFFFFFFFFFFF, fp128* %f3l, align 16 -// CHECK-DAG: store fp128 0xL0000000000000000BFFF000000000000, fp128* %f5l, align 16 -// CHECK-DAG: [[F4L:%[a-z0-9]+]] = load fp128, fp128* %f4l -// CHECK-DAG: [[INC:%[a-z0-9]+]] = fadd fp128 [[F4L]], 0xL00000000000000003FFF000000000000 -// CHECK-DAG: store fp128 [[INC]], fp128* %f4l diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index cc6eecc734..dbd4de605e 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -5819,9 +5819,6 @@ // PPCPOWER8:#define _ARCH_PWR7 1 // PPCPOWER8:#define _ARCH_PWR8 1 // -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +float128 -target-cpu power8 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-FLOAT128 %s -// PPC-FLOAT128:#define __FLOAT128__ 1 -// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-linux-gnu -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC64-LINUX %s // // PPC64-LINUX:#define _ARCH_PPC 1 diff --git a/test/Sema/128bitfloat.cpp b/test/Sema/128bitfloat.cpp index 779c59dfd4..cb76dac960 100644 --- a/test/Sema/128bitfloat.cpp +++ b/test/Sema/128bitfloat.cpp @@ -2,23 +2,23 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s #if !defined(__STRICT_ANSI__) -__float128 f; // expected-error {{__float128 is not supported on this target}} +__float128 f; // expected-error {{support for type '__float128' is not yet implemented}} // But this should work: template struct __is_floating_point_helper {}; -template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}} +template<> struct __is_floating_point_helper<__float128> {}; // FIXME: This could have a better diag. -int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}} - return x + *y; +void g(int x, __float128 *y) { + x + *y; // expected-error {{invalid operands to binary expression ('int' and '__float128')}} } #else -__float128 f; // expected-error {{__float128 is not supported on this target}} +__float128 f; // expected-error {{unknown type name '__float128'}} template struct __is_floating_point_helper {}; -template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}} +template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{use of undeclared identifier '__float128'}} -int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}} - return x + *y; +void g(int x, __float128 *y) { // expected-error {{unknown type name '__float128'}} + x + *y; } #endif diff --git a/test/Sema/float128-ld-incompatibility.cpp b/test/Sema/float128-ld-incompatibility.cpp deleted file mode 100644 index d993ed7b08..0000000000 --- a/test/Sema/float128-ld-incompatibility.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 \ -// RUN: -triple powerpc64le-unknown-linux-gnu -target-cpu pwr8 \ -// RUN: -target-feature +float128 %s - -__float128 qf(); -long double ldf(); - -// FIXME: once operations between long double and __float128 are implemented for -// targets where the types are different, these next two will change -long double ld{qf()}; // expected-error {{cannot initialize a variable of type 'long double' with an rvalue of type '__float128'}} -__float128 q{ldf()}; // expected-error {{cannot initialize a variable of type '__float128' with an rvalue of type 'long double'}} - -auto test1(__float128 q, long double ld) -> decltype(q + ld) { // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} - return q + ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} -} - -auto test2(long double a, __float128 b) -> decltype(a + b) { // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} - return a + b; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} -} - -void test3(bool b) { - long double ld; - __float128 q; - - ld + q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} - q + ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} - ld - q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} - q - ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} - ld * q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} - q * ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} - ld / q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} - q / ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} - ld = q; // expected-error {{assigning to 'long double' from incompatible type '__float128'}} - q = ld; // expected-error {{assigning to '__float128' from incompatible type 'long double'}} - q + b ? q : ld; // expected-error {{incompatible operand types ('__float128' and 'long double')}} -} diff --git a/test/SemaCXX/deleted-operator.cpp b/test/SemaCXX/deleted-operator.cpp index f71e83aa25..df67978a36 100644 --- a/test/SemaCXX/deleted-operator.cpp +++ b/test/SemaCXX/deleted-operator.cpp @@ -9,7 +9,7 @@ int PR10757f() { PR10757 a1; // FIXME: We get a ridiculous number of "built-in candidate" notes here... if(~a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 8 {{built-in candidate}} - if(a1==a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 144 {{built-in candidate}} + if(a1==a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 121 {{built-in candidate}} } struct DelOpDel { diff --git a/test/SemaCXX/overloaded-builtin-operators.cpp b/test/SemaCXX/overloaded-builtin-operators.cpp index 7a99a898e2..4c2953b0b3 100644 --- a/test/SemaCXX/overloaded-builtin-operators.cpp +++ b/test/SemaCXX/overloaded-builtin-operators.cpp @@ -183,7 +183,7 @@ void test_dr425(A a) { // FIXME: lots of candidates here! (void)(1.0f * a); // expected-error{{ambiguous}} \ // expected-note 4{{candidate}} \ - // expected-note {{remaining 140 candidates omitted; pass -fshow-overloads=all to show them}} + // expected-note {{remaining 117 candidates omitted; pass -fshow-overloads=all to show them}} } // pr5432 diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp index ea955625aa..5cde236055 100644 --- a/tools/libclang/CXType.cpp +++ b/tools/libclang/CXType.cpp @@ -51,7 +51,6 @@ static CXTypeKind GetBuiltinTypeKind(const BuiltinType *BT) { BTCASE(Float); BTCASE(Double); BTCASE(LongDouble); - BTCASE(Float128); BTCASE(NullPtr); BTCASE(Overload); BTCASE(Dependent); @@ -467,7 +466,6 @@ CXString clang_getTypeKindSpelling(enum CXTypeKind K) { TKIND(Float); TKIND(Double); TKIND(LongDouble); - TKIND(Float128); TKIND(NullPtr); TKIND(Overload); TKIND(Dependent);