Commit dda05b29c0

Alex Rønne Petersen <alex@alexrp.com>
2025-10-19 23:14:49
std.Target: fix cMaxIntAlignment() for a few architectures
1 parent 45b80f2
Changed files (1)
lib
lib/std/Target.zig
@@ -3377,32 +3377,40 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
 
         .msp430 => 2,
 
-        .xcore,
+        .arc,
+        .csky,
+        .kalimba,
+        .or1k,
         .propeller,
+        .xcore,
         => 4,
 
-        .amdgcn,
         .arm,
         .armeb,
-        .thumb,
-        .thumbeb,
-        .lanai,
         .hexagon,
+        .lanai,
+        .loongarch32,
+        .m68k,
         .mips,
         .mipsel,
-        .or1k,
         .powerpc,
         .powerpcle,
         .riscv32,
         .riscv32be,
         .s390x,
+        .sparc,
+        .thumb,
+        .thumbeb,
+        .x86,
+        .xtensa,
         => 8,
 
-        // Even LLVMABIAlignmentOfType(i128) agrees on these targets.
         .aarch64,
         .aarch64_be,
+        .amdgcn,
         .bpfel,
         .bpfeb,
+        .loongarch64,
         .mips64,
         .mips64el,
         .nvptx,
@@ -3411,26 +3419,13 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
         .powerpc64le,
         .riscv64,
         .riscv64be,
-        .sparc,
         .sparc64,
-        .wasm32,
-        .wasm64,
-        .x86,
-        .x86_64,
-        => 16,
-
-        // Below this comment are unverified but based on the fact that C requires
-        // int128_t to be 16 bytes aligned, it's a safe default.
-        .arc,
-        .csky,
-        .kalimba,
-        .loongarch32,
-        .loongarch64,
-        .m68k,
         .spirv32,
         .spirv64,
         .ve,
-        .xtensa,
+        .wasm32,
+        .wasm64,
+        .x86_64,
         => 16,
     };
 }