make simd instructions optional --- a/meson_options.txt +++ b/meson_options.txt @@ -5,3 +5,7 @@ option('with_lz4', type : 'feature', value : 'auto', description : 'Support LZ4 option('with_zstd', type : 'feature', value : 'auto', description : 'Support ZStandard as a compression mechanism') option('with_vaapi', type : 'feature', value : 'auto', description : 'Link with libva and use VAAPI to perform hardware video output color space conversions on GPU') option('with_systemtap', type: 'boolean', value: true, description: 'Enable tracing using sdt and provide static tracepoints for profiling') +option('with_avx512f', type: 'boolean', value: true, description: 'Enable avx512f SIMD instructions') +option('with_avx2', type: 'boolean', value: true, description: 'Enable avx2 SIMD instructions') +option('with_sse3', type: 'boolean', value: true, description: 'Enable sse3 SIMD instructions') +option('with_neon_opts', type: 'boolean', value: true, description: 'Enable optimizations for ARM64 neon cpus') --- a/src/meson.build +++ b/src/meson.build @@ -25,19 +25,19 @@ endif # Conditionally compile SIMD-optimized code. # (The meson simd module is a bit too limited for this) kernel_libs = [] -if cc.has_argument('-mavx512f') and cc.has_argument('-mlzcnt') and cc.has_argument('-mbmi') +if cc.has_argument('-mavx512f') and cc.has_argument('-mlzcnt') and cc.has_argument('-mbmi') and get_option('with_avx512f') kernel_libs += static_library('kernel_avx512f', 'kernel_avx512f.c', c_args:['-mavx512f', '-mlzcnt', '-mbmi']) config_data.set('HAVE_AVX512F', 1, description: 'Compiler supports AVX-512F') endif -if cc.has_argument('-mavx2') and cc.has_argument('-mlzcnt') and cc.has_argument('-mbmi') +if cc.has_argument('-mavx2') and cc.has_argument('-mlzcnt') and cc.has_argument('-mbmi') and get_option('with_avx2') kernel_libs += static_library('kernel_avx2', 'kernel_avx2.c', c_args:['-mavx2', '-mlzcnt', '-mbmi']) config_data.set('HAVE_AVX2', 1, description: 'Compiler supports AVX2') endif -if cc.has_argument('-msse3') +if cc.has_argument('-msse3') and get_option('with_sse3') kernel_libs += static_library('kernel_sse3', 'kernel_sse3.c', c_args:['-msse3']) config_data.set('HAVE_SSE3', 1, description: 'Compiler supports SSE 3') endif -if host_machine.cpu_family() == 'aarch64' or cc.has_argument('-mfpu=neon') +if ( host_machine.cpu_family() == 'aarch64' or cc.has_argument('-mfpu=neon') ) and get_option('with_neon_opts') neon_args = host_machine.cpu_family() == 'aarch64' ? [] : ['-mfpu=neon'] # Clang additionally enforces that NEON code only be compiled