[PATCH] D151834: Include math-errno with fast-math

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 12:31:33 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/FPOptions.def:29
 OPTION(Float16ExcessPrecision, LangOptions::ExcessPrecisionKind, 2, FPEvalMethod)
 OPTION(BFloat16ExcessPrecision, LangOptions::ExcessPrecisionKind, 2, FPEvalMethod)
+OPTION(MathErrno, bool, 1, BFloat16ExcessPrecision)
----------------
zahiraam wrote:
> aaron.ballman wrote:
> > Shouldn't this one be `Float16ExcessPrecision`? (Are we missing test coverage that would have caught that?)
> oops! the test would be for the BFloat16ExcessPrecision, right?
Yup -- that can be handled in a separate patch as it doesn't really have much to do with this one -- just something I noticed as a drive-by.


================
Comment at: clang/include/clang/Basic/LangOptions.h:857
     setAllowApproxFuncOverride(!Value);
+    setMathErrnoOverride(Value);
     if (Value)
----------------
zahiraam wrote:
> aaron.ballman wrote:
> > Everything else does `!Value`; is it intentional that you're using `Value` instead?
> Yes. I want to set the value of math-errno to the value of the pragma in the source.
Hmm, okay. Making sure I understand the logic, please excuse me if this is a dumb question. :-) So the idea here is that if fp_precise is on, we have to honor math errno, and if fp_precise is off, we can ignore math errno?


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2297
+
+  // True if we are compiling at -O2 and errno has been disabled
+  // using the '#pragma float_control(precise, off)', and attribute opt-none
----------------
Is the part about `-O2` accurate? We just check not `-O0` in the code.


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

https://reviews.llvm.org/D151834



More information about the cfe-commits mailing list