From 23a4012aeb25b1bf19da9ad393fccf3e1e531b5c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 21 Jan 2024 15:19:40 +0530 Subject: [PATCH] Add an env var to turn off use of SIMD instructions --- docs/glossary.rst | 5 +++++ kitty/simd-string.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/docs/glossary.rst b/docs/glossary.rst index 77437b696..21f248166 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -230,3 +230,8 @@ Variables that kitty sets when running child programs Set to ``1`` when kitty is running a shell because of the ``--hold`` flag. Can be used to specialize shell behavior in the shell rc files as desired. + +.. envvar:: KITTY_NO_SIMD + + Set it to any value to prevent kitty from using SIMD CPU vector + instructions. diff --git a/kitty/simd-string.c b/kitty/simd-string.c index 9c5135f45..8fc717099 100644 --- a/kitty/simd-string.c +++ b/kitty/simd-string.c @@ -143,6 +143,9 @@ init_simd(void *x) { do_check(); #endif #endif + if (getenv("KITTY_NO_SIMD")) { + has_avx2 = false; has_sse4_2 = false; + } #undef do_check if (has_avx2) {