aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index f4952d4a58..0fe3f80919 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -23,12 +23,19 @@ const BigIntLimb = std.math.big.Limb;
const BigInt = std.math.big.int;
pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features {
- return if (dev.env.supports(.legalize)) comptime &.initMany(&.{
- .expand_intcast_safe,
- .expand_add_safe,
- .expand_sub_safe,
- .expand_mul_safe,
- }) else null; // we don't currently ask zig1 to use safe optimization modes
+ return comptime switch (dev.env.supports(.legalize)) {
+ inline false, true => |supports_legalize| &.init(.{
+ // we don't currently ask zig1 to use safe optimization modes
+ .expand_intcast_safe = supports_legalize,
+ .expand_add_safe = supports_legalize,
+ .expand_sub_safe = supports_legalize,
+ .expand_mul_safe = supports_legalize,
+
+ .expand_packed_load = true,
+ .expand_packed_store = true,
+ .expand_packed_struct_field_val = true,
+ }),
+ };
}
/// For most backends, MIR is basically a sequence of machine code instructions, perhaps with some