This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository terminology.
View the commit online.
commit c7bf3aa1181f63a836fae48ce2afc2b604c19669
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Aug 3 13:27:46 2026 -0600
simd: add the kernel scaffolding and the runtime kill-switch
The intake path asks the same two questions constantly -- where does this run of
plain printable ASCII end, and widen it -- and both are trivially vectorisable.
Add src/bin/simd/ to hold those kernels, starting with the parts that are not a
kernel: whether a vector form exists at all, and how to turn it off.
Advanced SIMD is mandatory in ARMv8-A, so TERMINOLOGY_HAVE_NEON is a
compile-time test on __aarch64__ with no runtime probe. A probe would only
confirm what the architecture already guarantees.
TERMINOLOGY_SIMD_DISABLE mirrors EFL's EVAS_NEON_DISABLE: it turns the vector
paths off without a rebuild, which makes a suspected difference bisectable in
the field. simd_init() reads it, and runs from termpty_init(),
tytest_common_init(), and tytest's main() before the argument loop -- the
unit-test path returns out of that loop without ever reaching
tytest_common_init(), and several of those tests drive the real parser.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
src/bin/meson.build | 7 +++++++
src/bin/simd/simd.c | 29 +++++++++++++++++++++++++++++
src/bin/simd/simd.h | 22 ++++++++++++++++++++++
src/bin/termpty.c | 3 +++
src/bin/tytest.c | 7 +++++++
src/bin/tytest_common.c | 2 ++
6 files changed, 70 insertions(+)
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 0972c6d7..718882dc 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -1,3 +1,6 @@
+simd_sources = ['simd/simd.c',
+ 'simd/simd.h']
+
terminology_sources = ['private.h',
'about.c', 'about.h',
'colors.c', 'colors.h',
@@ -34,6 +37,7 @@ terminology_sources = ['private.h',
'md5.c', 'md5.h',
'utils.c', 'utils.h',
'utf8.c', 'utf8.h',
+ simd_sources,
'win.c', 'win.h',
'theme.c', 'theme.h',
'extns.c', 'extns.h',
@@ -63,6 +67,7 @@ tyfuzz_sources = ['termptyesc.c', 'termptyesc.h',
'theme.h',
'utils.c', 'utils.h',
'utf8.c', 'utf8.h',
+ simd_sources,
'tytest_common.c', 'tytest_common.h',
'tyfuzz.c']
tytest_sources = ['termptyesc.c', 'termptyesc.h',
@@ -79,6 +84,7 @@ tytest_sources = ['termptyesc.c', 'termptyesc.h',
'extns.c', 'extns.h',
'sb.c', 'sb.h',
'utf8.c', 'utf8.h',
+ simd_sources,
'utils.c', 'utils.h',
'theme.h',
'md5.c', 'md5.h',
@@ -100,6 +106,7 @@ tybench_sources = ['termptyesc.c', 'termptyesc.h',
'theme.h',
'utils.c', 'utils.h',
'utf8.c', 'utf8.h',
+ simd_sources,
'tytest_common.c', 'tytest_common.h',
'tybench.c']
diff --git a/src/bin/simd/simd.c b/src/bin/simd/simd.c
new file mode 100644
index 00000000..a8b48335
--- /dev/null
+++ b/src/bin/simd/simd.c
@@ -0,0 +1,29 @@
+/* Kernel selection and the runtime kill-switch. */
+#include "private.h"
+#include "simd.h"
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(TERMINOLOGY_HAVE_NEON)
+static Eina_Bool _use_simd = EINA_TRUE;
+#else
+static Eina_Bool _use_simd = EINA_FALSE;
+#endif
+
+void
+simd_init(void)
+{
+#if defined(TERMINOLOGY_HAVE_NEON)
+ const char *s = getenv("TERMINOLOGY_SIMD_DISABLE");
+
+ /* Any non-empty value other than "0" disables. */
+ if (s && s[0] && strcmp(s, "0") != 0)
+ _use_simd = EINA_FALSE;
+#endif
+}
+
+Eina_Bool
+simd_enabled(void)
+{
+ return _use_simd;
+}
diff --git a/src/bin/simd/simd.h b/src/bin/simd/simd.h
new file mode 100644
index 00000000..8d43d335
--- /dev/null
+++ b/src/bin/simd/simd.h
@@ -0,0 +1,22 @@
+#ifndef TERMINOLOGY_SIMD_H_
+#define TERMINOLOGY_SIMD_H_ 1
+
+#include <Eina.h>
+#include <stddef.h>
+
+/* Scanning kernels for the pty intake path. Each has a scalar form and, where
+ * the architecture provides one, a vector form; both are exported so the
+ * parity test can compare them directly. */
+
+/* Advanced SIMD is mandatory in ARMv8-A, so no runtime probe is needed. */
+#if defined(__aarch64__) && !defined(__ARM_BIG_ENDIAN)
+# define TERMINOLOGY_HAVE_NEON 1
+#endif
+
+/* Read TERMINOLOGY_SIMD_DISABLE, which switches the vector kernels off without
+ * a rebuild. Modelled on EFL's EVAS_NEON_DISABLE. */
+void simd_init(void);
+
+Eina_Bool simd_enabled(void);
+
+#endif
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index f07acd80..259db2ff 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -8,6 +8,7 @@
#include "termptyops.h"
#include "backlog.h"
#include "utf8.h"
+#include "simd/simd.h"
#include "keyin.h"
#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
# include "win.h"
@@ -47,6 +48,8 @@ int _termpty_log_dom = -1;
void
termpty_init(void)
{
+ simd_init();
+
if (_termpty_log_dom >= 0) return;
_termpty_log_dom = eina_log_domain_register("termpty", NULL);
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index dd99b46c..15c9eda6 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -15,6 +15,7 @@
#include "termptyops.h"
#include "backlog.h"
#include "utf8.h"
+#include "simd/simd.h"
#include "termiointernals.h"
#include "tytest.h"
#include "unit_tests.h"
@@ -425,6 +426,12 @@ main(int argc, char **argv)
int chunk = 0;
int i;
+ /* Before the argument loop: the unit-test path returns out of it without
+ * ever reaching tytest_common_init(), and several of those tests drive the
+ * real parser. Leaving the kernels un-dispatched there would make
+ * TERMINOLOGY_SIMD_DISABLE silently ineffective for 'tytest all'. */
+ simd_init();
+
for (i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help"))
diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c
index 14edbe93..67cc7f3e 100644
--- a/src/bin/tytest_common.c
+++ b/src/bin/tytest_common.c
@@ -12,6 +12,7 @@
#include "termptyops.h"
#include "termiointernals.h"
#include "utf8.h"
+#include "simd/simd.h"
#include "tytest_common.h"
#if defined(BINARY_TYTEST)
#include "colors.h"
@@ -589,6 +590,7 @@ tytest_common_main_loop(void)
void
tytest_common_init(void)
{
+ simd_init();
_config = config_new();
_sd.config = _config;
_termpty_init(&_ty, _config);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.