freebsd-dev/lib/msun
Dimitry Andric 3b00222f15 Avoid raising unexpected floating point exceptions in libm
When using clang with x86_64 CPUs that support AVX, some floating point
transformations may raise exceptions that would not have been raised by
the original code. To avoid this, use the -fp-exception-behavior=maytrap
flag, introduced in clang 10.0.0.

In particular, this fixes a number of test failures with ctanhf(3) and
ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID
exception is then raised, because clang emits vdivps instructions to
perform certain divides. (The vdivps instruction operates on multiple
single-precision float operands simultaneously, but the exceptions may
be influenced by unused parts of the XMM registers. In this particular
case, it was calculating 0 / 0, which results in FE_INVALID.)

If -fp-exception-behavior=maytrap is specified however, clang uses
vdivss instructions instead, which work on one operand, and should not
raise unexpected exceptions.

Reported by:	olivier
Reviewed by:	arichardson
PR:		254911
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D29686
2021-04-10 13:59:57 +02:00
..
aarch64 Save all fpcr/fpsr bits in the AArch64 fenv_t 2021-03-12 17:01:41 +00:00
amd64 libm: Add missing END() directives for amd64 routines 2019-10-23 16:05:52 +00:00
arm lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
bsdsrc msun: drop clause 3 from the Berkeley license. 2019-12-27 01:11:26 +00:00
i387 Add CFI start/end proc directives to arm64, i386, and ppc 2020-12-05 00:33:28 +00:00
ld80 lib/msun: Fix x86 GCC6 build after 221622ec0c 2021-03-12 18:44:44 +00:00
ld128 lib/msun: Avoid FE_INEXACT for x86 log2l/log10l 2021-03-08 09:39:32 +00:00
man Fix a few mandoc issues 2020-10-09 19:12:44 +00:00
mips lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
powerpc [POWERPC] msun: fix incorrect flag in fesetexceptflag 2020-11-17 12:36:59 +00:00
riscv RISC-V: Fix feenableexcept return value 2021-03-25 11:16:20 +00:00
src Avoid -pedantic warnings about using _Generic in __fp_type_select 2021-04-08 18:20:32 +02:00
tests lib/msun/tests: Drop WARNS=6 2021-03-22 16:57:43 +00:00
x86 Resolve conflicts between macros in fenv.h and ieeefp.h 2018-05-31 20:22:47 +00:00
Makefile Avoid raising unexpected floating point exceptions in libm 2021-04-10 13:59:57 +02:00
Makefile.depend Update Makefile.depend files 2019-12-11 17:37:53 +00:00
Symbol.map msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd 2018-07-15 00:23:10 +00:00