[PATCH] D93769: [clang] Add support for option -ffp-eval-method and extend #pragma float_control similarly

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 07:07:24 PST 2021


aaron.ballman added a reviewer: rsmith.
aaron.ballman added a comment.

One question that came up in off-line discussions with @mibintc is whether the evaluation method should have an impact on constant folding or not. My intuition is that it should impact constant folding because it would be pretty strange for the evaluation at runtime to produce different results, but I don't have anything concrete to back my intuition up with.



================
Comment at: clang/docs/UsersManual.rst:1464
+
+   * ``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``.
----------------



================
Comment at: clang/include/clang/Basic/LangOptions.h:234
+    FEM_Extended,
+    /// Use the default float eval method specified by Target
+    FEM_TargetDefault
----------------
FYI: it may be somewhat confusing that we have an enumerator with `default` in the name but that enumerator isn't the default.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3080
     Opts.LexEditorPlaceholders = false;
+    Opts.LexExpandSpecialBuiltins = false;
+  }
----------------
May want to update the comment above for why we're turning the option off here.


================
Comment at: clang/lib/Lex/PPMacroExpansion.cpp:1714
       });
-  } 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;
----------------
It looks like some unrelated formatting changes snuck in.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93769/new/

https://reviews.llvm.org/D93769



More information about the cfe-commits mailing list