target: use 16 byte alignment for 128-bit types on x86 and ofmt .c

This commit is contained in:
kcbanner 2023-01-21 13:07:27 -05:00
parent 0d249e558a
commit 4a330ab811
2 changed files with 13 additions and 5 deletions

View File

@ -1821,7 +1821,7 @@ pub const Target = struct {
.wasm64,
=> 8,
.x86 => return switch (target.os.tag) {
.x86 => if (target.ofmt == .c) 16 else return switch (target.os.tag) {
.windows, .uefi => 8,
else => 4,
},

View File

@ -65,9 +65,6 @@ test "alignment and size of structs with 128-bit fields" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
// https://github.com/ziglang/zig/issues/14371
if (builtin.zig_backend == .stage2_c and builtin.target.cpu.arch == .x86) return error.SkipZigTest;
const A = struct {
x: u128,
};
@ -107,7 +104,18 @@ test "alignment and size of structs with 128-bit fields" {
.u129_size = 24,
},
.x86 => switch (builtin.os.tag) {
.x86 => if (builtin.object_format == .c) .{
.a_align = 16,
.a_size = 16,
.b_align = 16,
.b_size = 32,
.u128_align = 16,
.u128_size = 16,
.u129_align = 16,
.u129_size = 32,
} else switch (builtin.os.tag) {
.windows => .{
.a_align = 8,
.a_size = 16,