[PATCH] D62731: Add support for options -frounding-math, ftrapping-math, -fp-model=, and -fp-exception-behavior=, : Specify floating point behavior

Melanie Blower via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 13:19:35 PDT 2019


mibintc marked 5 inline comments as done.
mibintc added inline comments.


================
Comment at: clang/docs/UsersManual.rst:1330
+   and ``fast``.
+   Details:
+
----------------
rjmccall wrote:
> rjmccall wrote:
> > "provided by other, single-purpose floating point options."
> I don't know why you keep including "clang" as a modifier here; this is the clang documentation, and all of these options are clang options no matter where they might have been borrowed from.
thanks for explicitly pointing out use of 'clang', i fixed it 


================
Comment at: clang/docs/UsersManual.rst:1341
+   has been selected, then the compiler will issue a diagnostic warning
+   that the override has occurred.
+
----------------
rjmccall wrote:
> mibintc wrote:
> > rjmccall wrote:
> > > That's not typical driver behavior; why this choice?
> > The rationale for the warnings is that the floating point options are sufficiently complicated that it makes sense to warn the uses that one of the later options supplied on the command line is undoing a choice made earlier.  It's not obvious that e.g. the setting for fassociative-math is also controlled by  -fp-model=strict
> Okay.  Well, it's a new option, so new behavior is alright, but if you're worried about the collisions having arbitrary effects that you'll have to maintain compatibility with, you should consider making it an error instead, because a warning still means it's permitted.
@andrew.w.kaylor What do you think about making the diagnostics error vs. warning?


================
Comment at: clang/include/clang/Basic/LangOptions.h:187
 
+  enum FPRoundingModeKind {
+    // Round to the nearest integer - IEEE rounding mode
----------------
Currently there's no way to get at any of these values besides ToNearest and Dynamic, but I put all the supported values here to support future work


================
Comment at: clang/include/clang/Basic/LangOptions.h:203
+   // Floating point exceptions are not handled: fp exceptions are masked.
+   FPEB_Ignore,  // This is the default
+   // Optimizer will avoid transformations that may raise exceptions that would
----------------
-fno-trapping-math implemented by selecting -ffp-exception-behavior=ignore and -ftrapping-math is implemented by selecting -ffp-exception-behavior=strict.   What do you think about making ftrapping-math a Driver only option, so that Driver converts the values like this. Otherwise let's make fp-exception-behavior take precedence, in llvm, over ftrapping-math (trapping math is t/f but exception behavior, in the llvm Constrained Floating Point Intrinsics, can take 3 values)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731





More information about the llvm-commits mailing list