[PATCH] D72841: Add support for pragma float_control, to control precision and exception behavior at the source level

Melanie Blower via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 13:04:09 PDT 2020


mibintc marked 2 inline comments as done.
mibintc added a comment.

added a couple inline explanatory comments



================
Comment at: clang/include/clang/Basic/LangOptions.h:307
 
+  bool denormalIsIEEE = false;
+
----------------
I added this boolean as part of validating the correctness of the pragma's that access the FP environment, according to the Microsoft checks.. Copying from the Microsoft doc:  "There are restrictions on the ways you can use the fenv_access pragma in combination with other floating-point settings:

You can't enable fenv_access unless precise semantics are enabled. Precise semantics can be enabled either by the float_control pragma, or by using the /fp:precise or /fp:strict compiler options. The compiler defaults to /fp:precise if no other floating-point command-line option is specified.

You can't use float_control to disable precise semantics when fenv_access(on) is set."
This is copied from https://docs.microsoft.com/en-us/cpp/preprocessor/fenv-access?view=vs-2019


================
Comment at: clang/test/CodeGen/constrained-math-builtins.c:157
 
-// CHECK: call float @llvm.experimental.constrained.fmuladd.f32
-// CHECK: fneg
-// CHECK: call double @llvm.experimental.constrained.fmuladd.f64
-// CHECK: fneg
-// CHECK: call x86_fp80 @llvm.experimental.constrained.fmuladd.f80
+  // CHECK: call contract float @llvm.experimental.constrained.fmuladd.f32
+  // CHECK: fneg
----------------
Since this patch constructs the FPFeatures using the floating point settings from the command line versus the default FPOptions() constructor, several tests need to be changed. Some of the changes I made showing the flags on the IR, other tests I changed by adding ffp-contract to the RUN line to match the expected IR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841





More information about the llvm-commits mailing list