From 5405bbdcc7e9045b0901c847c8868594deb511a6 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter <106664923+thomas-schlichter@users.noreply.github.com> Date: Fri, 15 Dec 2023 18:49:43 +0100 Subject: [PATCH] avx512 abs: refine GCC compiler checks for `_mm512{,_mask}_abs_pd` (#1118) Adds definition of SIMDE_BUG_GCC_87467 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87467 It is fixed in versions 7.4.0 and 8.3.0 and above. Closes #1117 --- simde/simde-common.h | 3 +++ simde/x86/avx512/abs.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/simde/simde-common.h b/simde/simde-common.h index 3734a7ecb..212f23d8c 100644 --- a/simde/simde-common.h +++ b/simde/simde-common.h @@ -984,6 +984,9 @@ HEDLEY_DIAGNOSTIC_POP # if !HEDLEY_GCC_VERSION_CHECK(4,6,0) # define SIMDE_BUG_GCC_BAD_MM_EXTRACT_EPI8 /* TODO: find relevant bug or commit */ # endif +# if !HEDLEY_GCC_VERSION_CHECK(7,4,0) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && !HEDLEY_GCC_VERSION_CHECK(8,3,0)) +# define SIMDE_BUG_GCC_87467 +# endif # if !HEDLEY_GCC_VERSION_CHECK(8,0,0) # define SIMDE_BUG_GCC_REV_247851 # endif diff --git a/simde/x86/avx512/abs.h b/simde/x86/avx512/abs.h index 5c0871b75..5ff001485 100644 --- a/simde/x86/avx512/abs.h +++ b/simde/x86/avx512/abs.h @@ -524,7 +524,7 @@ simde_mm512_mask_abs_ps(simde__m512 src, simde__mmask16 k, simde__m512 v2) { SIMDE_FUNCTION_ATTRIBUTES simde__m512d simde_mm512_abs_pd(simde__m512d v2) { - #if defined(SIMDE_X86_AVX512F_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(8,3,0)) + #if defined(SIMDE_X86_AVX512F_NATIVE) && !defined(SIMDE_BUG_GCC_87467) return _mm512_abs_pd(v2); #elif defined(SIMDE_X86_AVX512F_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) /* gcc bug: https://gcc.gnu.org/legacy-ml/gcc-patches/2018-01/msg01962.html */ @@ -560,7 +560,7 @@ simde_mm512_abs_pd(simde__m512d v2) { SIMDE_FUNCTION_ATTRIBUTES simde__m512d simde_mm512_mask_abs_pd(simde__m512d src, simde__mmask8 k, simde__m512d v2) { - #if defined(SIMDE_X86_AVX512F_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(8,3,0)) + #if defined(SIMDE_X86_AVX512F_NATIVE) && !defined(SIMDE_BUG_GCC_87467) return _mm512_mask_abs_pd(src, k, v2); #elif defined(SIMDE_X86_AVX512F_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) /* gcc bug: https://gcc.gnu.org/legacy-ml/gcc-patches/2018-01/msg01962.html */