From 3859226728a3566ed7b1aa77f515d85034b510d6 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 20 Aug 2024 11:52:38 +0200 Subject: [PATCH] test: hide some NAN checks if SIMDE_FAST_NANS --- test/test.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/test/test.h b/test/test.h index bfd02107e..640ce6b23 100644 --- a/test/test.h +++ b/test/test.h @@ -129,6 +129,7 @@ simde_test_codegen_snprintf_(char* str, size_t size, const char* format, ...) { } } +#if !defined(SIMDE_FAST_NANS) static void simde_test_codegen_f16(size_t buf_len, char buf[HEDLEY_ARRAY_PARAM(buf_len)], simde_float16 value) { simde_float32 valuef = simde_float16_to_float32(value); @@ -174,6 +175,7 @@ simde_test_codegen_bf16(size_t buf_len, char buf[HEDLEY_ARRAY_PARAM(buf_len)], s simde_test_codegen_snprintf_(buf, buf_len, "SIMDE_BFLOAT16_VALUE(%9.2f)", HEDLEY_STATIC_CAST(double, valuef)); } } +#endif /* !defined(SIMDE_FAST_NANS) */ static void simde_test_codegen_i8(size_t buf_len, char buf[HEDLEY_ARRAY_PARAM(buf_len)], int8_t value) { @@ -414,6 +416,7 @@ simde_test_codegen_float_set_value_(size_t element_size, size_t pos, void* value } } +#if !defined(SIMDE_FAST_NANS) static void simde_test_codegen_random_vfX_full_( size_t test_sets, size_t vectors_per_set, size_t elements_per_vector, @@ -457,6 +460,7 @@ simde_test_codegen_random_vfX_full_( simde_test_codegen_float_set_value_(elem_size, b, values, HEDLEY_STATIC_CAST(simde_float32, v), v); } } +#endif /* !defined(SIMDE_FAST_NANS) */ static void simde_test_codegen_random_vf16_full( @@ -731,9 +735,12 @@ SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ static int simde_test_equal_f32(simde_float32 a, simde_float32 b, simde_float32 slop) { - if (simde_math_isnan(a)) { - return simde_math_isnan(b); - } else if (simde_math_isinf(a)) { + #if !defined(SIMDE_FAST_NANS) + if (simde_math_isnan(a)) { + return simde_math_isnan(b); + } + #endif + if (simde_math_isinf(a)) { return !((a < b) || (a > b)); } else if (slop == SIMDE_FLOAT32_C(0.0)) { return !simde_memcmp(&a, &b, sizeof(simde_float32)); @@ -761,9 +768,12 @@ simde_test_equal_f16(simde_float16 a, simde_float16 b, simde_float16 slop) { static int simde_test_equal_f64(simde_float64 a, simde_float64 b, simde_float64 slop) { - if (simde_math_isnan(a)) { - return simde_math_isnan(b); - } else if (simde_math_isinf(a)) { + #if !defined(SIMDE_FAST_NANS) + if (simde_math_isnan(a)) { + return simde_math_isnan(b); + } + #endif + if (simde_math_isinf(a)) { return !((a < b) || (a > b)); } else if (slop == SIMDE_FLOAT64_C(0.0)) { return !simde_memcmp(&a, &b, sizeof(simde_float64));