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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 10:15:18 PDT 2019


rjmccall added a subscriber: scanon.
rjmccall added a comment.

I think this is a step in the right direction, thank you.  I'd like @scanon to weigh in on the evolving design here.



================
Comment at: clang/docs/UsersManual.rst:1314
+   ``-ffp-model=strict``, or merely establish the rounding mode setting
+   parameter to the llvm floating point constrained intrinsics.
+
----------------
What you should document here are the semantics and how the option interacts with other options, not how code gets translated into LLVM.  I'm not sure what the FIXME question here is; are you asking whether providing `-frounding-math` should *imply* an FP model?

The notes about each of the options should probably be structured into a bullet list.


================
Comment at: clang/docs/UsersManual.rst:1336
+   enables ``-fp-contract=fast``, and conflicts with: ``-fp-contract=on``,
+   ``-fp-contract=off``.
+
----------------
This is basically incomprehensible. :) I don't know if the problem is the behavior or just how it's being described, but I have no idea what "conflict" means — does it mean the option gets overridden, ignored, or causes an error?  I think what you're trying to say is:

- Basic FP behavior can be broken down along two dimensions: the FP strictness model and the FP exceptions model.
- There are many existing options for controlling FP behavior.
- Some of these existing options are equivalent to setting one (or both?) of these dimensions.  These options should generally be treated as synonyms for the purposes of deciding the ultimate setting; for example, `-ffp-model=fast -fno-fast-math` should basically leave the setting in its default state (right?).
- Other existing options only make sense in combination with certain basic models.  For example, `-ffp-contract=fast` (note the spelling) is only allowed when using the fast FP model (right?).

As a specific note, you break out the options into a list below; the entry for `fast` is the place to add things like "Equivalent to `-ffast-math`, including defining `__FAST_MATH__`)".


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731





More information about the cfe-commits mailing list