i686: Do not raise exception traps on fesetexcept (BZ 30989)
commit47a9eeb9ba72fd30766bdf4faa7d46b8ca33a7fd
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 24 Oct 2023 11:37:15 +0000 (24 08:37 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 19 Dec 2023 18:12:38 +0000 (19 15:12 -0300)
tree4ca5baa3c7cee9c6e40b0bfc583d8c0d2e3ccbe4
parentecb1e7220ddc7a4845bbd1b6fd7fcf17aba566bd
i686: Do not raise exception traps on fesetexcept (BZ 30989)

According to ISO C23 (7.6.4.4), fesetexcept is supposed to set
floating-point exception flags without raising a trap (unlike
feraiseexcept, which is supposed to raise a trap if feenableexcept
was called with the appropriate argument).

The flags can be set in the 387 unit or in the SSE unit.  To set
a flag, it is sufficient to do it in the SSE unit, because that is
guaranteed to not trap.  However, on i386 CPUs that have only a
387 unit, set the flags in the 387, as long as this cannot trap.

Checked on i686-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
math/test-fesetexcept-traps.c
sysdeps/i386/fpu/fesetexcept.c
sysdeps/i386/fpu/math-tests-trap-force.h [copied from sysdeps/i386/fpu/fesetexcept.c with 59% similarity]
sysdeps/x86/fpu/test-fenv-sse-2.c