diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 17:29:31 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-01 17:29:31 -0400 |
| commit | 2360f8c490f3ec684ed64ff28e8c1fade249070b (patch) | |
| tree | f39083118406b53b0de41b99ee88a4269cc537ab /src/type.zig | |
| parent | 7e2eb1326ba267012d47aa2eda539f01963d4d6b (diff) | |
| parent | 095e24e537fcb6a702b992d946d1ca73d6f608b3 (diff) | |
| download | zig-2360f8c490f3ec684ed64ff28e8c1fade249070b.tar.gz zig-2360f8c490f3ec684ed64ff28e8c1fade249070b.zip | |
Merge pull request #11974 from ziglang/fixfixfix
stage2 fixes
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/type.zig b/src/type.zig index 50302dca6c..55466efe4a 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2906,9 +2906,13 @@ pub const Type = extern union { .array, .array_sentinel => return ty.elemType().abiAlignmentAdvanced(target, strat), - // TODO audit this - is there any more complicated logic to determine - // ABI alignment of vectors? - .vector => return AbiAlignmentAdvanced{ .scalar = 16 }, + .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); + return AbiAlignmentAdvanced{ .scalar = @intCast(u32, alignment) }; + }, .i16, .u16 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(16, target) }, .u29 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(29, target) }, |
