[clang] cec7c2b - Revert "[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly"
Zahira Ammarguellat via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 1 04:59:59 PDT 2021
Author: Zahira Ammarguellat
Date: 2021-09-01T04:48:50-07:00
New Revision: cec7c2b32ecfd38151822a6e01ec78afaf98bf9a
URL: https://github.com/llvm/llvm-project/commit/cec7c2b32ecfd38151822a6e01ec78afaf98bf9a
DIFF: https://github.com/llvm/llvm-project/commit/cec7c2b32ecfd38151822a6e01ec78afaf98bf9a.diff
LOG: Revert "[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly"
The intent of this patch is to add support of -fp-model=[source|double|extended] to allow
the compiler to use a wider type for intermediate floating point calculations. As a side
effect to that, the value of FLT_EVAL_METHOD is changed according to the pragma
float_control.
Unfortunately some issue was uncovered with this change in preprocessing. See details in
https://reviews.llvm.org/D93769 . We are therefore reverting this patch until we find a way
to reconcile the value of FLT_EVAL_METHOD, the pragma and the -E flow.
This reverts commit 66ddac22e2a7f268e91c26d694112970dfa607ae.
Added:
Modified:
clang/docs/LanguageExtensions.rst
clang/docs/UsersManual.rst
clang/include/clang/Basic/FPOptions.def
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangOptions.h
clang/include/clang/Basic/PragmaKinds.h
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Driver/Options.td
clang/include/clang/Lex/Preprocessor.h
clang/include/clang/Lex/PreprocessorOptions.h
clang/include/clang/Sema/Sema.h
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/X86.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Parse/ParsePragma.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaAttr.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGen/fp-floatcontrol-pragma.cpp
clang/test/Preprocessor/init-aarch64.c
clang/test/Preprocessor/init-arm.c
clang/test/Preprocessor/init-mips.c
clang/test/Preprocessor/init-ppc.c
clang/test/Preprocessor/init-ppc64.c
clang/test/Preprocessor/init-s390x.c
clang/test/Preprocessor/init-v7k-compat.c
clang/test/Preprocessor/init-x86.c
clang/test/Preprocessor/init.c
Removed:
################################################################################
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 3193c8cdc11e..28791a48a6c0 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3579,7 +3579,7 @@ specification, a stack is supported so that the ``pragma float_control``
settings can be pushed or popped.
When ``pragma float_control(precise, on)`` is enabled, the section of code
-governed by the pragma uses precise floating-point semantics, effectively
+governed by the pragma uses precise floating point semantics, effectively
``-ffast-math`` is disabled and ``-ffp-contract=on``
(fused multiply add) is enabled.
@@ -3590,29 +3590,8 @@ when ``pragma float_control(precise, off)`` is enabled, the section of code
governed by the pragma behaves as though the command-line option
``-ffp-exception-behavior=ignore`` is enabled.
-When ``pragma float_control(source, on)`` is enabled, the section of code governed
-by the pragma behaves as though the command-line option
-``-ffp-eval-method=source`` is enabled. Note: The default
-floating-point evaluation method is target-specific, typically ``source``.
-
-When ``pragma float_control(double, on)`` is enabled, the section of code governed
-by the pragma behaves as though the command-line option
-``-ffp-eval-method=double`` is enabled.
-
-When ``pragma float_control(extended, on)`` is enabled, the section of code governed
-by the pragma behaves as though the command-line option
-``-ffp-eval-method=extended`` is enabled.
-
-When ``pragma float_control(source, off)`` or
-``pragma float_control(double, off)`` or
-``pragma float_control(extended, off)`` is enabled,
-the section of code governed
-by the pragma behaves as though the command-line option
-``-ffp-eval-method=source`` is enabled, returning floating-point evaluation
-method to the default setting.
-
The full syntax this pragma supports is
-``float_control(except|precise|source|double|extended, on|off [, push])`` and
+``float_control(except|precise, on|off [, push])`` and
``float_control(push|pop)``.
The ``push`` and ``pop`` forms, including using ``push`` as the optional
third argument, can only occur at file scope.
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index f8a2f39f6522..f025028c1721 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -1478,17 +1478,6 @@ Note that floating-point operations performed as part of constant initialization
* ``maytrap`` The compiler avoids transformations that may raise exceptions that would not have been raised by the original code. Constant folding performed by the compiler is exempt from this option.
* ``strict`` The compiler ensures that all transformations strictly preserve the floating point exception semantics of the original code.
-.. option:: -ffp-eval-method=<value>
-
- Specify the floating-point evaluation method.
-
- Valid values are: ``source``, ``double``, and ``extended``.
- The default value is target-specific, typically ``source``. Details:
-
- * ``source`` The compiler uses the floating-point type declared in the source program as the evaluation method.
- * ``double`` The compiler uses ``double`` as the floating-point evaluation method for all float expressions of type that is narrower than ``double``.
- * ``extended`` The compiler uses ``long double`` as the floating-point evaluation method for all float expressions of type that is narrower than ``long double``.
-
.. option:: -f[no-]protect-parens:
This option pertains to floating-point types, complex types with
diff --git a/clang/include/clang/Basic/FPOptions.def b/clang/include/clang/Basic/FPOptions.def
index 224c1827144f..a93fa475cd5f 100644
--- a/clang/include/clang/Basic/FPOptions.def
+++ b/clang/include/clang/Basic/FPOptions.def
@@ -23,5 +23,4 @@ OPTION(NoHonorInfs, bool, 1, NoHonorNaNs)
OPTION(NoSignedZero, bool, 1, NoHonorInfs)
OPTION(AllowReciprocal, bool, 1, NoSignedZero)
OPTION(AllowApproxFunc, bool, 1, AllowReciprocal)
-OPTION(FPEvalMethod, LangOptions::FPEvalMethodKind, 2, AllowApproxFunc)
#undef OPTION
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 3e4c12b62daa..d5e2ee80d691 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -298,7 +298,6 @@ BENIGN_ENUM_LANGOPT(DefaultFPContractMode, FPModeKind, 2, FPM_Off, "FP contracti
COMPATIBLE_LANGOPT(ExpStrictFP, 1, false, "Enable experimental strict floating point")
BENIGN_ENUM_LANGOPT(FPRoundingMode, RoundingMode, 3, RoundingMode::NearestTiesToEven, "FP Rounding Mode type")
BENIGN_ENUM_LANGOPT(FPExceptionMode, FPExceptionModeKind, 2, FPE_Ignore, "FP Exception Behavior Mode type")
-BENIGN_ENUM_LANGOPT(FPEvalMethod, FPEvalMethodKind, 2, FEM_TargetDefault, "FP type used for floating point arithmetic")
LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index 43e33c7029b8..35b33c2e0971 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -233,19 +233,6 @@ class LangOptions : public LangOptionsBase {
/// Possible exception handling behavior.
enum class ExceptionHandlingKind { None, SjLj, WinEH, DwarfCFI, Wasm };
- /// Possible float expression evaluation method choices.
- enum FPEvalMethodKind {
- /// Use the declared type for fp arithmetic.
- FEM_Source,
- /// Use the type double for fp arithmetic.
- FEM_Double,
- /// Use extended type for fp arithmetic.
- FEM_Extended,
- /// Use the default float eval method specified by Target:
- // most targets are defined with evaluation method FEM_Source.
- FEM_TargetDefault
- };
-
enum class LaxVectorConversionKind {
/// Permit no implicit vector bitcasts.
None,
@@ -550,7 +537,6 @@ class FPOptions {
setAllowFEnvAccess(true);
else
setAllowFEnvAccess(LangOptions::FPM_Off);
- setFPEvalMethod(LO.getFPEvalMethod());
}
bool allowFPContractWithinStatement() const {
diff --git a/clang/include/clang/Basic/PragmaKinds.h b/clang/include/clang/Basic/PragmaKinds.h
index 24b6858e8c23..82c0d5f0a551 100644
--- a/clang/include/clang/Basic/PragmaKinds.h
+++ b/clang/include/clang/Basic/PragmaKinds.h
@@ -32,10 +32,7 @@ enum PragmaFloatControlKind {
PFC_Except, // #pragma float_control(except [,on])
PFC_NoExcept, // #pragma float_control(except, off)
PFC_Push, // #pragma float_control(push)
- PFC_Pop, // #pragma float_control(pop)
- PFC_Source, // #pragma float_control(source, {on|off} [,push])
- PFC_Double, // #pragma float_control(double, {on|off} [,push])
- PFC_Extended, // #pragma float_control(extended, {on|off} [,push])
+ PFC_Pop // #pragma float_control(pop)
};
}
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index fe6f67d40b53..c0e2b758d3ea 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -684,8 +684,7 @@ class TargetInfo : public virtual TransferrableTargetInfo,
}
/// Return the value for the C99 FLT_EVAL_METHOD macro.
- // Note: implementation defined values may be negative.
- virtual int getFPEvalMethod() const { return 0; }
+ virtual unsigned getFloatEvalMethod() const { return 0; }
// getLargeArrayMinWidth/Align - Return the minimum array size that is
// 'large' and its alignment.
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 9f539c9b5619..100e07b649c8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1463,11 +1463,6 @@ def : Flag<["-"], "fextended-identifiers">, Group<clang_ignored_f_Group>;
def : Flag<["-"], "fno-extended-identifiers">, Group<f_Group>, Flags<[Unsupported]>;
def fhosted : Flag<["-"], "fhosted">, Group<f_Group>;
def fdenormal_fp_math_EQ : Joined<["-"], "fdenormal-fp-math=">, Group<f_Group>, Flags<[CC1Option]>;
-def ffp_eval_method_EQ : Joined<["-"], "ffp-eval-method=">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Specifies the evaluation method to use for floating-point arithmetic.">,
- Values<"source,double,extended">, NormalizedValuesScope<"LangOptions">,
- NormalizedValues<["FEM_Source", "FEM_Double", "FEM_Extended"]>,
- MarshallingInfoEnum<LangOpts<"FPEvalMethod">, "FEM_TargetDefault">;
def ffp_model_EQ : Joined<["-"], "ffp-model=">, Group<f_Group>, Flags<[NoXarchOption]>,
HelpText<"Controls the semantics of floating-point calculations.">;
def ffp_exception_behavior_EQ : Joined<["-"], "ffp-exception-behavior=">, Group<f_Group>, Flags<[CC1Option]>,
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index a6c7d0bf0e5b..1c7573ec87e1 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -179,17 +179,12 @@ class Preprocessor {
IdentifierInfo *Ident__is_target_vendor; // __is_target_vendor
IdentifierInfo *Ident__is_target_os; // __is_target_os
IdentifierInfo *Ident__is_target_environment; // __is_target_environment
- IdentifierInfo *Ident__FLT_EVAL_METHOD__ = nullptr; // __FLT_EVAL_METHOD__
// Weak, only valid (and set) while InMacroArgs is true.
Token* ArgMacro;
SourceLocation DATELoc, TIMELoc;
- // Corresponding to __FLT_EVAL_METHOD__. Initialized from TargetInfo
- // or the command line. Implementation-defined values can be negative.
- int CurrentFPEvalMethod = 0;
-
// Next __COUNTER__ value, starts at 0.
unsigned CounterValue = 0;
@@ -2008,8 +2003,6 @@ class Preprocessor {
}
unsigned getCounterValue() const { return CounterValue; }
void setCounterValue(unsigned V) { CounterValue = V; }
- int getCurrentFPEvalMethod() const { return CurrentFPEvalMethod; }
- void setCurrentFPEvalMethod(int V) { CurrentFPEvalMethod = V; }
/// Retrieves the module that we're currently building, if any.
Module *getCurrentModule();
diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h
index eea0c1a2986e..a7aabc3e1df2 100644
--- a/clang/include/clang/Lex/PreprocessorOptions.h
+++ b/clang/include/clang/Lex/PreprocessorOptions.h
@@ -146,9 +146,6 @@ class PreprocessorOptions {
/// When enabled, the preprocessor will construct editor placeholder tokens.
bool LexEditorPlaceholders = true;
- /// When enabled, the preprocessor will expand special builtin macros.
- bool LexExpandSpecialBuiltins = true;
-
/// True if the SourceManager should report the original file name for
/// contents of files that were remapped to other files. Defaults to true.
bool RemappedFilesKeepOriginalName = true;
@@ -249,7 +246,6 @@ class PreprocessorOptions {
ImplicitPCHInclude.clear();
SingleFileParseMode = false;
LexEditorPlaceholders = true;
- LexExpandSpecialBuiltins = true;
RetainRemappedFileBuffers = true;
PrecompiledPreambleBytes.first = 0;
PrecompiledPreambleBytes.second = false;
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index d5c685ee9791..7e900ec032b9 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1502,15 +1502,19 @@ class Sema final {
/// statements.
class FPFeaturesStateRAII {
public:
- FPFeaturesStateRAII(Sema &S);
- ~FPFeaturesStateRAII();
+ FPFeaturesStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.CurFPFeatures) {
+ OldOverrides = S.FpPragmaStack.CurrentValue;
+ }
+ ~FPFeaturesStateRAII() {
+ S.CurFPFeatures = OldFPFeaturesState;
+ S.FpPragmaStack.CurrentValue = OldOverrides;
+ }
FPOptionsOverride getOverrides() { return OldOverrides; }
private:
Sema& S;
FPOptions OldFPFeaturesState;
FPOptionsOverride OldOverrides;
- int OldEvalMethod;
};
void addImplicitTypedef(StringRef Name, QualType T);
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index e9dcc9e84dd7..8004bc0f62f0 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -737,7 +737,7 @@ class AIXTargetInfo : public OSTargetInfo<Target> {
}
// AIX sets FLT_EVAL_METHOD to be 1.
- int getFPEvalMethod() const override { return 1; }
+ unsigned getFloatEvalMethod() const override { return 1; }
bool hasInt128Type() const override { return false; }
bool defaultsToAIXPowerAlignment() const override { return true; }
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 19b5b6d3063e..b94eb880f90f 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -166,7 +166,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
return LongDoubleFormat == &llvm::APFloat::IEEEquad() ? "g" : "e";
}
- int getFPEvalMethod() const override {
+ unsigned getFloatEvalMethod() const override {
// X87 evaluates with 80 bits "long double" precision.
return SSELevel == NoSSE ? 2 : 0;
}
@@ -469,12 +469,12 @@ class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
- int getFPEvalMethod() const override {
+ unsigned getFloatEvalMethod() const override {
unsigned Major, Minor, Micro;
getTriple().getOSVersion(Major, Minor, Micro);
// New NetBSD uses the default rounding mode.
if (Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 26) || Major == 0)
- return X86_32TargetInfo::getFPEvalMethod();
+ return X86_32TargetInfo::getFloatEvalMethod();
// NetBSD before 6.99.26 defaults to "double" rounding.
return 1;
}
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 95df7604bfbd..d6146b57b624 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2632,8 +2632,6 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
StringRef FPModel = "";
// -ffp-exception-behavior options: strict, maytrap, ignore
StringRef FPExceptionBehavior = "";
- // -ffp-eval-method options: double, extended, source
- StringRef FPEvalMethod = "";
const llvm::DenormalMode DefaultDenormalFPMath =
TC.getDefaultDenormalModeForType(Args, JA);
const llvm::DenormalMode DefaultDenormalFP32Math =
@@ -2825,18 +2823,6 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
break;
}
- // Validate and pass through -ffp-eval-method option.
- case options::OPT_ffp_eval_method_EQ: {
- StringRef Val = A->getValue();
- if (Val.equals("double") || Val.equals("extended") ||
- Val.equals("source"))
- FPEvalMethod = Val;
- else
- D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
- break;
- }
-
case options::OPT_ffinite_math_only:
HonorINFs = false;
HonorNaNs = false;
@@ -2981,9 +2967,6 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
CmdArgs.push_back(Args.MakeArgString("-ffp-exception-behavior=" +
FPExceptionBehavior));
- if (!FPEvalMethod.empty())
- CmdArgs.push_back(Args.MakeArgString("-ffp-eval-method=" + FPEvalMethod));
-
ParseMRecip(D, Args, CmdArgs);
// -ffast-math enables the __FAST_MATH__ preprocessor macro, but check for the
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 9f891f29ccc3..64800b19708b 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4245,13 +4245,8 @@ static bool ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
// Always avoid lexing editor placeholders when we're just running the
// preprocessor as we never want to emit the
// "editor placeholder in source file" error in PP only mode.
- // Certain predefined macros which depend upon semantic processing,
- // for example __FLT_EVAL_METHOD__, are not expanded in PP mode, they
- // appear in the preprocessed output as an unexpanded macro name.
- if (isStrictlyPreprocessorAction(Action)) {
+ if (isStrictlyPreprocessorAction(Action))
Opts.LexEditorPlaceholders = false;
- Opts.LexExpandSpecialBuiltins = false;
- }
return Diags.getNumErrors() == NumErrorsBefore;
}
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index d8ed7f2296b8..7091376389f9 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1084,8 +1084,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
}
// Macros to control C99 numerics and <float.h>
- // Note: __FLT_EVAL_METHOD__ is not defined here since it is a special
- // builtin macro, its value may fluctuate during compilation.
+ Builder.defineMacro("__FLT_EVAL_METHOD__", Twine(TI.getFloatEvalMethod()));
Builder.defineMacro("__FLT_RADIX__", "2");
Builder.defineMacro("__DECIMAL_DIG__", "__LDBL_DECIMAL_DIG__");
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index c21e32f44caf..136f61ab9a50 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -345,11 +345,6 @@ void Preprocessor::RegisterBuiltinMacros() {
Ident__TIME__ = RegisterBuiltinMacro(*this, "__TIME__");
Ident__COUNTER__ = RegisterBuiltinMacro(*this, "__COUNTER__");
Ident_Pragma = RegisterBuiltinMacro(*this, "_Pragma");
- if (PPOpts->LexExpandSpecialBuiltins)
- // Suppress macro expansion if compiler stops before semantic analysis,
- // the macro identifier will appear in the preprocessed output.
- Ident__FLT_EVAL_METHOD__ =
- RegisterBuiltinMacro(*this, "__FLT_EVAL_METHOD__");
// C++ Standing Document Extensions.
if (getLangOpts().CPlusPlus)
@@ -1605,10 +1600,6 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// Surround the string with " and strip the trailing newline.
OS << '"' << StringRef(Result).drop_back() << '"';
Tok.setKind(tok::string_literal);
- } else if (II == Ident__FLT_EVAL_METHOD__) {
- // __FLT_EVAL_METHOD__ expands to a simple numeric value.
- OS << getCurrentFPEvalMethod();
- Tok.setKind(tok::numeric_constant);
} else if (II == Ident__COUNTER__) {
// __COUNTER__ expands to a simple numeric value.
OS << CounterValue++;
@@ -1706,7 +1697,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
return false;
});
- } else if (II == Ident__has_cpp_attribute || II == Ident__has_c_attribute) {
+ } else if (II == Ident__has_cpp_attribute ||
+ II == Ident__has_c_attribute) {
bool IsCXX = II == Ident__has_cpp_attribute;
EvaluateFeatureLikeBuiltinMacro(
OS, Tok, II, *this, [&](Token &Tok, bool &HasLexedNextToken) -> int {
@@ -1733,7 +1725,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
getLangOpts())
: 0;
});
- } else if (II == Ident__has_include || II == Ident__has_include_next) {
+ } else if (II == Ident__has_include ||
+ II == Ident__has_include_next) {
// The argument to these two builtins should be a parenthesized
// file name string literal using angle brackets (<>) or
// double-quotes ("").
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index 55999a3301c2..c33605ef9025 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -2676,27 +2676,21 @@ void PragmaFloatControlHandler::HandlePragma(Preprocessor &PP,
// Read the identifier.
PP.Lex(Tok);
- PragmaFloatControlKind Kind;
- if (Tok.is(tok::kw_double)) {
- Kind = PFC_Double;
- } else {
- if (Tok.isNot(tok::identifier)) {
- PP.Diag(Tok.getLocation(), diag::err_pragma_float_control_malformed);
- return;
- }
+ if (Tok.isNot(tok::identifier)) {
+ PP.Diag(Tok.getLocation(), diag::err_pragma_float_control_malformed);
+ return;
+ }
- // Verify that this is one of the float control options.
- IdentifierInfo *II = Tok.getIdentifierInfo();
- Kind = llvm::StringSwitch<PragmaFloatControlKind>(II->getName())
- .Case("precise", PFC_Precise)
- .Case("except", PFC_Except)
- .Case("push", PFC_Push)
- .Case("pop", PFC_Pop)
- .Case("source", PFC_Source)
- .Case("extended", PFC_Extended)
- .Default(PFC_Unknown);
- }
- PP.Lex(Tok); // the first pragma token
+ // Verify that this is one of the float control options.
+ IdentifierInfo *II = Tok.getIdentifierInfo();
+ PragmaFloatControlKind Kind =
+ llvm::StringSwitch<PragmaFloatControlKind>(II->getName())
+ .Case("precise", PFC_Precise)
+ .Case("except", PFC_Except)
+ .Case("push", PFC_Push)
+ .Case("pop", PFC_Pop)
+ .Default(PFC_Unknown);
+ PP.Lex(Tok); // the identifier
if (Kind == PFC_Unknown) {
PP.Diag(Tok.getLocation(), diag::err_pragma_float_control_malformed);
return;
@@ -2725,21 +2719,10 @@ void PragmaFloatControlHandler::HandlePragma(Preprocessor &PP,
// Kind is set correctly
;
else if (PushOnOff == "off") {
- switch (Kind) {
- default:
- break;
- case PFC_Precise:
+ if (Kind == PFC_Precise)
Kind = PFC_NoPrecise;
- break;
- case PFC_Except:
+ if (Kind == PFC_Except)
Kind = PFC_NoExcept;
- break;
- case PFC_Double:
- case PFC_Extended:
- // Reset eval mode to 'source'
- Kind = PFC_Source;
- break;
- }
} else if (PushOnOff == "push") {
Action = Sema::PSK_Push_Set;
} else {
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 1883ef1adbf9..79f4c874b8ff 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -234,12 +234,6 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
SemaPPCallbackHandler = Callbacks.get();
PP.addPPCallbacks(std::move(Callbacks));
SemaPPCallbackHandler->set(*this);
- if (getLangOpts().getFPEvalMethod() == LangOptions::FEM_TargetDefault)
- // Use setting from TargetInfo.
- PP.setCurrentFPEvalMethod(ctxt.getTargetInfo().getFPEvalMethod());
- else
- // Set initial value of __FLT_EVAL_METHOD__ from the command line.
- PP.setCurrentFPEvalMethod(getLangOpts().getFPEvalMethod());
}
// Anchor Sema's type info to this TU.
@@ -2542,14 +2536,3 @@ const llvm::MapVector<FieldDecl *, Sema::DeleteLocs> &
Sema::getMismatchingDeleteExpressions() const {
return DeleteExprs;
}
-
-Sema::FPFeaturesStateRAII::FPFeaturesStateRAII(Sema &S)
- : S(S), OldFPFeaturesState(S.CurFPFeatures),
- OldOverrides(S.FpPragmaStack.CurrentValue),
- OldEvalMethod(S.PP.getCurrentFPEvalMethod()) {}
-
-Sema::FPFeaturesStateRAII::~FPFeaturesStateRAII() {
- S.CurFPFeatures = OldFPFeaturesState;
- S.FpPragmaStack.CurrentValue = OldOverrides;
- S.PP.setCurrentFPEvalMethod(OldEvalMethod);
-}
diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index c19b44989b5f..40d8beab7605 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -484,21 +484,6 @@ void Sema::ActOnPragmaFloatControl(SourceLocation Loc,
switch (Value) {
default:
llvm_unreachable("invalid pragma float_control kind");
- case PFC_Source:
- PP.setCurrentFPEvalMethod(LangOptions::FEM_Source);
- NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Source);
- FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
- break;
- case PFC_Double:
- PP.setCurrentFPEvalMethod(LangOptions::FEM_Double);
- NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Double);
- FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
- break;
- case PFC_Extended:
- PP.setCurrentFPEvalMethod(LangOptions::FEM_Extended);
- NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Extended);
- FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
- break;
case PFC_Precise:
NewFPFeatures.setFPPreciseEnabled(true);
FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures);
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b2f860fe58bc..9d7738c3a234 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -772,37 +772,6 @@ ExprResult Sema::UsualUnaryConversions(Expr *E) {
QualType Ty = E->getType();
assert(!Ty.isNull() && "UsualUnaryConversions - missing type");
- LangOptions::FPEvalMethodKind EvalMethod = CurFPFeatures.getFPEvalMethod();
- if (EvalMethod != LangOptions::FEM_Source && Ty->isFloatingType()) {
- switch (EvalMethod) {
- default:
- llvm_unreachable("Unrecognized float evaluation method");
- break;
- case LangOptions::FEM_TargetDefault:
- // Float evaluation method not defined, use FEM_Source.
- break;
- case LangOptions::FEM_Double:
- if (Context.getFloatingTypeOrder(Context.DoubleTy, Ty) > 0)
- // Widen the expression to double.
- return Ty->isComplexType()
- ? ImpCastExprToType(E,
- Context.getComplexType(Context.DoubleTy),
- CK_FloatingComplexCast)
- : ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast);
- break;
- case LangOptions::FEM_Extended:
- if (Context.getFloatingTypeOrder(Context.LongDoubleTy, Ty) > 0)
- // Widen the expression to long double.
- return Ty->isComplexType()
- ? ImpCastExprToType(
- E, Context.getComplexType(Context.LongDoubleTy),
- CK_FloatingComplexCast)
- : ImpCastExprToType(E, Context.LongDoubleTy,
- CK_FloatingCast);
- break;
- }
- }
-
// Half FP have to be promoted to float unless it is natively supported
if (Ty->isHalfType() && !getLangOpts().NativeHalfType)
return ImpCastExprToType(Res.get(), Context.FloatTy, CK_FloatingCast);
diff --git a/clang/test/CodeGen/fp-floatcontrol-pragma.cpp b/clang/test/CodeGen/fp-floatcontrol-pragma.cpp
index 92a2378e59e2..ef29d24de1db 100644
--- a/clang/test/CodeGen/fp-floatcontrol-pragma.cpp
+++ b/clang/test/CodeGen/fp-floatcontrol-pragma.cpp
@@ -1,14 +1,7 @@
// RUN: %clang_cc1 -fexperimental-strict-floating-point -DEXCEPT=1 -fcxx-exceptions -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NS %s
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-DEFAULT
+// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -fexperimental-strict-floating-point -DFENV_ON=1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-FENV %s
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -DNF128 -triple %itanium_abi_triple -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-O3 %s
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple x86_64-linux-gnu -emit-llvm -o - %s -ffp-eval-method=source | FileCheck %s -check-prefix=CHECK-SOURCE
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple x86_64-linux-gnu -emit-llvm -o - %s -ffp-eval-method=double | FileCheck %s -check-prefix=CHECK-DOUBLE
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple x86_64-linux-gnu -emit-llvm -o - %s -ffp-eval-method=extended -mlong-double-80 | FileCheck %s -check-prefix=CHECK-EXTENDED
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple i386-linux-gnu -emit-llvm -o - %s -ffp-eval-method=source | FileCheck %s -check-prefix=CHECK-SOURCE
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple i386-linux-gnu -emit-llvm -o - %s -ffp-eval-method=double | FileCheck %s -check-prefix=CHECK-DOUBLE
-// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple i386-linux-gnu -emit-llvm -o - %s -ffp-eval-method=extended -mlong-double-80 | FileCheck %s -check-prefix=CHECK-EXTENDED
-// RUN: %clang_cc1 -triple powerpc-unknown-aix -DNF128 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -fexperimental-strict-floating-point -triple %itanium_abi_triple -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-O3 %s
// Verify float_control(precise, off) enables fast math flags on fp operations.
float fp_precise_1(float a, float b, float c) {
@@ -236,86 +229,3 @@ float try_lam(float x, unsigned n) {
result = x + t;
return result;
}
-
-float mySub(float x, float y) {
- // CHECK: define {{.*}}float {{.*}}mySub{{.*}}
- // CHECK-NS: fsub float
- // CHECK-SOURCE: fsub float
- // CHECK-DOUBLE: fpext float
- // CHECK-DOUBLE: fpext float
- // CHECK-DOUBLE: fsub double
- // CHECK-DOUBLE: fptrunc double {{.*}} to float
- // CHECK-EXTENDED: fpext float
- // CHECK-EXTENDED: fpext float
- // CHECK-EXTENDED: fsub double
- // CHECK-EXTENDED: fptrunc double {{.*}} to float
- return x - y;
-}
-
-float mySubSource(float x, float y) {
-// CHECK: define {{.*}}float {{.*}}mySubSource{{.*}}
-#pragma float_control(source)
- return x - y;
- // CHECK: fsub float
-}
-
-float mySubExtended(float x, float y) {
-// CHECK: define {{.*}}float {{.*}}mySubExtended{{.*}}
-#pragma float_control(extended)
- return x - y;
- // CHECK: fpext float
- // CHECK: fpext float
- // CHECK: fsub x86_fp80
- // CHECK: fptrunc x86_fp80 {{.*}} to float
-}
-
-float mySubDouble(float x, float y) {
-// CHECK: define {{.*}}float {{.*}}mySubDouble{{.*}}
-#pragma float_control(double)
- return x - y;
- // CHECK: fpext float
- // CHECK: fpext float
- // CHECK: fsub double
- // CHECK: fptrunc double {{.*}} to float
-}
-
-#ifndef NF128
-__float128 mySub128(__float128 x, __float128 y) {
- // CHECK: define {{.*}}mySub128{{.*}}
- // Expect no fpext since fp128 is already widest
- // CHECK: load fp128
- // CHECK-NEXT: load fp128
- // CHECK-NEXT: fsub fp128
- // CHECK-NEXT: ret fp128
- return x - y;
-}
-#endif
-
-void mySubfp16(__fp16 *res, __fp16 *x, __fp16 *y) {
- // CHECK: define {{.*}}mySubfp16{{.*}}
- *res = *x - *y;
- // CHECK: load half
- // CHECK-NEXT: load half
- // CHECK-NEXT: fpext half{{.*}}
- // CHECK-NEXT: load half
- // CHECK-NEXT: load half
- // CHECK-NS: fpext half{{.*}} to float
- // CHECK-DEFAULT: fpext half{{.*}} to float
- // CHECK-DOUBLE: fpext half{{.*}} to double
- // CHECK-EXTENDED: fpext half{{.*}} to x86_fp80
- // CHECK-NEXT: fsub
- // CHECK-NEXT: fptrunc {{.*}}to half
- // CHECK-NS: fptrunc float {{.*}} to half
- // CHECK-DOUBLE: fptrunc double {{.*}} to half
- // CHECK-EXTENDED: fptrunc x86_fp80 {{.*}} to half
-}
-
-int getFEM() {
- // CHECK: define {{.*}}getFEM{{.*}}
- return __FLT_EVAL_METHOD__;
- // CHECK-NS: ret {{.*}} 0
- // CHECK-AIX: ret {{.*}} 1
- // CHECK-SOURCE: ret {{.*}} 0
- // CHECK-DOUBLE: ret {{.*}} 1
- // CHECK-EXTENDED: ret {{.*}} 2
-}
diff --git a/clang/test/Preprocessor/init-aarch64.c b/clang/test/Preprocessor/init-aarch64.c
index b38319c9b2ff..3b6f4ddaabde 100644
--- a/clang/test/Preprocessor/init-aarch64.c
+++ b/clang/test/Preprocessor/init-aarch64.c
@@ -91,6 +91,7 @@
// AARCH64-NEXT: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// AARCH64-NEXT: #define __FLT_DIG__ 6
// AARCH64-NEXT: #define __FLT_EPSILON__ 1.19209290e-7F
+// AARCH64-NEXT: #define __FLT_EVAL_METHOD__ 0
// AARCH64-NEXT: #define __FLT_HAS_DENORM__ 1
// AARCH64-NEXT: #define __FLT_HAS_INFINITY__ 1
// AARCH64-NEXT: #define __FLT_HAS_QUIET_NAN__ 1
@@ -372,6 +373,7 @@
// AARCH64-DARWIN: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// AARCH64-DARWIN: #define __FLT_DIG__ 6
// AARCH64-DARWIN: #define __FLT_EPSILON__ 1.19209290e-7F
+// AARCH64-DARWIN: #define __FLT_EVAL_METHOD__ 0
// AARCH64-DARWIN: #define __FLT_HAS_DENORM__ 1
// AARCH64-DARWIN: #define __FLT_HAS_INFINITY__ 1
// AARCH64-DARWIN: #define __FLT_HAS_QUIET_NAN__ 1
@@ -587,6 +589,7 @@
// AARCH64-MSVC: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// AARCH64-MSVC: #define __FLT_DIG__ 6
// AARCH64-MSVC: #define __FLT_EPSILON__ 1.19209290e-7F
+// AARCH64-MSVC: #define __FLT_EVAL_METHOD__ 0
// AARCH64-MSVC: #define __FLT_HAS_DENORM__ 1
// AARCH64-MSVC: #define __FLT_HAS_INFINITY__ 1
// AARCH64-MSVC: #define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-arm.c b/clang/test/Preprocessor/init-arm.c
index 2d1503c18560..32eb2c513f8b 100644
--- a/clang/test/Preprocessor/init-arm.c
+++ b/clang/test/Preprocessor/init-arm.c
@@ -35,6 +35,7 @@
// ARM:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// ARM:#define __FLT_DIG__ 6
// ARM:#define __FLT_EPSILON__ 1.19209290e-7F
+// ARM:#define __FLT_EVAL_METHOD__ 0
// ARM:#define __FLT_HAS_DENORM__ 1
// ARM:#define __FLT_HAS_INFINITY__ 1
// ARM:#define __FLT_HAS_QUIET_NAN__ 1
@@ -234,6 +235,7 @@
// ARM-BE:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// ARM-BE:#define __FLT_DIG__ 6
// ARM-BE:#define __FLT_EPSILON__ 1.19209290e-7F
+// ARM-BE:#define __FLT_EVAL_METHOD__ 0
// ARM-BE:#define __FLT_HAS_DENORM__ 1
// ARM-BE:#define __FLT_HAS_INFINITY__ 1
// ARM-BE:#define __FLT_HAS_QUIET_NAN__ 1
@@ -426,6 +428,7 @@
// ARMEABISOFTFP:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// ARMEABISOFTFP:#define __FLT_DIG__ 6
// ARMEABISOFTFP:#define __FLT_EPSILON__ 1.19209290e-7F
+// ARMEABISOFTFP:#define __FLT_EVAL_METHOD__ 0
// ARMEABISOFTFP:#define __FLT_HAS_DENORM__ 1
// ARMEABISOFTFP:#define __FLT_HAS_INFINITY__ 1
// ARMEABISOFTFP:#define __FLT_HAS_QUIET_NAN__ 1
@@ -620,6 +623,7 @@
// ARMEABIHARDFP:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// ARMEABIHARDFP:#define __FLT_DIG__ 6
// ARMEABIHARDFP:#define __FLT_EPSILON__ 1.19209290e-7F
+// ARMEABIHARDFP:#define __FLT_EVAL_METHOD__ 0
// ARMEABIHARDFP:#define __FLT_HAS_DENORM__ 1
// ARMEABIHARDFP:#define __FLT_HAS_INFINITY__ 1
// ARMEABIHARDFP:#define __FLT_HAS_QUIET_NAN__ 1
@@ -817,6 +821,7 @@
// ARM-NETBSD:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// ARM-NETBSD:#define __FLT_DIG__ 6
// ARM-NETBSD:#define __FLT_EPSILON__ 1.19209290e-7F
+// ARM-NETBSD:#define __FLT_EVAL_METHOD__ 0
// ARM-NETBSD:#define __FLT_HAS_DENORM__ 1
// ARM-NETBSD:#define __FLT_HAS_INFINITY__ 1
// ARM-NETBSD:#define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-mips.c b/clang/test/Preprocessor/init-mips.c
index a07cee64e684..d76396aa35c9 100644
--- a/clang/test/Preprocessor/init-mips.c
+++ b/clang/test/Preprocessor/init-mips.c
@@ -37,6 +37,7 @@
// MIPS32BE:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// MIPS32BE:#define __FLT_DIG__ 6
// MIPS32BE:#define __FLT_EPSILON__ 1.19209290e-7F
+// MIPS32BE:#define __FLT_EVAL_METHOD__ 0
// MIPS32BE:#define __FLT_HAS_DENORM__ 1
// MIPS32BE:#define __FLT_HAS_INFINITY__ 1
// MIPS32BE:#define __FLT_HAS_QUIET_NAN__ 1
@@ -246,6 +247,7 @@
// MIPS32EL:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// MIPS32EL:#define __FLT_DIG__ 6
// MIPS32EL:#define __FLT_EPSILON__ 1.19209290e-7F
+// MIPS32EL:#define __FLT_EVAL_METHOD__ 0
// MIPS32EL:#define __FLT_HAS_DENORM__ 1
// MIPS32EL:#define __FLT_HAS_INFINITY__ 1
// MIPS32EL:#define __FLT_HAS_QUIET_NAN__ 1
@@ -465,6 +467,7 @@
// MIPSN32BE: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// MIPSN32BE: #define __FLT_DIG__ 6
// MIPSN32BE: #define __FLT_EPSILON__ 1.19209290e-7F
+// MIPSN32BE: #define __FLT_EVAL_METHOD__ 0
// MIPSN32BE: #define __FLT_HAS_DENORM__ 1
// MIPSN32BE: #define __FLT_HAS_INFINITY__ 1
// MIPSN32BE: #define __FLT_HAS_QUIET_NAN__ 1
@@ -771,6 +774,7 @@
// MIPSN32EL: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// MIPSN32EL: #define __FLT_DIG__ 6
// MIPSN32EL: #define __FLT_EPSILON__ 1.19209290e-7F
+// MIPSN32EL: #define __FLT_EVAL_METHOD__ 0
// MIPSN32EL: #define __FLT_HAS_DENORM__ 1
// MIPSN32EL: #define __FLT_HAS_INFINITY__ 1
// MIPSN32EL: #define __FLT_HAS_QUIET_NAN__ 1
@@ -1070,6 +1074,7 @@
// MIPS64BE:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// MIPS64BE:#define __FLT_DIG__ 6
// MIPS64BE:#define __FLT_EPSILON__ 1.19209290e-7F
+// MIPS64BE:#define __FLT_EVAL_METHOD__ 0
// MIPS64BE:#define __FLT_HAS_DENORM__ 1
// MIPS64BE:#define __FLT_HAS_INFINITY__ 1
// MIPS64BE:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1279,6 +1284,7 @@
// MIPS64EL:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// MIPS64EL:#define __FLT_DIG__ 6
// MIPS64EL:#define __FLT_EPSILON__ 1.19209290e-7F
+// MIPS64EL:#define __FLT_EVAL_METHOD__ 0
// MIPS64EL:#define __FLT_HAS_DENORM__ 1
// MIPS64EL:#define __FLT_HAS_INFINITY__ 1
// MIPS64EL:#define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-ppc.c b/clang/test/Preprocessor/init-ppc.c
index ca61143e8dc9..4f1c33b1dcc3 100644
--- a/clang/test/Preprocessor/init-ppc.c
+++ b/clang/test/Preprocessor/init-ppc.c
@@ -30,6 +30,7 @@
// PPC603E:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC603E:#define __FLT_DIG__ 6
// PPC603E:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC603E:#define __FLT_EVAL_METHOD__ 0
// PPC603E:#define __FLT_HAS_DENORM__ 1
// PPC603E:#define __FLT_HAS_INFINITY__ 1
// PPC603E:#define __FLT_HAS_QUIET_NAN__ 1
@@ -223,6 +224,7 @@
// PPC:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC:#define __FLT_DIG__ 6
// PPC:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC:#define __FLT_EVAL_METHOD__ 0
// PPC:#define __FLT_HAS_DENORM__ 1
// PPC:#define __FLT_HAS_INFINITY__ 1
// PPC:#define __FLT_HAS_QUIET_NAN__ 1
@@ -421,6 +423,7 @@
// PPC-AIX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC-AIX:#define __FLT_DIG__ 6
// PPC-AIX:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC-AIX:#define __FLT_EVAL_METHOD__ 1
// PPC-AIX:#define __FLT_HAS_DENORM__ 1
// PPC-AIX:#define __FLT_HAS_INFINITY__ 1
// PPC-AIX:#define __FLT_HAS_QUIET_NAN__ 1
@@ -791,6 +794,7 @@
// PPC-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC-LINUX:#define __FLT_DIG__ 6
// PPC-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC-LINUX:#define __FLT_EVAL_METHOD__ 0
// PPC-LINUX:#define __FLT_HAS_DENORM__ 1
// PPC-LINUX:#define __FLT_HAS_INFINITY__ 1
// PPC-LINUX:#define __FLT_HAS_QUIET_NAN__ 1
@@ -998,6 +1002,7 @@
// PPC-DARWIN:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC-DARWIN:#define __FLT_DIG__ 6
// PPC-DARWIN:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC-DARWIN:#define __FLT_EVAL_METHOD__ 0
// PPC-DARWIN:#define __FLT_HAS_DENORM__ 1
// PPC-DARWIN:#define __FLT_HAS_INFINITY__ 1
// PPC-DARWIN:#define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-ppc64.c b/clang/test/Preprocessor/init-ppc64.c
index fbb3fd740008..ca9029d6cab5 100644
--- a/clang/test/Preprocessor/init-ppc64.c
+++ b/clang/test/Preprocessor/init-ppc64.c
@@ -35,6 +35,7 @@
// PPC64:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC64:#define __FLT_DIG__ 6
// PPC64:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC64:#define __FLT_EVAL_METHOD__ 0
// PPC64:#define __FLT_HAS_DENORM__ 1
// PPC64:#define __FLT_HAS_INFINITY__ 1
// PPC64:#define __FLT_HAS_QUIET_NAN__ 1
@@ -239,6 +240,7 @@
// PPC64LE:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC64LE:#define __FLT_DIG__ 6
// PPC64LE:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC64LE:#define __FLT_EVAL_METHOD__ 0
// PPC64LE:#define __FLT_HAS_DENORM__ 1
// PPC64LE:#define __FLT_HAS_INFINITY__ 1
// PPC64LE:#define __FLT_HAS_QUIET_NAN__ 1
@@ -701,6 +703,7 @@
// PPC64-AIX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC64-AIX:#define __FLT_DIG__ 6
// PPC64-AIX:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC64-AIX:#define __FLT_EVAL_METHOD__ 1
// PPC64-AIX:#define __FLT_HAS_DENORM__ 1
// PPC64-AIX:#define __FLT_HAS_INFINITY__ 1
// PPC64-AIX:#define __FLT_HAS_QUIET_NAN__ 1
@@ -898,6 +901,7 @@
// PPC64-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PPC64-LINUX:#define __FLT_DIG__ 6
// PPC64-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC64-LINUX:#define __FLT_EVAL_METHOD__ 0
// PPC64-LINUX:#define __FLT_HAS_DENORM__ 1
// PPC64-LINUX:#define __FLT_HAS_INFINITY__ 1
// PPC64-LINUX:#define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-s390x.c b/clang/test/Preprocessor/init-s390x.c
index 6c646527f50f..b0e45b5348ce 100644
--- a/clang/test/Preprocessor/init-s390x.c
+++ b/clang/test/Preprocessor/init-s390x.c
@@ -23,6 +23,7 @@
// S390X:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// S390X:#define __FLT_DIG__ 6
// S390X:#define __FLT_EPSILON__ 1.19209290e-7F
+// S390X:#define __FLT_EVAL_METHOD__ 0
// S390X:#define __FLT_HAS_DENORM__ 1
// S390X:#define __FLT_HAS_INFINITY__ 1
// S390X:#define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-v7k-compat.c b/clang/test/Preprocessor/init-v7k-compat.c
index ff5d4bbdea53..482c7ad6ff68 100644
--- a/clang/test/Preprocessor/init-v7k-compat.c
+++ b/clang/test/Preprocessor/init-v7k-compat.c
@@ -28,6 +28,7 @@
// CHECK: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// CHECK: #define __FLT_DIG__ 6
// CHECK: #define __FLT_EPSILON__ 1.19209290e-7F
+// CHECK: #define __FLT_EVAL_METHOD__ 0
// CHECK: #define __FLT_HAS_DENORM__ 1
// CHECK: #define __FLT_HAS_INFINITY__ 1
// CHECK: #define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init-x86.c b/clang/test/Preprocessor/init-x86.c
index 287de8d90937..527cd3950888 100644
--- a/clang/test/Preprocessor/init-x86.c
+++ b/clang/test/Preprocessor/init-x86.c
@@ -24,6 +24,7 @@
// I386:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// I386:#define __FLT_DIG__ 6
// I386:#define __FLT_EPSILON__ 1.19209290e-7F
+// I386:#define __FLT_EVAL_METHOD__ 2
// I386:#define __FLT_HAS_DENORM__ 1
// I386:#define __FLT_HAS_INFINITY__ 1
// I386:#define __FLT_HAS_QUIET_NAN__ 1
@@ -212,6 +213,7 @@
// I386-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// I386-LINUX:#define __FLT_DIG__ 6
// I386-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
+// I386-LINUX:#define __FLT_EVAL_METHOD__ 0
// I386-LINUX:#define __FLT_HAS_DENORM__ 1
// I386-LINUX:#define __FLT_HAS_INFINITY__ 1
// I386-LINUX:#define __FLT_HAS_QUIET_NAN__ 1
@@ -414,6 +416,7 @@
// I386-NETBSD:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// I386-NETBSD:#define __FLT_DIG__ 6
// I386-NETBSD:#define __FLT_EPSILON__ 1.19209290e-7F
+// I386-NETBSD:#define __FLT_EVAL_METHOD__ 2
// I386-NETBSD:#define __FLT_HAS_DENORM__ 1
// I386-NETBSD:#define __FLT_HAS_INFINITY__ 1
// I386-NETBSD:#define __FLT_HAS_QUIET_NAN__ 1
@@ -587,6 +590,12 @@
// I386-NETBSD:#define __i386__ 1
// I386-NETBSD:#define i386 1
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd -target-feature +sse2 < /dev/null | FileCheck -match-full-lines -check-prefix I386-NETBSD-SSE %s
+// I386-NETBSD-SSE:#define __FLT_EVAL_METHOD__ 0
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd6 < /dev/null | FileCheck -match-full-lines -check-prefix I386-NETBSD6 %s
+// I386-NETBSD6:#define __FLT_EVAL_METHOD__ 1
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd6 -target-feature +sse2 < /dev/null | FileCheck -match-full-lines -check-prefix I386-NETBSD6-SSE %s
+// I386-NETBSD6-SSE:#define __FLT_EVAL_METHOD__ 1
// RUN: %clang_cc1 -E -dM -triple=i686-pc-mingw32 < /dev/null | FileCheck -match-full-lines -check-prefix I386-DECLSPEC %s
// RUN: %clang_cc1 -E -dM -fms-extensions -triple=i686-pc-mingw32 < /dev/null | FileCheck -match-full-lines -check-prefix I386-DECLSPEC %s
@@ -622,6 +631,7 @@
// X86_64:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// X86_64:#define __FLT_DIG__ 6
// X86_64:#define __FLT_EPSILON__ 1.19209290e-7F
+// X86_64:#define __FLT_EVAL_METHOD__ 0
// X86_64:#define __FLT_HAS_DENORM__ 1
// X86_64:#define __FLT_HAS_INFINITY__ 1
// X86_64:#define __FLT_HAS_QUIET_NAN__ 1
@@ -829,6 +839,7 @@
// X32:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// X32:#define __FLT_DIG__ 6
// X32:#define __FLT_EPSILON__ 1.19209290e-7F
+// X32:#define __FLT_EVAL_METHOD__ 0
// X32:#define __FLT_HAS_DENORM__ 1
// X32:#define __FLT_HAS_INFINITY__ 1
// X32:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1035,6 +1046,7 @@
// X86_64-CLOUDABI:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// X86_64-CLOUDABI:#define __FLT_DIG__ 6
// X86_64-CLOUDABI:#define __FLT_EPSILON__ 1.19209290e-7F
+// X86_64-CLOUDABI:#define __FLT_EVAL_METHOD__ 0
// X86_64-CLOUDABI:#define __FLT_HAS_DENORM__ 1
// X86_64-CLOUDABI:#define __FLT_HAS_INFINITY__ 1
// X86_64-CLOUDABI:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1329,6 +1341,7 @@
// X86_64-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// X86_64-LINUX:#define __FLT_DIG__ 6
// X86_64-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
+// X86_64-LINUX:#define __FLT_EVAL_METHOD__ 0
// X86_64-LINUX:#define __FLT_HAS_DENORM__ 1
// X86_64-LINUX:#define __FLT_HAS_INFINITY__ 1
// X86_64-LINUX:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1541,6 +1554,7 @@
// X86_64-NETBSD:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// X86_64-NETBSD:#define __FLT_DIG__ 6
// X86_64-NETBSD:#define __FLT_EPSILON__ 1.19209290e-7F
+// X86_64-NETBSD:#define __FLT_EVAL_METHOD__ 0
// X86_64-NETBSD:#define __FLT_HAS_DENORM__ 1
// X86_64-NETBSD:#define __FLT_HAS_INFINITY__ 1
// X86_64-NETBSD:#define __FLT_HAS_QUIET_NAN__ 1
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index c14ef173390a..4e46405dce6a 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -323,6 +323,7 @@
// MSP430:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// MSP430:#define __FLT_DIG__ 6
// MSP430:#define __FLT_EPSILON__ 1.19209290e-7F
+// MSP430:#define __FLT_EVAL_METHOD__ 0
// MSP430:#define __FLT_HAS_DENORM__ 1
// MSP430:#define __FLT_HAS_INFINITY__ 1
// MSP430:#define __FLT_HAS_QUIET_NAN__ 1
@@ -510,6 +511,7 @@
// NVPTX32:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// NVPTX32:#define __FLT_DIG__ 6
// NVPTX32:#define __FLT_EPSILON__ 1.19209290e-7F
+// NVPTX32:#define __FLT_EVAL_METHOD__ 0
// NVPTX32:#define __FLT_HAS_DENORM__ 1
// NVPTX32:#define __FLT_HAS_INFINITY__ 1
// NVPTX32:#define __FLT_HAS_QUIET_NAN__ 1
@@ -698,6 +700,7 @@
// NVPTX64:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// NVPTX64:#define __FLT_DIG__ 6
// NVPTX64:#define __FLT_EPSILON__ 1.19209290e-7F
+// NVPTX64:#define __FLT_EVAL_METHOD__ 0
// NVPTX64:#define __FLT_HAS_DENORM__ 1
// NVPTX64:#define __FLT_HAS_INFINITY__ 1
// NVPTX64:#define __FLT_HAS_QUIET_NAN__ 1
@@ -901,6 +904,7 @@
// SPARC:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// SPARC:#define __FLT_DIG__ 6
// SPARC:#define __FLT_EPSILON__ 1.19209290e-7F
+// SPARC:#define __FLT_EVAL_METHOD__ 0
// SPARC:#define __FLT_HAS_DENORM__ 1
// SPARC:#define __FLT_HAS_INFINITY__ 1
// SPARC:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1101,6 +1105,7 @@
// TCE:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// TCE:#define __FLT_DIG__ 6
// TCE:#define __FLT_EPSILON__ 1.19209290e-7F
+// TCE:#define __FLT_EVAL_METHOD__ 0
// TCE:#define __FLT_HAS_DENORM__ 1
// TCE:#define __FLT_HAS_INFINITY__ 1
// TCE:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1267,6 +1272,7 @@
// PS4:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// PS4:#define __FLT_DIG__ 6
// PS4:#define __FLT_EPSILON__ 1.19209290e-7F
+// PS4:#define __FLT_EVAL_METHOD__ 0
// PS4:#define __FLT_HAS_DENORM__ 1
// PS4:#define __FLT_HAS_INFINITY__ 1
// PS4:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1558,6 +1564,7 @@
// WEBASSEMBLY-NEXT:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// WEBASSEMBLY-NEXT:#define __FLT_DIG__ 6
// WEBASSEMBLY-NEXT:#define __FLT_EPSILON__ 1.19209290e-7F
+// WEBASSEMBLY-NEXT:#define __FLT_EVAL_METHOD__ 0
// WEBASSEMBLY-NEXT:#define __FLT_HAS_DENORM__ 1
// WEBASSEMBLY-NEXT:#define __FLT_HAS_INFINITY__ 1
// WEBASSEMBLY-NEXT:#define __FLT_HAS_QUIET_NAN__ 1
@@ -1913,6 +1920,7 @@
// AVR:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// AVR:#define __FLT_DIG__ 6
// AVR:#define __FLT_EPSILON__ 1.19209290e-7F
+// AVR:#define __FLT_EVAL_METHOD__ 0
// AVR:#define __FLT_HAS_DENORM__ 1
// AVR:#define __FLT_HAS_INFINITY__ 1
// AVR:#define __FLT_HAS_QUIET_NAN__ 1
@@ -2195,6 +2203,7 @@
// RISCV32: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// RISCV32: #define __FLT_DIG__ 6
// RISCV32: #define __FLT_EPSILON__ 1.19209290e-7F
+// RISCV32: #define __FLT_EVAL_METHOD__ 0
// RISCV32: #define __FLT_HAS_DENORM__ 1
// RISCV32: #define __FLT_HAS_INFINITY__ 1
// RISCV32: #define __FLT_HAS_QUIET_NAN__ 1
@@ -2402,6 +2411,7 @@
// RISCV64: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// RISCV64: #define __FLT_DIG__ 6
// RISCV64: #define __FLT_EPSILON__ 1.19209290e-7F
+// RISCV64: #define __FLT_EVAL_METHOD__ 0
// RISCV64: #define __FLT_HAS_DENORM__ 1
// RISCV64: #define __FLT_HAS_INFINITY__ 1
// RISCV64: #define __FLT_HAS_QUIET_NAN__ 1
More information about the cfe-commits
mailing list