diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-11-15 16:18:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-15 16:18:40 +0000 |
| commit | bc589c271a52e3010ca0af1191c527fb0db63a89 (patch) | |
| tree | ff027ccc1ca4ae96c42e6dae0b75bb7f8e7fa66d /src/codegen/llvm.zig | |
| parent | 1ebbdf8eef4904b2a12fad04225ee099e68e1dd7 (diff) | |
| parent | cd8fdd252d9ffd5bfb772cef49e4c79041872d38 (diff) | |
| download | zig-bc589c271a52e3010ca0af1191c527fb0db63a89.tar.gz zig-bc589c271a52e3010ca0af1191c527fb0db63a89.zip | |
Merge pull request #25924 from mlugg/legalize-soft-float
Legalize: implement soft-float legalizations
Diffstat (limited to 'src/codegen/llvm.zig')
| -rw-r--r-- | src/codegen/llvm.zig | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 7c7151524a..0df4cbc3d4 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -4889,6 +4889,8 @@ pub const FuncGen = struct { // No "scalarize" legalizations are enabled, so these instructions never appear. .legalize_vec_elem_val => unreachable, .legalize_vec_store_elem => unreachable, + // No soft float legalizations are enabled. + .legalize_compiler_rt_call => unreachable, .add => try self.airAdd(inst, .normal), .add_optimized => try self.airAdd(inst, .fast), @@ -6670,7 +6672,9 @@ pub const FuncGen = struct { "", ); - const rt_int_bits = compilerRtIntBits(@intCast(operand_scalar_ty.bitSize(zcu))); + const rt_int_bits = compilerRtIntBits(@intCast(operand_scalar_ty.bitSize(zcu))) orelse { + return self.todo("float_from_int from '{f}' without intrinsics", .{operand_scalar_ty.fmt(pt)}); + }; const rt_int_ty = try o.builder.intType(rt_int_bits); var extended = try self.wip.conv( if (is_signed_int) .signed else .unsigned, @@ -6739,7 +6743,9 @@ pub const FuncGen = struct { ); } - const rt_int_bits = compilerRtIntBits(@intCast(dest_scalar_ty.bitSize(zcu))); + const rt_int_bits = compilerRtIntBits(@intCast(dest_scalar_ty.bitSize(zcu))) orelse { + return self.todo("int_from_float to '{f}' without intrinsics", .{dest_scalar_ty.fmt(pt)}); + }; const ret_ty = try o.builder.intType(rt_int_bits); const libc_ret_ty = if (rt_int_bits == 128 and (target.os.tag == .windows and target.cpu.arch == .x86_64)) b: { // On Windows x86-64, "ti" functions must use Vector(2, u64) instead of the standard @@ -12823,13 +12829,13 @@ const optional_layout_version = 3; const lt_errors_fn_name = "__zig_lt_errors_len"; -fn compilerRtIntBits(bits: u16) u16 { +fn compilerRtIntBits(bits: u16) ?u16 { inline for (.{ 32, 64, 128 }) |b| { if (bits <= b) { return b; } } - return bits; + return null; } fn buildAllocaInner( |
