diff --git a/src/pystencils/include/simd_horizontal_helpers.h b/src/pystencils/include/simd_horizontal_helpers.h
index cd4bd5730657930f7a2375f74df0f5691ebaaf15..bd1889153a56876032781b77dcb66a413b3fe07d 100644
--- a/src/pystencils/include/simd_horizontal_helpers.h
+++ b/src/pystencils/include/simd_horizontal_helpers.h
@@ -120,7 +120,7 @@ inline float _mm256_horizontal_max_ps(float dst, __m256 src) {
 
 #endif
 
-#if defined(__AVX512VL__)
+#if defined(__AVX512F__)
 #include <immintrin.h>
 
 inline double _mm512_horizontal_add_pd(double dst, __m512d src) { 
diff --git a/util/generate_simd_horizontal_op.py b/util/generate_simd_horizontal_op.py
index aebbf35bb65dd9fd66374a98a038ed3c4a3151db..1d652c6e1f53f5a7b060f2a725162ef07f1fdfae 100644
--- a/util/generate_simd_horizontal_op.py
+++ b/util/generate_simd_horizontal_op.py
@@ -277,7 +277,7 @@ vtypes_for_instruction_set = {
 guards_for_instruction_sets = {
     InstructionSets.SSE3: "__SSE3__",
     InstructionSets.AVX: "__AVX__",
-    InstructionSets.AVX512: '__AVX512VL__',
+    InstructionSets.AVX512: '__AVX512F__',
     InstructionSets.NEON: '_M_ARM64',
 }