13
0

Fix AVX512 detection

Older compilers (gcc-6) feature _mm512_fmadd_ps but lack
macro pseudo functions _mm.*_reduce_(min|max)_ps and _mm.*_abs_ps
This commit is contained in:
Robin Gareus 2023-02-05 16:14:49 +01:00
parent 3105dcfbbc
commit 7d2dc35fca
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -521,7 +521,7 @@ int main() { return 0; }''',
if re.search ('x86_64-w64', str(conf.env['CC'])) is not None: if re.search ('x86_64-w64', str(conf.env['CC'])) is not None:
conf.define ('FPU_AVX_FMA_SUPPORT', 1) conf.define ('FPU_AVX_FMA_SUPPORT', 1)
elif conf.env['build_target'] == 'i386' or conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64': elif conf.env['build_target'] == 'i386' or conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
conf.check_cxx(fragment = "#include <immintrin.h>\nint main(void) { __m512 a; _mm512_fmadd_ps(a, a, a); return 0; }\n", conf.check_cxx(fragment = "#include <immintrin.h>\nint main(void) { __m512 a; _mm512_abs_ps(a); _mm512_fmadd_ps(a, a, a); (void) _mm512_reduce_min_ps(a); (void)_mm512_reduce_max_ps(a); return 0; }\n",
features = ['cxx'], features = ['cxx'],
cxxflags = [ conf.env['compiler_flags_dict']['avx512f'], conf.env['compiler_flags_dict']['fma'], conf.env['compiler_flags_dict']['avx'] ], cxxflags = [ conf.env['compiler_flags_dict']['avx512f'], conf.env['compiler_flags_dict']['fma'], conf.env['compiler_flags_dict']['avx'] ],
mandatory = False, mandatory = False,