aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/align.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-08-18 20:34:36 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-08-18 20:34:36 -0700
commitcee82c7ce4fb8beb39042f9dba16a1a391803fa4 (patch)
treeea2a12b10b3742acc3f343a36bf14a8c34246776 /test/behavior/align.zig
parentb975f7a56fec9e0e7aca9832282bc772c743d731 (diff)
downloadzig-cee82c7ce4fb8beb39042f9dba16a1a391803fa4.tar.gz
zig-cee82c7ce4fb8beb39042f9dba16a1a391803fa4.zip
improved ABI alignment/size for >= 128-bit integers
* riscv64: adjust alignment and size of 128-bit integers. * take ofmt=c into account for ABI alignment of 128-bit integers and structs. * Type: make packed struct support intInfo * fix f80 alignment for i386-windows-msvc
Diffstat (limited to 'test/behavior/align.zig')
-rw-r--r--test/behavior/align.zig46
1 files changed, 30 insertions, 16 deletions
diff --git a/test/behavior/align.zig b/test/behavior/align.zig
index 4a824bc9cf..ad857fb9c2 100644
--- a/test/behavior/align.zig
+++ b/test/behavior/align.zig
@@ -100,8 +100,8 @@ test "alignment and size of structs with 128-bit fields" {
.a_align = 8,
.a_size = 16,
- .b_align = 8,
- .b_size = 24,
+ .b_align = 16,
+ .b_size = 32,
.u128_align = 8,
.u128_size = 16,
@@ -114,8 +114,8 @@ test "alignment and size of structs with 128-bit fields" {
.a_align = 8,
.a_size = 16,
- .b_align = 8,
- .b_size = 24,
+ .b_align = 16,
+ .b_size = 32,
.u128_align = 8,
.u128_size = 16,
@@ -126,8 +126,8 @@ test "alignment and size of structs with 128-bit fields" {
.a_align = 4,
.a_size = 16,
- .b_align = 4,
- .b_size = 20,
+ .b_align = 16,
+ .b_size = 32,
.u128_align = 4,
.u128_size = 16,
@@ -140,25 +140,39 @@ test "alignment and size of structs with 128-bit fields" {
.mips64el,
.powerpc64,
.powerpc64le,
- .riscv64,
.sparc64,
.x86_64,
- => .{
- .a_align = 8,
- .a_size = 16,
+ => switch (builtin.object_format) {
+ .c => .{
+ .a_align = 16,
+ .a_size = 16,
- .b_align = 16,
- .b_size = 32,
+ .b_align = 16,
+ .b_size = 32,
- .u128_align = 8,
- .u128_size = 16,
- .u129_align = 8,
- .u129_size = 24,
+ .u128_align = 16,
+ .u128_size = 16,
+ .u129_align = 16,
+ .u129_size = 32,
+ },
+ else => .{
+ .a_align = 8,
+ .a_size = 16,
+
+ .b_align = 16,
+ .b_size = 32,
+
+ .u128_align = 8,
+ .u128_size = 16,
+ .u129_align = 8,
+ .u129_size = 24,
+ },
},
.aarch64,
.aarch64_be,
.aarch64_32,
+ .riscv64,
.bpfel,
.bpfeb,
.nvptx,