From 05be3207f7f32fb97dde931400f9550f62ba8032 Mon Sep 17 00:00:00 2001
From: James Willis <james.s.willis@durham.ac.uk>
Date: Fri, 28 Apr 2017 12:02:35 +0100
Subject: [PATCH] Define VEC_HADD for GCC when using AVX-512 architectures.

---
 src/vector.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/vector.h b/src/vector.h
index a8dfd726b7..9c69543fc1 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -107,8 +107,13 @@
   }
 
 /* Performs a horizontal add on the vector and adds the result to a float. */
+#ifdef __ICC
 #define VEC_HADD(a, b) b += _mm512_reduce_add_ps(a.v)
-
+#else /* _mm512_reduce_add_ps not present in GCC compiler. TODO: Implement intrinsic version.*/
+#define VEC_HADD(a, b) {                      \
+  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) \
-- 
GitLab