diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-06-17 11:02:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-17 11:02:03 +0100 |
| commit | 561fdd0ed3d93a373f126f4df01caf813ad32fec (patch) | |
| tree | 285a0c41e4951ff6eb503b65dff92b6020538355 /src/codegen/llvm.zig | |
| parent | 080ee25ecf1991d85038716ca6199ae8dc31c8f5 (diff) | |
| parent | e498d8da3c7a957fe3754db8f3517d71f7fc650e (diff) | |
| download | zig-561fdd0ed3d93a373f126f4df01caf813ad32fec.tar.gz zig-561fdd0ed3d93a373f126f4df01caf813ad32fec.zip | |
Merge pull request #24188 from mlugg/intfromfloat-safety
Absorb std.math.big.rational logic into std.math.big.int; fix `@intFromFloat` safety check
Diffstat (limited to 'src/codegen/llvm.zig')
| -rw-r--r-- | src/codegen/llvm.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 658764ba3c..b4950179c4 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -37,7 +37,10 @@ const compilerRtIntAbbrev = target_util.compilerRtIntAbbrev; const Error = error{ OutOfMemory, CodegenFail }; pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { - return null; + return comptime &.initMany(&.{ + .expand_int_from_float_safe, + .expand_int_from_float_optimized_safe, + }); } fn subArchName(target: std.Target, comptime family: std.Target.Cpu.Arch.Family, mappings: anytype) ?[]const u8 { @@ -4987,6 +4990,8 @@ pub const FuncGen = struct { .int_from_float => try self.airIntFromFloat(inst, .normal), .int_from_float_optimized => try self.airIntFromFloat(inst, .fast), + .int_from_float_safe => unreachable, // handled by `legalizeFeatures` + .int_from_float_optimized_safe => unreachable, // handled by `legalizeFeatures` .array_to_slice => try self.airArrayToSlice(inst), .float_from_int => try self.airFloatFromInt(inst), |
