diff --git a/CMakeLists.txt b/CMakeLists.txt
index 63fdcfc..2a71546 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,10 +5,15 @@ include(CheckCXXCompilerFlag)
 set(CMAKE_CXX_STANDARD 17)
 option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
 option(USE_CLANG "Build with clang instead of gcc" ON)
+option(WITH_AVX512 "Enable AVX512" OFF)
 set(DEFAULT_TEST_FUNCTION_NAME "native_reordered" CACHE STRING "default function to run")
 
 add_compile_definitions(DEFAULT_TEST_FUNCTION_NAME="${DEFAULT_TEST_FUNCTION_NAME}")
 
+if(WITH_AVX512)
+    add_compile_definitions(WITH_AVX512)
+endif()
+
 if(USE_CLANG)
     set(CMAKE_CXX_COMPILER "clang++")
 else()
diff --git a/scripts/test.py b/scripts/test.py
index f5b4d34..40b59f0 100755
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -21,12 +21,13 @@ def check_call_quiet(*args, **kwargs):
         exit(0)
 
 
-def compile_and_run(source_path, build_path_prefix, target, native, use_clang, args):
+def compile_and_run(source_path, build_path_prefix, target, native, use_clang, avx512, args):
     flags = [
         "-DOPTIMIZE_FOR_NATIVE=" + ("ON" if native else "OFF"),
         "-DCMAKE_BUILD_TYPE=RelWithDebInfo",
         "-DUSE_CLANG=" + ("ON" if use_clang else "OFF"),
-        "-DNDEBUG=ON", "-DBOOST_UBLAS_NDEBUG=ON"
+        "-DNDEBUG=ON", "-DBOOST_UBLAS_NDEBUG=ON",
+        "-DWITH_AVX512=" + ("ON" if avx512 else "OFF"),
     ]
     build_path = os.path.join(build_path_prefix, " ".join(flags))
     if not os.path.exists(build_path):
@@ -103,13 +104,13 @@ if __name__ == '__main__':
     for clang in [True]:
         for sizes in matrix_combinations:
             args = list(sizes)
-            compile_and_run("..", "builds", "generate_random", True, True, args)
+            compile_and_run("..", "builds", "generate_random", True, True, options.avx512, args)
             folder = "x".join(sizes)
             for fidx, function in enumerate(functions):
                 arguments = [folder, "--algorithm", function]
                 if with_double:
                     arguments.append("--double")
-                output = compile_and_run("..", "builds", "simd_multiply", True, clang, arguments + extra_args)
+                output = compile_and_run("..", "builds", "simd_multiply", True, clang, options.avx512, arguments + extra_args)
                 ms = output.decode()[output.decode().find("multiply:") + 10:]
                 if "ms\n" in ms:
                     ms = float(ms.split("ms\n")[0])