From f4d455ba6f6017e0b97a648423c858a44783ce2d Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Thu, 17 May 2018 12:05:09 +0200 Subject: [PATCH] Only compile the AVX512 version of meswap if using the Intel compiler. --- src/memswap.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/memswap.h b/src/memswap.h index 92c902eeb1..2f7b9215ed 100644 --- a/src/memswap.h +++ b/src/memswap.h @@ -49,11 +49,13 @@ * * Keep in mind that this function only works when the underlying data * is aligned to the vector length, e.g. with the @c - * __attribute__((aligned(32))) - * syntax! + * __attribute__((aligned(32))) syntax! * Furthermore, register re-labeling only seems to work when the code is * compiled with @c -funroll-loops. * + * Note that GCC (at least until 7.3) produces incorrect AVX512 code here + * by automatically assuming alignment. + * * @param void_a Pointer to the first element. * @param void_b Pointer to the second element. * @param bytes Size, in bytes, of the data pointed to by @c a and @c b. @@ -61,7 +63,7 @@ __attribute__((always_inline)) inline void memswap(void *void_a, void *void_b, size_t bytes) { char *a = (char *)void_a, *b = (char *)void_b; -#ifdef __AVX512F__ +#if defined(__AVX512F__) && defined(__INTEL_COMPILER) swap_loop(__m512i, a, b, bytes); #endif #ifdef __AVX__ -- GitLab