From 55c909c656f54f05966d156ce4e3056b8966ce4e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Feb 2024 22:18:08 +0530 Subject: [PATCH] Use -mtune=intel for SIMD files when building without native optimizations --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cd8db52c6..3a4d7c3d1 100755 --- a/setup.py +++ b/setup.py @@ -708,15 +708,19 @@ def get_source_specific_defines(env: Env, src: str) -> Tuple[str, List[str], Opt def get_source_specific_cflags(env: Env, src: str) -> List[str]: ans = list(env.cflags) - # SIMD specific flags, ignored for native optimizations as they give slightly better performance + # SIMD specific flags if src in ('kitty/simd-string-128.c', 'kitty/simd-string-256.c'): if env.binary_arch.isa in (ISA.AMD64, ISA.X86): ans.append('-msse4.2' if '128' in src else '-mavx2') + if not env.native_optimizations: + ans.append('-mtune=intel') elif env.binary_arch.isa != ISA.ARM64: ans.append('-DKITTY_NO_SIMD') elif src.startswith('3rdparty/base64/lib/arch/'): if env.binary_arch.isa in (ISA.AMD64, ISA.X86): q = src.split(os.path.sep) + if not env.native_optimizations: + ans.append('-mtune=intel') if 'sse3' in q: ans.append('-msse3') elif 'sse41' in q: