Skip to content

Commit

Permalink
meson: add avx option
Browse files Browse the repository at this point in the history
  • Loading branch information
robUx4 committed Nov 22, 2024
1 parent 1a12715 commit e91fc66
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions buildsystem/simd_checks/meson.build
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 <immintrin.h>
#include <stdint.h>
uint64_t frobzor;
Expand All @@ -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");
Expand All @@ -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");
Expand Down
6 changes: 5 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e91fc66

Please sign in to comment.