diff --git a/src/memswap.h b/src/memswap.h index 92c902eeb158978d4a606f5f2a9416d4113fae0b..2f7b9215ed48535fab9e8331303457c2f92859cd 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__