diff --git a/buildsystem/simd_checks/meson.build b/buildsystem/simd_checks/meson.build index 93fc7aa649..16c5d42ee6 100644 --- a/buildsystem/simd_checks/meson.build +++ b/buildsystem/simd_checks/meson.build @@ -1,8 +1,10 @@ # SIMD checks enable_sse = false +enable_avx = false if host_machine.cpu_family().startswith('x86') enable_sse = get_option('sse').allowed() + enable_avx = get_option('avx').allowed() endif # Check for fully workin SSE2 intrinsics @@ -99,7 +101,7 @@ endif have_sse4A = can_compile_sse4A # Check for fully workin AVX2 intrinsics -have_avx2_intrinsics = cc.compiles(''' +have_avx2_intrinsics = enable_avx and cc.compiles(''' #include #include uint64_t frobzor; @@ -121,7 +123,7 @@ if have_avx2_intrinsics endif # Check for AVX inline assembly support -can_compile_avx = cc.compiles(''' +can_compile_avx = enable_avx and cc.compiles(''' void f() { void *p; asm volatile("vxorps %%ymm1,%%ymm2,%%ymm3"::"r"(p):"ymm1", "ymm2", "ymm3"); @@ -133,7 +135,7 @@ endif have_avx = can_compile_avx # Check for AVX2 inline assembly support -can_compile_avx2 = cc.compiles(''' +can_compile_avx2 = enable_avx and cc.compiles(''' void f() { void *p; asm volatile("vpunpckhqdq %%ymm1,%%ymm2,%%ymm3"::"r"(p):"ymm1", "ymm2", "ymm3"); diff --git a/meson_options.txt b/meson_options.txt index eadee62f92..b455ca2804 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -85,7 +85,11 @@ option('sse', value : 'auto', description : 'SSE (2-4) optimizations') -# TODO: Missing avx option +option('avx', + type : 'feature', + value : 'auto', + description : 'AVX (1-2) optimizations') + # TODO: Missing neon option # TODO: Missing sve option # TODO: Missing altivec option