test: Avoid -ffinite-math-only on floating point comparisons - #1373
Conversation
30e03ea to
cea5dd8
Compare
cea5dd8 to
7afd6ea
Compare
7afd6ea to
c68fff9
Compare
c68fff9 to
6e7c5b5
Compare
6e7c5b5 to
9f3bd66
Compare
With `-ffinite-math-only` (implied by `-ffast-math` and -Ofast), GCC considers all comparisons against infinities to be false and can optimize them away. This breaks several tests that rely on infinities to be compared correctly. To avoid this, we add GCC-specific optimize attribute that disables `-ffinite-math-only` optimization for floating point comarisions used in assertions. Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
From the GCC manual page: > Disregard strict standards compliance. -Ofast enables all -O3 optimizations. > It also enables optimizations that are not valid for all standard-compliant > programs. It turns on -ffast-math, -fallow-store-data-races. > It turns off -fsemantic-interposition. On recent clang, keep "-ffast-math" due to > error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same > behavior, or '-O3' to enable only conforming optimizations > [-Werror,-Wdeprecated-ofast] skipping "-O3" due to clang/llvm compiler bugs
9f3bd66 to
8cf787c
Compare
mr-c
left a comment
There was a problem hiding this comment.
-Ofast produces errors with various GCC versions; perhaps they are compiler errors, perhaps they are issues that SIMDe can workaround.
Regardless, they need addressing before we merge; unless -ffast-math is sufficient?
|
The idea of commit Since What it can do is to allow to unskip some tests that are currently skipped when |
|
@iv-m Great! Can you revert the change to use |
Well, I won't promise I'll review every entrance of And I think since this change affects only some GCC-like compilers, these tests should stay disabled for all the rest of the compilers, and so another feature-test macro is needed for use in place of #if defined(SIMDE_FAST_MATH)
#define SIMDE_TEST_EQUALTITY_WORKS_FOR_INFINITIES
#endif
#if defined(SIMDE_FAST_MATH) && defined(HEDLEY_GCC_VERSION) && HEDLEY_GCC_VERSION_CHECK(4,4,0)
/* For these GCC versions, `-ffinite-math-only` is disabled for
* the functions that are used in assertions */
#define SIMDE_TEST_EQUALTITY_WORKS_FOR_INFINITIES
#endif
|
With
-ffinite-math-only(implied by-ffast-mathand -Ofast), GCC considers all comparisons against infinities to be false and can optimize them away. This breaks several tests that rely on infinities to be compared correctly. To avoid this, we add GCC-specific optimize attribute that disables-ffinite-math-onlyoptimization for floating point comarisions used in assertions.