diff --git a/docs/glossary.rst b/docs/glossary.rst index 21f248166..486baadbb 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -231,7 +231,10 @@ 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 +.. envvar:: KITTY_SIMD - Set it to any value to prevent kitty from using SIMD CPU vector - instructions. + Set it to ``128`` to use 128 bit vector registers, ``256`` to use 256 bit + vector registers or any other value to prevent kitty from using SIMD CPU + vector instructions. Warning, this overrides CPU capability detection so + will cause kitty to crash with SIGILL if your CPU does not support the + necessary SIMD extensions. diff --git a/kitty/simd-string.c b/kitty/simd-string.c index 8addb65dd..fa714533a 100644 --- a/kitty/simd-string.c +++ b/kitty/simd-string.c @@ -139,8 +139,10 @@ init_simd(void *x) { do_check(); #endif #endif - if (getenv("KITTY_NO_SIMD")) { - has_avx2 = false; has_sse4_2 = false; + const char *simd_env = getenv("KITTY_SIMD"); + if (simd_env) { + has_sse4_2 = strcmp(simd_env, "128") == 0; + has_avx2 = strcmp(simd_env, "256") == 0; } #undef do_check