From e91fc669f26b0a38af88ea3209310c3449ed7d9f Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Tue, 19 Nov 2024 07:37:38 +0100 Subject: [PATCH] meson: add avx option --- buildsystem/simd_checks/meson.build | 8 +++++--- meson_options.txt | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/buildsystem/simd_checks/meson.build b/buildsystem/simd_checks/meson.build index 93fc7aa64988..16c5d42ee672 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 eadee62f9297..b455ca280488 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