| ... | @@ -1540,10 +1540,30 @@ pub const Type = struct { | ... | @@ -1540,10 +1540,30 @@ pub const Type = struct { |
| 1540 | } | 1540 | } |
| 1541 | | 1541 | |
| 1542 | pub fn intAbiAlignment(bits: u16, target: Target, use_llvm: bool) Alignment { | 1542 | pub fn intAbiAlignment(bits: u16, target: Target, use_llvm: bool) Alignment { |
| 1543 | return Alignment.fromByteUnits(@min( | 1543 | return switch (target.cpu.arch) { |
| 1544 | std.math.ceilPowerOfTwoPromote(u16, @as(u16, @intCast((@as(u17, bits) + 7) / 8))), | 1544 | .x86 => switch (bits) { |
| 1545 | maxIntAlignment(target, use_llvm), | 1545 | 0 => .none, |
| 1546 | )); | 1546 | 1...8 => .@"1", |
| | 1547 | 9...16 => .@"2", |
| | 1548 | 17...127 => .@"4", |
| | 1549 | else => .@"16", |
| | 1550 | }, |
| | 1551 | .x86_64 => switch (bits) { |
| | 1552 | 0 => .none, |
| | 1553 | 1...8 => .@"1", |
| | 1554 | 9...16 => .@"2", |
| | 1555 | 17...32 => .@"4", |
| | 1556 | 33...64 => .@"8", |
| | 1557 | else => switch (target_util.zigBackend(target, use_llvm)) { |
| | 1558 | .stage2_x86_64 => .@"8", |
| | 1559 | else => .@"16", |
| | 1560 | }, |
| | 1561 | }, |
| | 1562 | else => return Alignment.fromByteUnits(@min( |
| | 1563 | std.math.ceilPowerOfTwoPromote(u16, @as(u16, @intCast((@as(u17, bits) + 7) / 8))), |
| | 1564 | maxIntAlignment(target, use_llvm), |
| | 1565 | )), |
| | 1566 | }; |
| 1547 | } | 1567 | } |
| 1548 | | 1568 | |
| 1549 | pub fn maxIntAlignment(target: std.Target, use_llvm: bool) u16 { | 1569 | pub fn maxIntAlignment(target: std.Target, use_llvm: bool) u16 { |