diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-03 13:33:09 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-03 13:33:09 -0700 |
| commit | b6981686649ab74b91ebb27bec8a29658b3d3923 (patch) | |
| tree | 810f4e48b4e4612a110ef0d31f89eda9bf9ad4b8 /src/type.zig | |
| parent | 15f111a085dcd2da7b91da8e29b89def24cb3c6a (diff) | |
| download | zig-b6981686649ab74b91ebb27bec8a29658b3d3923.tar.gz zig-b6981686649ab74b91ebb27bec8a29658b3d3923.zip | |
stage2: update vector alignment logic
This follows LLVM14's lead on vector alignment, which computes byte
count based on the length premultiplied by bits.
This commit also disables behavior tests regressed by LLVM 14, only for
stage1. stage2 fortunately does not trip the regression.
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/type.zig b/src/type.zig index 55466efe4a..75a19d6330 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2909,8 +2909,8 @@ pub const Type = extern union { .vector => { const len = ty.arrayLen(); const bits = try bitSizeAdvanced(ty.elemType(), target, sema_kit); - const bytes = (bits + 7) / 8; - const alignment = std.math.ceilPowerOfTwoAssert(u64, bytes * len); + const bytes = ((bits * len) + 7) / 8; + const alignment = std.math.ceilPowerOfTwoAssert(u64, bytes); return AbiAlignmentAdvanced{ .scalar = @intCast(u32, alignment) }; }, |
