diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-10-24 08:37:15 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-12-19 15:12:38 -0300 |
commit | 47a9eeb9ba72fd30766bdf4faa7d46b8ca33a7fd (patch) | |
tree | 4ca5baa3c7cee9c6e40b0bfc583d8c0d2e3ccbe4 /sysdeps/x86 | |
parent | ecb1e7220ddc7a4845bbd1b6fd7fcf17aba566bd (diff) | |
download | glibc-47a9eeb9ba72fd30766bdf4faa7d46b8ca33a7fd.tar.gz glibc-47a9eeb9ba72fd30766bdf4faa7d46b8ca33a7fd.tar.xz glibc-47a9eeb9ba72fd30766bdf4faa7d46b8ca33a7fd.zip |
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>
Diffstat (limited to 'sysdeps/x86')
-rw-r--r-- | sysdeps/x86/fpu/test-fenv-sse-2.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/sysdeps/x86/fpu/test-fenv-sse-2.c b/sysdeps/x86/fpu/test-fenv-sse-2.c index f3e820b6ed..7a0503790f 100644 --- a/sysdeps/x86/fpu/test-fenv-sse-2.c +++ b/sysdeps/x86/fpu/test-fenv-sse-2.c @@ -22,17 +22,8 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> - -static bool -have_sse2 (void) -{ - unsigned int eax, ebx, ecx, edx; - - if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) - return false; - - return (edx & bit_SSE2) != 0; -} +#include <cpu-features.h> +#include <support/check.h> static uint32_t get_sse_mxcsr (void) @@ -164,13 +155,9 @@ sse_tests (void) static int do_test (void) { - if (!have_sse2 ()) - { - puts ("CPU does not support SSE2, cannot test"); - return 0; - } + if (!CPU_FEATURE_USABLE (SSE2)) + FAIL_UNSUPPORTED ("CPU does not support SSE2"); return sse_tests (); } -#define TEST_FUNCTION do_test () -#include <test-skeleton.c> +#include <support/test-driver.c> |