diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index 8e6ec0dec4bb2f60a8340835dc367ffae5f74eed..0df906340ef804685e6bca37df379b1fddb8ec4d 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -96,7 +96,6 @@ pub fn clone( } pub const ARCH = arch_bits.ARCH; -pub const HWCAP = arch_bits.HWCAP; pub const SC = arch_bits.SC; pub const VDSO = arch_bits.VDSO; pub const user_desc = arch_bits.user_desc; @@ -524,6 +523,53 @@ pub const O = switch (native_arch) { else => @compileError("missing std.os.linux.O constants for this architecture"), }; +pub const HWCAP = switch (native_arch) { + .arm, .armeb, .thumb, .thumbeb => struct { + pub const SWP = 1 << 0; + pub const HALF = 1 << 1; + pub const THUMB = 1 << 2; + pub const @"26BIT" = 1 << 3; + pub const FAST_MULT = 1 << 4; + pub const FPA = 1 << 5; + pub const VFP = 1 << 6; + pub const EDSP = 1 << 7; + pub const JAVA = 1 << 8; + pub const IWMMXT = 1 << 9; + pub const CRUNCH = 1 << 10; + pub const THUMBEE = 1 << 11; + pub const NEON = 1 << 12; + pub const VFPv3 = 1 << 13; + pub const VFPv3D16 = 1 << 14; + pub const TLS = 1 << 15; + pub const VFPv4 = 1 << 16; + pub const IDIVA = 1 << 17; + pub const IDIVT = 1 << 18; + pub const VFPD32 = 1 << 19; + pub const IDIV = IDIVA | IDIVT; + pub const LPAE = 1 << 20; + pub const EVTSTRM = 1 << 21; + }, + .loongarch32, .loongarch64 => struct { + pub const CPUCFG = 1 << 0; + pub const LAM = 1 << 1; + pub const UAL = 1 << 2; + pub const FPU = 1 << 3; + pub const LSX = 1 << 4; + pub const LASX = 1 << 5; + pub const CRC32 = 1 << 6; + pub const COMPLEX = 1 << 7; + pub const CRYPTO = 1 << 8; + pub const LVZ = 1 << 9; + pub const LBT_X86 = 1 << 10; + pub const LBT_ARM = 1 << 11; + pub const LBT_MIPS = 1 << 12; + pub const PTW = 1 << 13; + pub const LSPW = 1 << 14; + pub const SCQ = 1 << 15; + }, + else => struct {}, +}; + pub const RENAME = packed struct(u32) { /// Cannot be set together with `EXCHANGE`. NOREPLACE: bool = false, diff --git a/lib/std/os/linux/arm.zig b/lib/std/os/linux/arm.zig index 87e3b48b3726a3fd225ffd6745b72492597037c4..c40f2f4031393630d9b8d42213c3ddcf55673f6a 100644 --- a/lib/std/os/linux/arm.zig +++ b/lib/std/os/linux/arm.zig @@ -182,30 +182,4 @@ pub const VDSO = struct { pub const CGT_VER = "LINUX_2.6"; }; -pub const HWCAP = struct { - pub const SWP = 1 << 0; - pub const HALF = 1 << 1; - pub const THUMB = 1 << 2; - pub const @"26BIT" = 1 << 3; - pub const FAST_MULT = 1 << 4; - pub const FPA = 1 << 5; - pub const VFP = 1 << 6; - pub const EDSP = 1 << 7; - pub const JAVA = 1 << 8; - pub const IWMMXT = 1 << 9; - pub const CRUNCH = 1 << 10; - pub const THUMBEE = 1 << 11; - pub const NEON = 1 << 12; - pub const VFPv3 = 1 << 13; - pub const VFPv3D16 = 1 << 14; - pub const TLS = 1 << 15; - pub const VFPv4 = 1 << 16; - pub const IDIVA = 1 << 17; - pub const IDIVT = 1 << 18; - pub const VFPD32 = 1 << 19; - pub const IDIV = IDIVA | IDIVT; - pub const LPAE = 1 << 20; - pub const EVTSTRM = 1 << 21; -}; - pub const time_t = i32; diff --git a/lib/std/os/linux/loongarch32.zig b/lib/std/os/linux/loongarch32.zig index 0be8dc5465eaf01142c974b3a0d51faef2659b49..c5d1589aa3df476dbb638ae7dce6bb28a3e3bd39 100644 --- a/lib/std/os/linux/loongarch32.zig +++ b/lib/std/os/linux/loongarch32.zig @@ -161,22 +161,3 @@ pub const VDSO = struct { pub const CGT_SYM = "__vdso_clock_gettime"; pub const CGT_VER = "LINUX_5.10"; }; - -pub const HWCAP = struct { - pub const CPUCFG = 1 << 0; - pub const LAM = 1 << 1; - pub const UAL = 1 << 2; - pub const FPU = 1 << 3; - pub const LSX = 1 << 4; - pub const LASX = 1 << 5; - pub const CRC32 = 1 << 6; - pub const COMPLEX = 1 << 7; - pub const CRYPTO = 1 << 8; - pub const LVZ = 1 << 9; - pub const LBT_X86 = 1 << 10; - pub const LBT_ARM = 1 << 11; - pub const LBT_MIPS = 1 << 12; - pub const PTW = 1 << 13; - pub const LSPW = 1 << 14; - pub const SCQ = 1 << 15; -}; diff --git a/lib/std/os/linux/loongarch64.zig b/lib/std/os/linux/loongarch64.zig index 08d2c486ee027dc1f92e1a9c79099ae4f446471b..283a4de13484c7489bca7a48d3714ae5136291f4 100644 --- a/lib/std/os/linux/loongarch64.zig +++ b/lib/std/os/linux/loongarch64.zig @@ -160,22 +160,3 @@ pub const VDSO = struct { pub const CGT_SYM = "__vdso_clock_gettime"; pub const CGT_VER = "LINUX_5.10"; }; - -pub const HWCAP = struct { - pub const CPUCFG = 1 << 0; - pub const LAM = 1 << 1; - pub const UAL = 1 << 2; - pub const FPU = 1 << 3; - pub const LSX = 1 << 4; - pub const LASX = 1 << 5; - pub const CRC32 = 1 << 6; - pub const COMPLEX = 1 << 7; - pub const CRYPTO = 1 << 8; - pub const LVZ = 1 << 9; - pub const LBT_X86 = 1 << 10; - pub const LBT_ARM = 1 << 11; - pub const LBT_MIPS = 1 << 12; - pub const PTW = 1 << 13; - pub const LSPW = 1 << 14; - pub const SCQ = 1 << 15; -};