aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/pkg/highway/src/detect.zig
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
commitdcfe11a7588fcd42471159453810abc9b7720a57 (patch)
treec32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/pkg/highway/src/detect.zig
parent2dfed860103c4e4505ac7f25def9fe37da1e1e6a (diff)
build: update libghostty-vt vendor
vendor ghostty 063ac3e and remove the musl libc++ link workaround. expose the new selection formatter and hyperlink uri apis for follow-up rendering work. add manual artifact validation for static linux builds.
Diffstat (limited to 'vendor/libghostty-vt/pkg/highway/src/detect.zig')
-rw-r--r--vendor/libghostty-vt/pkg/highway/src/detect.zig49
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/pkg/highway/src/detect.zig b/vendor/libghostty-vt/pkg/highway/src/detect.zig
new file mode 100644
index 00000000..471314d9
--- /dev/null
+++ b/vendor/libghostty-vt/pkg/highway/src/detect.zig
@@ -0,0 +1,49 @@
+const builtin = @import("builtin");
+const HwyTargets = @import("targets.zig").Targets;
+
+const x86 = @import("detect/x86.zig");
+const aarch64_darwin = @import("detect/aarch64_darwin.zig");
+const aarch64_linux = @import("detect/aarch64_linux.zig");
+const ppc = @import("detect/ppc.zig");
+const s390x = @import("detect/s390x.zig");
+const riscv = @import("detect/riscv.zig");
+const loongarch = @import("detect/loongarch.zig");
+
+/// Detect Highway targets at runtime using minimal, direct CPU feature
+/// probing.
+///
+/// Previous versions called std.zig.system.resolveTargetQuery which
+/// drags in the full Zig target/CPU model tables for every architecture,
+/// bloating the binary by ~300 KB and causing code-layout regressions in
+/// unrelated hot paths (icache / branch-predictor pressure).
+///
+/// This version uses only inline assembly (CPUID on x86, MRS on AArch64)
+/// and lightweight syscalls (sysctlbyname on Darwin, getauxval on Linux),
+/// so it adds no data tables and no std.Target dependency.
+pub export fn ghostty_hwy_detect_targets() callconv(.c) i64 {
+ return switch (builtin.cpu.arch) {
+ .x86_64, .x86 => x86.detect(),
+ .aarch64, .aarch64_be => detectAarch64(),
+ .powerpc, .powerpc64, .powerpc64le => ppc.detect(),
+ .s390x => s390x.detect(),
+ .riscv32, .riscv64 => riscv.detect(),
+ .loongarch32, .loongarch64 => loongarch.detect(),
+ else => 0,
+ };
+}
+
+fn detectAarch64() i64 {
+ var t: HwyTargets = .{};
+
+ // All AArch64 implementations have NEON.
+ t.neon_without_aes = true;
+
+ if (comptime builtin.os.tag.isDarwin()) {
+ return aarch64_darwin.detect(&t);
+ } else if (comptime builtin.os.tag == .linux) {
+ return aarch64_linux.detect(&t);
+ }
+
+ // Other OS: return baseline NEON.
+ return @bitCast(t);
+}