| author | |
| committer | |
| log | a3ae499dc29747630f2801aab9bbc9661a4a0169 |
| tree | b84a1c148ffc831bab6129f5a590d097cc169ef4 |
| parent | 94b69bc99fbe348a04c223eac6590e6ce5a2779c |
| parent | daf3cca1a491636dcd2cde45b12bc3bfcfbab69c |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/357803 files changed, 23 insertions(+), 10 deletions(-)
lib/std/lang.zig+7-7| ... | ... | @@ -1000,10 +1000,9 @@ pub const VaListArm = extern struct { |
| 1000 | 1000 | /// This data structure is used by the Zig language code generation and |
| 1001 | 1001 | /// therefore must be kept in sync with the compiler implementation. |
| 1002 | 1002 | pub const VaListHexagon = extern struct { |
| 1003 | __gpr: c_long, | |
| 1004 | __fpr: c_long, | |
| 1005 | __overflow_arg_area: *anyopaque, | |
| 1006 | __reg_save_area: *anyopaque, | |
| 1003 | __current_saved_reg_area_pointer: *anyopaque, | |
| 1004 | __saved_reg_area_end_pointer: *anyopaque, | |
| 1005 | __overflow_area_pointer: *anyopaque, | |
| 1007 | 1006 | }; |
| 1008 | 1007 | |
| 1009 | 1008 | /// This data structure is used by the Zig language code generation and |
| ... | ... | @@ -1019,9 +1018,10 @@ pub const VaListPowerPc = extern struct { |
| 1019 | 1018 | /// This data structure is used by the Zig language code generation and |
| 1020 | 1019 | /// therefore must be kept in sync with the compiler implementation. |
| 1021 | 1020 | pub const VaListS390x = extern struct { |
| 1022 | __current_saved_reg_area_pointer: *anyopaque, | |
| 1023 | __saved_reg_area_end_pointer: *anyopaque, | |
| 1024 | __overflow_area_pointer: *anyopaque, | |
| 1021 | __gpr: c_long, | |
| 1022 | __fpr: c_long, | |
| 1023 | __overflow_arg_area: *anyopaque, | |
| 1024 | __reg_save_area: *anyopaque, | |
| 1025 | 1025 | }; |
| 1026 | 1026 | |
| 1027 | 1027 | /// This data structure is used by the Zig language code generation and |
src/Type.zig+1-1| ... | ... | @@ -2521,7 +2521,7 @@ pub fn defaultStructFieldAlignment( |
| 2521 | 2521 | ((field_ty.isAbiInt(zcu) and field_ty.intInfo(zcu).bits > 64) or |
| 2522 | 2522 | (field_ty.toIntern() == .f80_type and zcu.getTarget().cTypeBitSize(.longdouble) != 80))) |
| 2523 | 2523 | { |
| 2524 | return abi_align.maxStrict(.@"16"); | |
| 2524 | return abi_align.maxStrict(if (zcu.getTarget().cpu.arch == .s390x) .@"8" else .@"16"); | |
| 2525 | 2525 | } |
| 2526 | 2526 | return abi_align; |
| 2527 | 2527 | } |
test/behavior/align.zig+15-2| ... | ... | @@ -133,6 +133,20 @@ test "alignment and size of structs with 128-bit fields" { |
| 133 | 133 | y: u8, |
| 134 | 134 | }; |
| 135 | 135 | const expected = switch (builtin.cpu.arch) { |
| 136 | .s390x, | |
| 137 | => .{ | |
| 138 | .a_align = 8, | |
| 139 | .a_size = 16, | |
| 140 | ||
| 141 | .b_align = 8, | |
| 142 | .b_size = 24, | |
| 143 | ||
| 144 | .u128_align = 8, | |
| 145 | .u128_size = 16, | |
| 146 | .u129_align = 8, | |
| 147 | .u129_size = 24, | |
| 148 | }, | |
| 149 | ||
| 136 | 150 | .amdgcn, |
| 137 | 151 | .arm, |
| 138 | 152 | .armeb, |
| ... | ... | @@ -145,7 +159,6 @@ test "alignment and size of structs with 128-bit fields" { |
| 145 | 159 | .powerpc, |
| 146 | 160 | .powerpcle, |
| 147 | 161 | .riscv32, |
| 148 | .s390x, | |
| 149 | 162 | => .{ |
| 150 | 163 | .a_align = 8, |
| 151 | 164 | .a_size = 16, |
| ... | ... | @@ -191,7 +204,7 @@ test "alignment and size of structs with 128-bit fields" { |
| 191 | 204 | |
| 192 | 205 | else => return error.SkipZigTest, |
| 193 | 206 | }; |
| 194 | const min_struct_align = if (builtin.zig_backend == .stage2_c) 16 else 0; | |
| 207 | const min_struct_align = if (builtin.zig_backend == .stage2_c) if (builtin.cpu.arch == .s390x) 8 else 16 else 0; | |
| 195 | 208 | comptime { |
| 196 | 209 | assert(@alignOf(A) == @max(expected.a_align, min_struct_align)); |
| 197 | 210 | assert(@sizeOf(A) == expected.a_size); |