[clang] ce8024e - [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly

Melanie Blower via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 20 13:02:41 PDT 2021


Author: Melanie Blower
Date: 2021-07-20T16:02:09-04:00
New Revision: ce8024e8ff76e7be8b9ffa1a39d1dc9310bf74c7

URL: https://github.com/llvm/llvm-project/commit/ce8024e8ff76e7be8b9ffa1a39d1dc9310bf74c7
DIFF: https://github.com/llvm/llvm-project/commit/ce8024e8ff76e7be8b9ffa1a39d1dc9310bf74c7.diff

LOG: [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly

The Intel compiler ICC supports the option "-fp-model=(source|double|extended)"
which causes the compiler to use a wider type for intermediate floating point
calculations. Also supported is a way to embed this effect in the source
program with #pragma float_control(source|double|extended).
This patch extends pragma float_control syntax, and also adds support
for a new floating point option "-ffp-eval-method=(source|double|extended)".
source: intermediate results use source precision
double: intermediate results use double precision
extended: intermediate results use extended precision

Reviewed By: Aaron Ballman

Differential Revision: https://reviews.llvm.org/D93769

Added: 
    clang/test/Preprocessor/predefined-flteval-macro.c

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 f14f986c646a4..93805b65689ca 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3552,7 +3552,7 @@ same spelling and syntax.  For pragmas specified at file scope, 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.
 
@@ -3563,8 +3563,29 @@ 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, on|off [, push])`` and
+``float_control(except|precise|source|double|extended, 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 f7f76ed3f3e20..c47c3cdb4207f 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -1478,6 +1478,17 @@ 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 a93fa475cd5f6..224c1827144f5 100644
--- a/clang/include/clang/Basic/FPOptions.def
+++ b/clang/include/clang/Basic/FPOptions.def
@@ -23,4 +23,5 @@ 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 8420a97376c38..3de1666150280 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -295,6 +295,7 @@ 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 71cf0c65e6924..97766e059c040 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -233,6 +233,19 @@ 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,
@@ -524,6 +537,7 @@ 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 82c0d5f0a551c..24b6858e8c237 100644
--- a/clang/include/clang/Basic/PragmaKinds.h
+++ b/clang/include/clang/Basic/PragmaKinds.h
@@ -32,7 +32,10 @@ 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_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])
 };
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 4f0cbf986b31b..c7a57a7dba9a8 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -687,7 +687,8 @@ class TargetInfo : public virtual TransferrableTargetInfo,
   }
 
   /// Return the value for the C99 FLT_EVAL_METHOD macro.
-  virtual unsigned getFloatEvalMethod() const { return 0; }
+  //  Note: implementation defined values may be negative.
+  virtual int getFPEvalMethod() 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 79955f4fa4f08..76bc794a0a9e3 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1434,6 +1434,11 @@ 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 7ab13640ce2c0..a089d166caaa9 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -178,12 +178,17 @@ 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;
 
@@ -1988,6 +1993,8 @@ 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 99085b98fc7ad..4ad7305e3b39a 100644
--- a/clang/include/clang/Lex/PreprocessorOptions.h
+++ b/clang/include/clang/Lex/PreprocessorOptions.h
@@ -146,6 +146,9 @@ 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,6 +252,7 @@ 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 4ade04992a5f4..b2d1b5fbf06de 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1501,19 +1501,15 @@ class Sema final {
   /// statements.
   class FPFeaturesStateRAII {
   public:
-    FPFeaturesStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.CurFPFeatures) {
-      OldOverrides = S.FpPragmaStack.CurrentValue;
-    }
-    ~FPFeaturesStateRAII() {
-      S.CurFPFeatures = OldFPFeaturesState;
-      S.FpPragmaStack.CurrentValue = OldOverrides;
-    }
+    FPFeaturesStateRAII(Sema &S);
+    ~FPFeaturesStateRAII();
     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 31f8b4bea30d9..43e92cbde9188 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -735,7 +735,7 @@ class AIXTargetInfo : public OSTargetInfo<Target> {
   }
 
   // AIX sets FLT_EVAL_METHOD to be 1.
-  unsigned getFloatEvalMethod() const override { return 1; }
+  int getFPEvalMethod() 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 fcaaf50624e92..c5ddd0067235a 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -165,7 +165,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
     return LongDoubleFormat == &llvm::APFloat::IEEEquad() ? "g" : "e";
   }
 
-  unsigned getFloatEvalMethod() const override {
+  int getFPEvalMethod() const override {
     // X87 evaluates with 80 bits "long double" precision.
     return SSELevel == NoSSE ? 2 : 0;
   }
@@ -468,12 +468,12 @@ class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
   NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
       : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
 
-  unsigned getFloatEvalMethod() const override {
+  int getFPEvalMethod() 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::getFloatEvalMethod();
+      return X86_32TargetInfo::getFPEvalMethod();
     // 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 837ead86d6202..641c053227f27 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2630,6 +2630,8 @@ 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 =
@@ -2821,6 +2823,18 @@ 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;
@@ -2965,6 +2979,9 @@ 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 2c696b5394538..4c266f54e82c3 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4239,8 +4239,13 @@ 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.
-  if (isStrictlyPreprocessorAction(Action))
+  // 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)) {
     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 676421552a757..7a77332b6a711 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1078,7 +1078,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
   }
 
   // Macros to control C99 numerics and <float.h>
-  Builder.defineMacro("__FLT_EVAL_METHOD__", Twine(TI.getFloatEvalMethod()));
+  // Note: __FLT_EVAL_METHOD__ is not defined here since it is a special
+  // builtin macro, its value may fluctuate during compilation.
   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 8728ac9e2166e..589d3c3358850 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -345,6 +345,11 @@ 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)
@@ -1607,6 +1612,10 @@ 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++;
@@ -1704,8 +1713,7 @@ 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 {
@@ -1732,8 +1740,7 @@ 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 42072fe63fc88..58bfb0870abf0 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -2667,21 +2667,27 @@ void PragmaFloatControlHandler::HandlePragma(Preprocessor &PP,
 
   // Read the identifier.
   PP.Lex(Tok);
-  if (Tok.isNot(tok::identifier)) {
-    PP.Diag(Tok.getLocation(), diag::err_pragma_float_control_malformed);
-    return;
-  }
+  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;
+    }
 
-  // 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
+    // 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
   if (Kind == PFC_Unknown) {
     PP.Diag(Tok.getLocation(), diag::err_pragma_float_control_malformed);
     return;
@@ -2710,10 +2716,21 @@ void PragmaFloatControlHandler::HandlePragma(Preprocessor &PP,
         // Kind is set correctly
         ;
       else if (PushOnOff == "off") {
-        if (Kind == PFC_Precise)
+        switch (Kind) {
+        default:
+          break;
+        case PFC_Precise:
           Kind = PFC_NoPrecise;
-        if (Kind == PFC_Except)
+          break;
+        case 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 704b631f94003..2df4004eab6e1 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -212,6 +212,12 @@ 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.
@@ -2493,3 +2499,14 @@ 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 fe8f02f023685..43752636104ea 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -483,6 +483,21 @@ 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 80f9c1e1b372a..6639efc918339 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -768,6 +768,37 @@ 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 ef29d24de1dbc..aadf127f479b2 100644
--- a/clang/test/CodeGen/fp-floatcontrol-pragma.cpp
+++ b/clang/test/CodeGen/fp-floatcontrol-pragma.cpp
@@ -1,7 +1,14 @@
 // 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
+// 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 -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 -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 -DPPC -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-AIX
 
 // Verify float_control(precise, off) enables fast math flags on fp operations.
 float fp_precise_1(float a, float b, float c) {
@@ -229,3 +236,86 @@ 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 PPC
+__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 3b6f4ddaabde8..b38319c9b2ff5 100644
--- a/clang/test/Preprocessor/init-aarch64.c
+++ b/clang/test/Preprocessor/init-aarch64.c
@@ -91,7 +91,6 @@
 // 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
@@ -373,7 +372,6 @@
 // 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
@@ -589,7 +587,6 @@
 // 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 32eb2c513f8b0..2d1503c18560e 100644
--- a/clang/test/Preprocessor/init-arm.c
+++ b/clang/test/Preprocessor/init-arm.c
@@ -35,7 +35,6 @@
 // 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
@@ -235,7 +234,6 @@
 // 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
@@ -428,7 +426,6 @@
 // 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
@@ -623,7 +620,6 @@
 // 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
@@ -821,7 +817,6 @@
 // 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 d76396aa35c91..a07cee64e6848 100644
--- a/clang/test/Preprocessor/init-mips.c
+++ b/clang/test/Preprocessor/init-mips.c
@@ -37,7 +37,6 @@
 // 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
@@ -247,7 +246,6 @@
 // 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
@@ -467,7 +465,6 @@
 // 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
@@ -774,7 +771,6 @@
 // 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
@@ -1074,7 +1070,6 @@
 // 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
@@ -1284,7 +1279,6 @@
 // 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 4803a8511c7ed..55e5a6f58bd5e 100644
--- a/clang/test/Preprocessor/init-ppc.c
+++ b/clang/test/Preprocessor/init-ppc.c
@@ -30,7 +30,6 @@
 // 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
@@ -224,7 +223,6 @@
 // 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
@@ -422,7 +420,6 @@
 // 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
@@ -787,7 +784,6 @@
 // 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
@@ -995,7 +991,6 @@
 // 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 6aed0e7daa96b..45a43b6328d99 100644
--- a/clang/test/Preprocessor/init-ppc64.c
+++ b/clang/test/Preprocessor/init-ppc64.c
@@ -35,7 +35,6 @@
 // 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
@@ -240,7 +239,6 @@
 // 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
@@ -714,7 +712,6 @@
 // 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
@@ -912,7 +909,6 @@
 // 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 b0e45b5348ce9..6c646527f50f7 100644
--- a/clang/test/Preprocessor/init-s390x.c
+++ b/clang/test/Preprocessor/init-s390x.c
@@ -23,7 +23,6 @@
 // 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 482c7ad6ff687..ff5d4bbdea53a 100644
--- a/clang/test/Preprocessor/init-v7k-compat.c
+++ b/clang/test/Preprocessor/init-v7k-compat.c
@@ -28,7 +28,6 @@
 // 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 527cd39508889..287de8d90937c 100644
--- a/clang/test/Preprocessor/init-x86.c
+++ b/clang/test/Preprocessor/init-x86.c
@@ -24,7 +24,6 @@
 // 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
@@ -213,7 +212,6 @@
 // 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
@@ -416,7 +414,6 @@
 // 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
@@ -590,12 +587,6 @@
 // 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
@@ -631,7 +622,6 @@
 // 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
@@ -839,7 +829,6 @@
 // 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
@@ -1046,7 +1035,6 @@
 // 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
@@ -1341,7 +1329,6 @@
 // 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
@@ -1554,7 +1541,6 @@
 // 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 20ab2c05596b3..65d737352cad0 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -323,7 +323,6 @@
 // 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
@@ -511,7 +510,6 @@
 // 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
@@ -700,7 +698,6 @@
 // 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
@@ -904,7 +901,6 @@
 // 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
@@ -1105,7 +1101,6 @@
 // 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
@@ -1272,7 +1267,6 @@
 // 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
@@ -1564,7 +1558,6 @@
 // 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
@@ -1916,7 +1909,6 @@
 // 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
@@ -2199,7 +2191,6 @@
 // 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
@@ -2407,7 +2398,6 @@
 // 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

diff  --git a/clang/test/Preprocessor/predefined-flteval-macro.c b/clang/test/Preprocessor/predefined-flteval-macro.c
new file mode 100644
index 0000000000000..eba837a523b5e
--- /dev/null
+++ b/clang/test/Preprocessor/predefined-flteval-macro.c
@@ -0,0 +1,346 @@
+// RUN: %clang_cc1 -std=c11  -E -triple=aarch64 -xc  %s | FileCheck %s
+// RUN: %clang_cc1 -std=c11  -triple=aarch64 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=arm64 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=aarch64_be -xc  -fsyntax-only %s
+// RUN: %clang_cc1  -triple=arm64 -xc++  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=aarch64-apple-ios7.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=aarch64-windows-msvc -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=aarch64 -mcmodel=small -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=aarch64 -mcmodel=tiny -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=aarch64 -mcmodel=large -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv7-windows-msvc -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=arm-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple arm-none-none -target-abi apcs-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=armeb-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm-none-linux-gnueabi -target-feature +soft-float -target-feature +soft-float-abi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm-none-linux-gnueabi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=armv6-unknown-cloudabi-eabihf -fsyntax-only %s
+// RUN: %clang -c -ffreestanding -target arm-netbsd-eabi -fsyntax-only %s
+// RUN: %clang -c -ffreestanding -target arm-netbsd-eabihf -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm-none-eabi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm-none-eabihf -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=aarch64-none-eabi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=aarch64-none-eabihf -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=aarch64-none-elf -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7s -x c -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv6m -x c -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -x c -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7em -x c -fsyntax-only %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -x c -fsyntax-only %s
+// RUN: %clang -c -target arm -mhwdiv=arm -x c -fsyntax-only %s
+// RUN: %clang -c -target arm -mthumb -mhwdiv=thumb -x c -fsyntax-only %s
+// RUN: %clang -c -target arm -x c -fsyntax-only %s
+// RUN: %clang -c -target arm -mthumb -x c -fsyntax-only %s
+// RUN: %clang -c -target arm -mhwdiv=thumb -x c -fsyntax-only %s
+// RUN: %clang -c -target arm -mthumb -mhwdiv=arm -x c -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=armv8-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=armebv8-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv8 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbebv8 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv5 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv6t2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv7 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbebv7 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv7-pc-windows-gnu -exception-model=dwarf -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-none-none -target-cpu 603e -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=powerpc-none-none -target-cpu 603e -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-none-none -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.2.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix6.1.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix5.3.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix5.2.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix5.1.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix5.0.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix4.3.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix4.1.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix3.2.0.0 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -fno-wchar -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x c -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char -pthread -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-unknown-linux-gnu -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-unknown-linux-gnu -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-unknown-linux-gnu -target-feature +spe -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-unknown-linux-gnu -target-cpu 8548 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-apple-darwin8 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mipsel-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding             -triple=mips64-none-none -target-abi n32 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding             -triple=mips64-none-none -target-abi n32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding             -triple=mips64el-none-none -target-abi n32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=mips64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64el-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-nones             -target-cpu mips32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-none             -target-cpu mips32r2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-none             -target-cpu mips32r3 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-none             -target-cpu mips32r5 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips-none-none             -target-cpu mips32r6 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu mips64 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu mips64r2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu mips64r3 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu mips64r5 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu mips64r6 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu octeon -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-none-none             -target-cpu octeon+ -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +soft-float -ffreestanding    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +single-float -ffreestanding    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +soft-float -target-feature +single-float    -ffreestanding -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +mips16    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature -mips16    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +micromips    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature -micromips    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +dsp    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +dspr2    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +msa    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +nomadd4    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11     -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32r3 -target-feature +nan2008    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32r3 -target-feature -nan2008    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32r3 -target-feature +abs2008    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32r3 -target-feature -abs2008    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11      -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +fpxx    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32r6 -target-feature +fpxx    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11      -triple=mips64-none-none -fsyntax-only %s
+// RUN: not %clang_cc1 -std=c11  -target-feature -fp64    -triple=mips64-none-none  2>&1 -fsyntax-only %s
+// RUN: not %clang_cc1 -std=c11  -target-feature +fpxx    -triple=mips64-none-none  2>&1 -fsyntax-only %s
+// RUN: not %clang_cc1 -std=c11  -target-cpu mips64r6 -target-feature +fpxx    -triple=mips64-none-none  2>&1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature -fp64    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +fp64    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +single-float    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature +fp64    -triple=mips64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-feature -fp64 -target-feature +single-float    -triple=mips64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32r6    -triple=mips-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips64r6    -triple=mips64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32    -triple=mips-unknown-netbsd -mrelocation-model pic -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips64    -triple=mips64-unknown-netbsd -mrelocation-model pic -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32    -triple=mips-unknown-freebsd -mrelocation-model pic -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips64    -triple=mips64-unknown-freebsd -mrelocation-model pic -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips32    -triple=mips-unknown-openbsd -mrelocation-model pic -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -target-cpu mips64    -triple=mips64-unknown-openbsd -mrelocation-model pic -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr7 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=powerpc64-none-none -target-cpu pwr7 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-none-none -target-cpu pwr7 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu 630 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr3 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power3 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr4 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power4 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr5 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power5 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr5x -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power5x -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr6 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power6 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr6x -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power6x -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr7 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power7 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr8 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power8 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-none-none -target-cpu ppc64le -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr9 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power9 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu pwr10 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu power10 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-cpu future -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-feature +mma -target-cpu power10 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-none-none -target-feature +float128 -target-cpu power9 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=powerpc64-ibm-aix7.1.0.0 -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-linux-gnu -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-linux-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-linux-gnu -target-abi elfv1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-linux-gnu -target-abi elfv2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-linux-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-linux-gnu -target-abi elfv1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-freebsd11 -target-abi elfv1 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-freebsd12 -target-abi elfv1 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-freebsd13 -target-abi elfv2 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-freebsd13 -target-abi elfv2 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-openbsd -target-abi elfv2 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-linux-musl -target-abi elfv2 -xc  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-freebsd -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-freebsd -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=s390x-none-none -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=s390x-none-none -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=s390x-none-zos -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++14 -ffreestanding -triple=s390x-none-zos -fno-signed-char -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm64_32-apple-ios7.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=thumbv7k-apple-watchos2.0 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=2 -triple=i386-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=i386-pc-linux-gnu -target-cpu pentium4 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=i386-pc-linux-gnu -target-cpu pentium4 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=i386-pc-linux-gnu -target-cpu pentium4 -malign-double -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=2 -triple=i386-netbsd -target-cpu i486 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -DFEM=2 -triple=i386-netbsd -target-cpu i486 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=2 -triple=i386-netbsd -target-cpu i486 -malign-double -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=i386-netbsd -target-feature +sse2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=i386-netbsd6 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=1 -triple=i386-netbsd6 -target-feature +sse2 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -triple=i686-pc-mingw32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -fms-extensions -triple=i686-pc-mingw32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -triple=i686-unknown-cygwin -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -fms-extensions -triple=i686-unknown-cygwin -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=x86_64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64h-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -xc -mcmodel=medium -DFEM=2 -triple=i386-unknown-linux -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-none-none-gnux32 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=x86_64-none-none-gnux32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-unknown-cloudabi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-pc-linux-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-unknown-freebsd9.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-netbsd -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x assembler-with-cpp -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fblocks -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++2b -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++20 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++2a -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++17 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++1z -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++14 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++1y -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=c++11 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fdeprecated-macro -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -std=c99 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -std=c11 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -std=c1x -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -std=iso9899:2011 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -std=iso9899:201x -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=x86_64-pc-win32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=x86_64-pc-linux-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=x86_64-apple-darwin -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=armv7a-apple-darwin -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++2b -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++20 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++2a -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++17 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++1z -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++14 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++1y -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -std=gnu++11 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -std=iso9899:199409 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -fms-extensions -triple i686-pc-win32 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -DFEM=2 -fms-extensions -triple i686-pc-win32 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -fno-wchar -DFEM=2 -fms-extensions -triple i686-pc-win32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x objective-c -fsyntax-only %s
+// RUN: %clang_cc1  -x objective-c++ -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x objective-c -fobjc-gc -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x objective-c -fobjc-exceptions -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fno-inline -O3 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -O1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -Og -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -Os -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -Oz -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fpascal-strings -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fwchar-type=short -fno-signed-wchar -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fwchar-type=short -fno-signed-wchar -triple=x86_64-w64-mingw32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fwchar-type=short -fno-signed-wchar -triple=x86_64-unknown-windows-cygnus  -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fwchar-type=int -DFEM=2 -triple=i686-unknown-unknown -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fwchar-type=int -triple=x86_64-unknown-unknown -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=msp430-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=msp430-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=nvptx-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=nvptx-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=nvptx64-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=nvptx64-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x cl -ffreestanding -triple=amdgcn -fsyntax-only %s
+// RUN: %clang_cc1  -x cl -ffreestanding -triple=r600 -target-cpu caicos -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc-rtems-elf -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc-none-netbsd -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc-none-openbsd -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=sparc-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=sparc-none-openbsd -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=tce-none-none -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=tce-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-scei-ps4 -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -ffreestanding -triple=x86_64-scei-ps4 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple=x86_64-pc-mingw32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -fms-extensions -triple=x86_64-unknown-mingw32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc64-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc64-none-openbsd -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=x86_64-pc-kfreebsd-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=2 -triple=i686-pc-kfreebsd-gnu -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -DFEM=2 -triple i686-pc-linux-gnu -fobjc-runtime=gcc -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -triple sparc-rtems-elf -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x objective-c -DFEM=2 -triple i386-unknown-freebsd -fobjc-runtime=gnustep-1.9 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -x objective-c -DFEM=2 -triple i386-unknown-freebsd -fobjc-runtime=gnustep-2.5 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple arm-linux-androideabi -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -DFEM=2 -triple i686-linux-android -fsyntax-only %s
+// RUN: %clang_cc1  -x c++ -triple x86_64-linux-android -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple arm-linux-androideabi20 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple lanai-unknown-unknown -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=amd64-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=aarch64-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=arm-unknown-openbsd6.1-gnueabi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=2 -triple=i386-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=powerpc64le-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=mips64el-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=sparc64-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=riscv64-unknown-openbsd6.1 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=xcore-none-none -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=wasm32-unknown-unknown -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=wasm64-unknown-unknown -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=wasm32-wasi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=wasm64-wasi -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -DFEM=2 -triple i686-windows-cygnus -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple x86_64-windows-cygnus -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=avr -fsyntax-only %s
+// RUN: %clang_cc1  -ffreestanding     -DFEM=2 -triple i686-windows-msvc -fms-compatibility -x c++ -fsyntax-only %s
+// RUN: %clang_cc1  -ffreestanding     -triple x86_64-windows-msvc -fms-compatibility -x c++ -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding                   -triple=aarch64-apple-ios9 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding                   -triple=aarch64-apple-macosx10.12 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -triple i386-apple-macosx -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple x86_64-apple-macosx -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -triple i386-apple-ios-simulator -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple armv7-apple-ios -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple x86_64-apple-ios-simulator -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple arm64-apple-ios -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -triple i386-apple-tvos-simulator -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple armv7-apple-tvos -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple x86_64-apple-tvos-simulator -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple arm64-apple-tvos -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -DFEM=2 -triple i386-apple-watchos-simulator -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple armv7k-apple-watchos -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple x86_64-apple-watchos-simulator -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple arm64-apple-watchos -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple armv7-apple-none-macho -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -triple arm64-apple-none-macho -ffreestanding   -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=riscv32 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=riscv32-unknown-linux -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=riscv32  -fforce-enable-int128 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=riscv64 -fsyntax-only %s
+// RUN: %clang_cc1 -std=c11  -ffreestanding -triple=riscv64-unknown-linux -fsyntax-only %s
+#ifndef FEM
+#define FEM 0
+#endif
+#ifdef __cplusplus
+#define SASSERT static_assert
+#else
+#define SASSERT _Static_assert
+#endif
+int getFEM() {
+  SASSERT(__FLT_EVAL_METHOD__ == FEM, "Unexpected macro value");
+  return __FLT_EVAL_METHOD__;
+  // Note, the preprocessor in -E mode no longer expands this macro.
+  // CHECK: __FLT_EVAL_METHOD__
+}


        


More information about the cfe-commits mailing list