authorgravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-04-25 21:49:21+08:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-22 21:15:33+02:00
log8fe6d5a48e97ec1b3260c86832baa707271d0f8b
tree1e330fa699a51ee5dc9ae2bf6985c2123bd0f9e5
parent8b220cd746384c43e8406b70e93f76afe7a6db48
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux: move HWCAP bits to linux.zig

Change-Id: Ic06feeeec9d04b540cf4efc931df4f4b7e327c5f

4 files changed, 47 insertions(+), 65 deletions(-)

lib/std/os/linux.zig+47-1
...@@ -96,7 +96,6 @@ pub fn clone(...@@ -96,7 +96,6 @@ pub fn clone(
96}96}
9797
98pub const ARCH = arch_bits.ARCH;98pub const ARCH = arch_bits.ARCH;
99pub const HWCAP = arch_bits.HWCAP;
100pub const SC = arch_bits.SC;99pub const SC = arch_bits.SC;
101pub const VDSO = arch_bits.VDSO;100pub const VDSO = arch_bits.VDSO;
102pub const user_desc = arch_bits.user_desc;101pub const user_desc = arch_bits.user_desc;
...@@ -524,6 +523,53 @@ pub const O = switch (native_arch) {...@@ -524,6 +523,53 @@ pub const O = switch (native_arch) {
524 else => @compileError("missing std.os.linux.O constants for this architecture"),523 else => @compileError("missing std.os.linux.O constants for this architecture"),
525};524};
526525
526pub const HWCAP = switch (native_arch) {
527 .arm, .armeb, .thumb, .thumbeb => struct {
528 pub const SWP = 1 << 0;
529 pub const HALF = 1 << 1;
530 pub const THUMB = 1 << 2;
531 pub const @"26BIT" = 1 << 3;
532 pub const FAST_MULT = 1 << 4;
533 pub const FPA = 1 << 5;
534 pub const VFP = 1 << 6;
535 pub const EDSP = 1 << 7;
536 pub const JAVA = 1 << 8;
537 pub const IWMMXT = 1 << 9;
538 pub const CRUNCH = 1 << 10;
539 pub const THUMBEE = 1 << 11;
540 pub const NEON = 1 << 12;
541 pub const VFPv3 = 1 << 13;
542 pub const VFPv3D16 = 1 << 14;
543 pub const TLS = 1 << 15;
544 pub const VFPv4 = 1 << 16;
545 pub const IDIVA = 1 << 17;
546 pub const IDIVT = 1 << 18;
547 pub const VFPD32 = 1 << 19;
548 pub const IDIV = IDIVA | IDIVT;
549 pub const LPAE = 1 << 20;
550 pub const EVTSTRM = 1 << 21;
551 },
552 .loongarch32, .loongarch64 => struct {
553 pub const CPUCFG = 1 << 0;
554 pub const LAM = 1 << 1;
555 pub const UAL = 1 << 2;
556 pub const FPU = 1 << 3;
557 pub const LSX = 1 << 4;
558 pub const LASX = 1 << 5;
559 pub const CRC32 = 1 << 6;
560 pub const COMPLEX = 1 << 7;
561 pub const CRYPTO = 1 << 8;
562 pub const LVZ = 1 << 9;
563 pub const LBT_X86 = 1 << 10;
564 pub const LBT_ARM = 1 << 11;
565 pub const LBT_MIPS = 1 << 12;
566 pub const PTW = 1 << 13;
567 pub const LSPW = 1 << 14;
568 pub const SCQ = 1 << 15;
569 },
570 else => struct {},
571};
572
527pub const RENAME = packed struct(u32) {573pub const RENAME = packed struct(u32) {
528 /// Cannot be set together with `EXCHANGE`.574 /// Cannot be set together with `EXCHANGE`.
529 NOREPLACE: bool = false,575 NOREPLACE: bool = false,
lib/std/os/linux/arm.zig-26
...@@ -182,30 +182,4 @@ pub const VDSO = struct {...@@ -182,30 +182,4 @@ pub const VDSO = struct {
182 pub const CGT_VER = "LINUX_2.6";182 pub const CGT_VER = "LINUX_2.6";
183};183};
184184
185pub const HWCAP = struct {
186 pub const SWP = 1 << 0;
187 pub const HALF = 1 << 1;
188 pub const THUMB = 1 << 2;
189 pub const @"26BIT" = 1 << 3;
190 pub const FAST_MULT = 1 << 4;
191 pub const FPA = 1 << 5;
192 pub const VFP = 1 << 6;
193 pub const EDSP = 1 << 7;
194 pub const JAVA = 1 << 8;
195 pub const IWMMXT = 1 << 9;
196 pub const CRUNCH = 1 << 10;
197 pub const THUMBEE = 1 << 11;
198 pub const NEON = 1 << 12;
199 pub const VFPv3 = 1 << 13;
200 pub const VFPv3D16 = 1 << 14;
201 pub const TLS = 1 << 15;
202 pub const VFPv4 = 1 << 16;
203 pub const IDIVA = 1 << 17;
204 pub const IDIVT = 1 << 18;
205 pub const VFPD32 = 1 << 19;
206 pub const IDIV = IDIVA | IDIVT;
207 pub const LPAE = 1 << 20;
208 pub const EVTSTRM = 1 << 21;
209};
210
211pub const time_t = i32;185pub const time_t = i32;
lib/std/os/linux/loongarch32.zig-19
...@@ -161,22 +161,3 @@ pub const VDSO = struct {...@@ -161,22 +161,3 @@ pub const VDSO = struct {
161 pub const CGT_SYM = "__vdso_clock_gettime";161 pub const CGT_SYM = "__vdso_clock_gettime";
162 pub const CGT_VER = "LINUX_5.10";162 pub const CGT_VER = "LINUX_5.10";
163};163};
164
165pub const HWCAP = struct {
166 pub const CPUCFG = 1 << 0;
167 pub const LAM = 1 << 1;
168 pub const UAL = 1 << 2;
169 pub const FPU = 1 << 3;
170 pub const LSX = 1 << 4;
171 pub const LASX = 1 << 5;
172 pub const CRC32 = 1 << 6;
173 pub const COMPLEX = 1 << 7;
174 pub const CRYPTO = 1 << 8;
175 pub const LVZ = 1 << 9;
176 pub const LBT_X86 = 1 << 10;
177 pub const LBT_ARM = 1 << 11;
178 pub const LBT_MIPS = 1 << 12;
179 pub const PTW = 1 << 13;
180 pub const LSPW = 1 << 14;
181 pub const SCQ = 1 << 15;
182};
lib/std/os/linux/loongarch64.zig-19
...@@ -160,22 +160,3 @@ pub const VDSO = struct {...@@ -160,22 +160,3 @@ pub const VDSO = struct {
160 pub const CGT_SYM = "__vdso_clock_gettime";160 pub const CGT_SYM = "__vdso_clock_gettime";
161 pub const CGT_VER = "LINUX_5.10";161 pub const CGT_VER = "LINUX_5.10";
162};162};
163
164pub const HWCAP = struct {
165 pub const CPUCFG = 1 << 0;
166 pub const LAM = 1 << 1;
167 pub const UAL = 1 << 2;
168 pub const FPU = 1 << 3;
169 pub const LSX = 1 << 4;
170 pub const LASX = 1 << 5;
171 pub const CRC32 = 1 << 6;
172 pub const COMPLEX = 1 << 7;
173 pub const CRYPTO = 1 << 8;
174 pub const LVZ = 1 << 9;
175 pub const LBT_X86 = 1 << 10;
176 pub const LBT_ARM = 1 << 11;
177 pub const LBT_MIPS = 1 << 12;
178 pub const PTW = 1 << 13;
179 pub const LSPW = 1 << 14;
180 pub const SCQ = 1 << 15;
181};