| ... | @@ -31,16 +31,19 @@ const bindings = if (build_options.have_llvm) | ... | @@ -31,16 +31,19 @@ const bindings = if (build_options.have_llvm) |
| 31 | else | 31 | else |
| 32 | @compileError("LLVM unavailable"); | 32 | @compileError("LLVM unavailable"); |
| 33 | | 33 | |
| 34 | pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { | 34 | pub fn legalizeFeatures(target: *const std.Target) ?*const Air.Legalize.Features { |
| 35 | return comptime &.initMany(&.{ | 35 | return switch (target.cpu.arch.endian()) { |
| 36 | .expand_int_from_float_safe, | 36 | inline else => |endian| comptime &.init(.{ |
| 37 | .expand_int_from_float_optimized_safe, | 37 | .expand_int_from_float_safe = true, |
| 38 | | 38 | .expand_int_from_float_optimized_safe = true, |
| 39 | .scalarize_bit_cast_array, | 39 | |
| 40 | // Needed because LLVM's `bitcast` on vectors is endian-specific unless the source and dest | 40 | .scalarize_bit_cast_array = true, |
| 41 | // types are vectors with equal length (hence also with equal bits-per-element). | 41 | // LLVM's `bitcast` on vectors places element 0 in the least significant bits on |
| 42 | .scalarize_bit_cast_vector_non_elementwise, | 42 | // little-endian targets, which matches our semantics; but it does the opposite on |
| 43 | }); | 43 | // big-endian targets, so in that case we need to scalarize. |
| | 44 | .scalarize_bit_cast_vector_non_elementwise = endian != .little, |
| | 45 | }), |
| | 46 | }; |
| 44 | } | 47 | } |
| 45 | | 48 | |
| 46 | fn subArchName(target: *const std.Target, comptime family: std.Target.Cpu.Arch.Family, mappings: anytype) ?[]const u8 { | 49 | fn subArchName(target: *const std.Target, comptime family: std.Target.Cpu.Arch.Family, mappings: anytype) ?[]const u8 { |