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

Michele Scandale via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 23:58:19 PST 2019


michele.scandale added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2337
+            << "-ffp-contract=fast";
+        optID = options::OPT_ffast_math;
+        FPModel = Val;
----------------
Here it seems you are changing `optID` to `OPT_ffast_math` to reuse the logic specified below for that case to reset the state of the floating point options.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2345
+            << "-ffp-contract=fast";
+        optID = options::OPT_ffp_contract;
+        FPModel = Val;
----------------
Here the state of the floating point options seems unchanged except for `FPContract`. If I run `clang -ffp-model=fast -ffp-model=precise`, I would expect the state of the floating point options to match the one of `-fno-fast-math` except for `FPContract` which you want to be set to "fast".

I think you might need to replicate the reset for all the option here as well, so at this point I don't know how much worth is to use the optID reset trick for the "fast" case only.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62731





More information about the llvm-commits mailing list