Skip to content

Commit d6f278e

Browse files
Enable SSE2 on targets where it's supported (#5990)
1 parent d1b628b commit d6f278e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

meson.build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,18 @@ foreach it : ccs
520520
endforeach
521521

522522
# Try to compile a basic SSE2 code snippet to discover if SSE2 is supported for the target arch
523+
sse2_compiler_flag = it_cc.get_id() == 'msvc' ? '/arch:SSE2' : '-msse2'
523524
sse2_code = '''#include <emmintrin.h>
524525
int main (int argc, char *argv[]) { __m128i v = _mm_set_epi32(2, 3, 0, 1); return 0; }
525526
'''
526-
has_sse2 = it_cc.compiles(sse2_code, args : '-msse2', name: 'SSE2 code snippet')
527+
has_sse2 = it_cc.compiles(sse2_code, args : [sse2_compiler_flag], name: 'SSE2 code snippet')
527528
it_userconf.set10('HAVE_SSE2', has_sse2)
528529

530+
# Enable SSE2 compiler support since it may not be enabled by default
531+
if has_sse2 and it_machine.cpu_family() in ['x86', 'x86_64']
532+
add_project_arguments([sse2_compiler_flag], language: 'c', native: it_native)
533+
endif
534+
529535
foreach item : [
530536
['linux/ashmem.h', '', []],
531537
['sys/shm.h', '', []],

0 commit comments

Comments
 (0)