| ... | @@ -915,15 +915,19 @@ pub const Type = struct { | ... | @@ -915,15 +915,19 @@ pub const Type = struct { |
| 915 | return .{ .scalar = Alignment.fromByteUnits(alignment) }; | 915 | return .{ .scalar = Alignment.fromByteUnits(alignment) }; |
| 916 | }, | 916 | }, |
| 917 | .stage2_x86_64 => { | 917 | .stage2_x86_64 => { |
| 918 | if (vector_type.child == .bool_type) return .{ .scalar = intAbiAlignment(@intCast(vector_type.len), target) }; | 918 | if (vector_type.child == .bool_type) { |
| | 919 | if (vector_type.len > 256 and std.Target.x86.featureSetHas(target.cpu.features, .avx512f)) return .{ .scalar = .@"64" }; |
| | 920 | if (vector_type.len > 128 and std.Target.x86.featureSetHas(target.cpu.features, .avx2)) return .{ .scalar = .@"32" }; |
| | 921 | if (vector_type.len > 64) return .{ .scalar = .@"16" }; |
| | 922 | const bytes = std.math.divCeil(u32, vector_type.len, 8) catch unreachable; |
| | 923 | const alignment = std.math.ceilPowerOfTwoAssert(u32, bytes); |
| | 924 | return .{ .scalar = Alignment.fromByteUnits(alignment) }; |
| | 925 | } |
| 919 | const elem_bytes: u32 = @intCast((try Type.fromInterned(vector_type.child).abiSizeAdvanced(mod, strat)).scalar); | 926 | const elem_bytes: u32 = @intCast((try Type.fromInterned(vector_type.child).abiSizeAdvanced(mod, strat)).scalar); |
| 920 | if (elem_bytes == 0) return .{ .scalar = .@"1" }; | 927 | if (elem_bytes == 0) return .{ .scalar = .@"1" }; |
| 921 | const bytes = elem_bytes * vector_type.len; | 928 | const bytes = elem_bytes * vector_type.len; |
| 922 | if (bytes > 32 and std.Target.x86.featureSetHas(target.cpu.features, .avx512f)) return .{ .scalar = .@"64" }; | 929 | if (bytes > 32 and std.Target.x86.featureSetHas(target.cpu.features, .avx512f)) return .{ .scalar = .@"64" }; |
| 923 | if (bytes > 16 and std.Target.x86.featureSetHas( | 930 | if (bytes > 16 and std.Target.x86.featureSetHas(target.cpu.features, .avx)) return .{ .scalar = .@"32" }; |
| 924 | target.cpu.features, | | |
| 925 | if (Type.fromInterned(vector_type.child).isRuntimeFloat()) .avx else .avx2, | | |
| 926 | )) return .{ .scalar = .@"32" }; | | |
| 927 | return .{ .scalar = .@"16" }; | 931 | return .{ .scalar = .@"16" }; |
| 928 | }, | 932 | }, |
| 929 | } | 933 | } |