diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -109,6 +109,7 @@ LANGOPT(Half , 1, 0, "half keyword") LANGOPT(WChar , 1, CPlusPlus, "wchar_t keyword") LANGOPT(Char8 , 1, 0, "char8_t keyword") +LANGOPT(IEEE128 , 1, 0, "__ieee128 keyword") LANGOPT(DeclSpecKeyword , 1, 0, "__declspec keyword") BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers") BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode") diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -227,6 +227,9 @@ if (LangOpts.DeclSpecKeyword) AddKeyword("__declspec", tok::kw___declspec, KEYALL, LangOpts, *this); + if (LangOpts.IEEE128) + AddKeyword("__ieee128", tok::kw___float128, KEYALL, LangOpts, *this); + // Add the 'import' contextual keyword. get("import").setModulesImport(true); } diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -566,6 +566,7 @@ LongDoubleFormat = Opts.PPCIEEELongDouble ? &llvm::APFloat::IEEEquad() : &llvm::APFloat::PPCDoubleDouble(); + Opts.IEEE128 = 1; } ArrayRef PPCTargetInfo::getTargetBuiltins() const { diff --git a/clang/test/Sema/128bitfloat.cpp b/clang/test/Sema/128bitfloat.cpp --- a/clang/test/Sema/128bitfloat.cpp +++ b/clang/test/Sema/128bitfloat.cpp @@ -6,6 +6,13 @@ // RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) + +#if defined(__ppc__) +template struct __is_float128 { static constexpr bool value = false; }; +template <> struct __is_float128<__float128> { static constexpr bool value = true; }; +static_assert(__is_float128<__ieee128>::value, "__ieee128 aliases to __float128"); +#endif + __float128 f; template struct __is_floating_point_helper {}; template<> struct __is_floating_point_helper<__float128> {};