infra: revise the vector build script

Note that this change renames the Meson option from 'vector' to 'simd',
separates the NEON types into 'neon-arm' and 'neon-aarch',
and designates the 'mfpu' option solely for 'neon-arm'.
This commit is contained in:
Hermet Park 2024-04-14 10:18:51 +09:00 committed by Hermet Park
parent cc53bce8ab
commit fa4b2cb704
3 changed files with 10 additions and 7 deletions

View file

@ -85,13 +85,16 @@ endif
#Vectorization #Vectorization
simd_type = 'none' simd_type = 'none'
if get_option('vector') == true if get_option('simd') == true
if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64' if host_machine.cpu_family().startswith('x86')
config_h.set10('THORVG_AVX_VECTOR_SUPPORT', true) config_h.set10('THORVG_AVX_VECTOR_SUPPORT', true)
simd_type = 'avx' simd_type = 'avx'
elif host_machine.cpu_family() == 'arm' elif host_machine.cpu_family().startswith('arm')
config_h.set10('THORVG_NEON_VECTOR_SUPPORT', true) config_h.set10('THORVG_NEON_VECTOR_SUPPORT', true)
simd_type = 'neon' simd_type = 'neon-arm'
elif host_machine.cpu().startswith('aarch')
config_h.set10('THORVG_NEON_VECTOR_SUPPORT', true)
simd_type = 'neon-aarch'
endif endif
endif endif

View file

@ -21,7 +21,7 @@ option('threads',
value: true, value: true,
description: 'Enable the multi-threading task scheduler in thorvg') description: 'Enable the multi-threading task scheduler in thorvg')
option('vector', option('simd',
type: 'boolean', type: 'boolean',
value: false, value: false,
description: 'Enable CPU Vectorization(SIMD) in thorvg') description: 'Enable CPU Vectorization(SIMD) in thorvg')

View file

@ -14,7 +14,7 @@ if (cc.get_id() == 'clang-cl')
if simd_type == 'avx' if simd_type == 'avx'
compiler_flags += ['/clang:-mavx'] compiler_flags += ['/clang:-mavx']
endif endif
if simd_type == 'neon' if simd_type == 'neon-arm'
compiler_flags += ['/clang:-mfpu=neon'] compiler_flags += ['/clang:-mfpu=neon']
endif endif
if get_option('b_sanitize') == 'none' if get_option('b_sanitize') == 'none'
@ -26,7 +26,7 @@ elif (cc.get_id() != 'msvc')
if simd_type == 'avx' if simd_type == 'avx'
compiler_flags += ['-mavx'] compiler_flags += ['-mavx']
endif endif
if simd_type == 'neon' if simd_type == 'neon-arm'
compiler_flags += ['-mfpu=neon'] compiler_flags += ['-mfpu=neon']
endif endif
if get_option('b_sanitize') == 'none' if get_option('b_sanitize') == 'none'