Commit a6856ef6d2

Andrew Kelley <andrew@ziglang.org>
2024-04-26 23:07:31
LLVM 18 uses 16 byte alignment for x86_64 i128
1 parent 65bea9a
Changed files (2)
lib
test
behavior
lib/std/Target.zig
@@ -1899,7 +1899,6 @@ pub fn maxIntAlignment(target: Target) u16 {
         // 2. The C ABI wants 16 for extern structs.
         // 3. 16-byte cmpxchg needs 16-byte alignment.
         // Same logic for powerpc64, mips64, sparc64.
-        .x86_64,
         .powerpc64,
         .powerpc64le,
         .mips64,
@@ -1911,6 +1910,7 @@ pub fn maxIntAlignment(target: Target) u16 {
         },
 
         // Even LLVMABIAlignmentOfType(i128) agrees on these targets.
+        .x86_64,
         .aarch64,
         .aarch64_be,
         .aarch64_32,
test/behavior/align.zig
@@ -157,7 +157,6 @@ test "alignment and size of structs with 128-bit fields" {
         .powerpc64,
         .powerpc64le,
         .sparc64,
-        .x86_64,
         => switch (builtin.object_format) {
             .c => .{
                 .a_align = 16,
@@ -193,6 +192,7 @@ test "alignment and size of structs with 128-bit fields" {
         .bpfeb,
         .nvptx,
         .nvptx64,
+        .x86_64,
         => .{
             .a_align = 16,
             .a_size = 16,