From ae2120aa6fe8ca9ee0b80de7562f6e0eec443ec9 Mon Sep 17 00:00:00 2001
From: WILLIS <rsrd54@hamilton1.hpc.dur.ac.uk>
Date: Sun, 21 May 2017 12:15:24 +0100
Subject: [PATCH] Added corrections for AVX2 and AVX-512.

---
 src/runner_doiact_vec.c | 4 ++--
 src/vector.h            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/runner_doiact_vec.c b/src/runner_doiact_vec.c
index 2fa6051892..c429df0948 100644
--- a/src/runner_doiact_vec.c
+++ b/src/runner_doiact_vec.c
@@ -363,7 +363,7 @@ __attribute__((always_inline)) INLINE static void storeForceInteractions(
 #if defined(HAVE_AVX2) || defined(HAVE_AVX512_F)
   /* Invert hj. */
   vector v_hj, v_hj_inv;
-  v_hj = vec_load(&cell_cache->h[pjd]);
+  v_hj.v = vec_load(&cell_cache->h[pjd]);
   v_hj_inv = vec_reciprocal(v_hj);
 
   mask_t packed_mask;
@@ -382,7 +382,7 @@ __attribute__((always_inline)) INLINE static void storeForceInteractions(
   VEC_LEFT_PACK(vec_load(&cell_cache->pOrho2[pjd]), packed_mask, &int_cache->pOrho2q[*icount]);
   VEC_LEFT_PACK(vec_load(&cell_cache->balsara[pjd]), packed_mask, &int_cache->balsaraq[*icount]);
   VEC_LEFT_PACK(vec_load(&cell_cache->soundspeed[pjd]), packed_mask, &int_cache->soundspeedq[*icount]);
-  VEC_LEFT_PACK(v_hj_inv->v, packed_mask, &int_cache->h_invq[*icount]);
+  VEC_LEFT_PACK(v_hj_inv.v, packed_mask, &int_cache->h_invq[*icount]);
   
   /* Increment interaction count by number of bits set in mask. */
   (*icount) += __builtin_popcount(mask);
diff --git a/src/vector.h b/src/vector.h
index d50bbd80e8..a7fd01ac59 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -241,7 +241,7 @@
 
 /* Performs a left-pack on a vector based upon a mask and returns the result. */
 #define VEC_LEFT_PACK(a, mask, result) \
-  vec_unaligned_store(_mm256_permutevar8x32_ps(a, mask), result)
+  vec_unaligned_store(_mm256_permutevar8x32_ps(a, mask.m), result)
 #endif /* HAVE_AVX2 */
 
 /* Create an FMA using vec_add and vec_mul if AVX2 is not present. */
-- 
GitLab