From 29a574a4bc218653a449b548c0e29b02091b826b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 12 Feb 2024 13:47:24 +0530 Subject: [PATCH] Prevent duplicate VZEROUPPER instructions --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index de077b304..3754add48 100755 --- a/setup.py +++ b/setup.py @@ -712,6 +712,13 @@ def get_source_specific_cflags(env: Env, src: str) -> List[str]: 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 '256' in src: + # We have manual vzeroupper so prevent compiler from emitting it causing duplicates + if is_gcc(env.cc): + ans.append('-mno-vzeroupper') + else: + ans.append('-mllvm') + ans.append('-x86-use-vzeroupper=0') elif env.binary_arch.isa != ISA.ARM64: ans.append('-DKITTY_NO_SIMD') elif src.startswith('3rdparty/base64/lib/arch/'):