From ab70a26a0f46b0c533f25c5d85c26051fc9f8689 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Thu, 27 May 2021 15:20:55 +0000
Subject: [PATCH] Workaround for __BIGGEST_ALIGNMENT__ on Clang

On x86_64, this is always 128 bits, rendering it incompatible with AVX.
GCC reports the maximum enabled vector width (which is what we want) and Intel reports the maximum supported vector width (which is okay too).
---
 src/field/Field.impl.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/field/Field.impl.h b/src/field/Field.impl.h
index a70bdf813..20ee14bb9 100644
--- a/src/field/Field.impl.h
+++ b/src/field/Field.impl.h
@@ -316,14 +316,20 @@ namespace field {
       // Automatically select allocator if none was given
       if ( alloc == nullptr )
       {
-#ifdef __BIGGEST_ALIGNMENT__
-         const uint_t alignment = __BIGGEST_ALIGNMENT__;
+#if defined(__ARM_FEATURE_SVE) && defined(__ARM_FEATURE_SVE_BITS) && __ARM_FEATURE_SVE_BITS > 0
+         const uint_t alignment = __ARM_FEATURE_SVE_BITS/8;
+#elif defined(__ARM_FEATURE_SVE)
+         const uint_t alignment = 64;
+#elif defined(__ARM_NEON)
+         const uint_t alignment = 16;
 #elif defined(__AVX512F__)
          const uint_t alignment = 64;
 #elif defined(__AVX__)
          const uint_t alignment = 32;
 #elif defined(__SSE__) || defined(_MSC_VER)
          const uint_t alignment = 16;
+#elif defined(__BIGGEST_ALIGNMENT__)
+         const uint_t alignment = __BIGGEST_ALIGNMENT__;
 #else
          const uint_t alignment = 64;
 #endif
-- 
GitLab