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