[llvm-dev] Floating point semantic modes
Cameron McInally via llvm-dev
llvm-dev at lists.llvm.org
Wed Jan 29 07:59:34 PST 2020
On Wed, Jan 29, 2020 at 6:19 AM Szabolcs Nagy <nsz at port70.net> wrote:
>
> * Blower, Melanie I <melanie.blower at intel.com> [2020-01-28 19:24:24 +0000]:
> > About math-errno:
> > There are comments in the clang code that describe the settings for math-errno as toolchain dependent. Here's the initialization:
> > // -fmath-errno is the default on some platforms, e.g. BSD-derived OSes.
> > bool MathErrno = TC.IsMathErrnoDefault();
>
> that's interesting since the bsd libm does not touch errno
> (at least on freebsd), so for them this creates significant
> overhead (e.g. when sqrt is inlined, the compiler still emits
> code to check the input and fall back to the libc sqrt call
> just in case it wants to set errno)
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__gcc.gnu.org_bugzilla_show-5Fbug.cgi-3Fid-3D37073&d=DwIBAg&c=slrrB7dE8n7gBJbeO0g-IQ&r=O_4M49EtSpZ_-BQYeigzGv0P4__noMcSu2RYEjS1vKs&m=odUB_gXwu5Vt9gmHin36eUdSuDVUfd8jQqWAYPs_NzQ&s=yvN7WF-dbQSNc9Stp9v-WnlYl9B97e2G2npaJ44Eohg&e=
>
> > Here's another comment,
> > // Turning *off* -ffast-math restores the toolchain default.
> > MathErrno = TC.IsMathErrnoDefault();
>
> i guess the default can be tied to the libm behaviour of the
> target (but ideally it will be the same everywhere so it's
> easier to get portable behaviour)
>
> (i personally would get rid of math errno, it causes problems,
Agreed. Worrying about it isn't pragmatic. And we've made it this far
without proper error handling...
> but i think the gcc/glibc position is that c89 only had errno,
> no fenv exceptions, so it should be supported for bw compat)
More information about the llvm-dev
mailing list