[PATCH] D62731: [RFC] Add support for options -fp-model= and -fp-speculation= : specify floating point behavior

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 12:09:32 PDT 2019


andrew.w.kaylor added inline comments.


================
Comment at: clang/docs/UsersManual.rst:1309
+
+   * ``precise`` Disables optimizations that are not value-safe on floating-point data, although FP contraction (FMA) is enabled.
+   * ``strict`` Enables precise and except, and disables contractions (FMA).
----------------
There's a bit of ambiguity here because FP contraction isn't an on/off switch in LLVM. It has three settings: on, off, and fast. What you've done in this patch sets it to 'on' for precise, 'off' for strict, and 'fast' for fast. That sounds reasonable, but it's not what ICC and MSVC do. ICC and MSVC both have a behavior equivalent to -ffp-contract=fast in the precise model.

The idea behind this is that FMA operations are actually more precise than the non-contracted operations. They don't always give the same result, but they give a more precise result. The problem with this is that if we adopt this approach it leaves us with no fp model that corresponds to the default compiler behavior if you don't specify an -fp-model  at all.


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