From 1b5cf34835c624453eac56fcdeebd762d89ee2cc Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Thu, 29 Jun 2017 13:49:41 +0100 Subject: [PATCH] Fixed bugs in AVX-512 instructions. Conflicts: src/vector.h --- src/vector.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vector.h b/src/vector.h index 7d82b9f5c9..93b7968475 100644 --- a/src/vector.h +++ b/src/vector.h @@ -116,10 +116,13 @@ for (int i = 0; i < VEC_SIZE; i++) b += a.f[i]; \ } #endif -/* Calculates the number of set bits in the mask and adds the result to an int. - */ -#define VEC_FORM_PACKED_MASK(mask, v_mask, pack) \ - pack += __builtin_popcount(mask); + +/* Do nothing in the case of AVX-512 as there are already + * instructions for left-packing.*/ +#define VEC_FORM_PACKED_MASK(mask, packed_mask) packed_mask = mask + +/* Finds the horizontal maximum of vector b and returns a float. */ +#define VEC_HMAX(a, b) b = _mm512_reduce_max_ps(a.v) /* Performs a left-pack on a vector based upon a mask and returns the result. */ #define VEC_LEFT_PACK(a, mask, result) \ -- GitLab