Enable SSE2 on targets where it's supported (#5990)

This commit is contained in:
Anton Angelov 2026-03-04 17:54:18 +02:00 committed by GitHub
parent d1b628b0a6
commit d6f278e1a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -520,12 +520,18 @@ foreach it : ccs
endforeach
# Try to compile a basic SSE2 code snippet to discover if SSE2 is supported for the target arch
sse2_compiler_flag = it_cc.get_id() == 'msvc' ? '/arch:SSE2' : '-msse2'
sse2_code = '''#include <emmintrin.h>
int main (int argc, char *argv[]) { __m128i v = _mm_set_epi32(2, 3, 0, 1); return 0; }
'''
has_sse2 = it_cc.compiles(sse2_code, args : '-msse2', name: 'SSE2 code snippet')
has_sse2 = it_cc.compiles(sse2_code, args : [sse2_compiler_flag], name: 'SSE2 code snippet')
it_userconf.set10('HAVE_SSE2', has_sse2)
# Enable SSE2 compiler support since it may not be enabled by default
if has_sse2 and it_machine.cpu_family() in ['x86', 'x86_64']
add_project_arguments([sse2_compiler_flag], language: 'c', native: it_native)
endif
foreach item : [
['linux/ashmem.h', '', []],
['sys/shm.h', '', []],