diff options
Diffstat (limited to 'vendor/libghostty-vt/pkg/highway/src/detect/riscv.zig')
| -rw-r--r-- | vendor/libghostty-vt/pkg/highway/src/detect/riscv.zig | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/pkg/highway/src/detect/riscv.zig b/vendor/libghostty-vt/pkg/highway/src/detect/riscv.zig new file mode 100644 index 00000000..619d12fa --- /dev/null +++ b/vendor/libghostty-vt/pkg/highway/src/detect/riscv.zig @@ -0,0 +1,22 @@ +const builtin = @import("builtin"); +const HwyTargets = @import("../targets.zig").Targets; +const linux = @import("linux.zig"); + +pub fn detect() i64 { + var t: HwyTargets = .{}; + + if (comptime builtin.os.tag != .linux) return @bitCast(t); + + const AT_HWCAP: usize = 16; + const hwcap = linux.getauxval(AT_HWCAP); + + // ISA extension bit for 'V' (vector). + // Letter-based bits: bit position = letter - 'A'. + const HWCAP_V: usize = 1 << ('V' - 'A'); + + if (hwcap & HWCAP_V != 0) { + t.rvv = true; + } + + return @bitCast(t); +} |
