authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-08 00:02:19-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-08 04:41:55-04:00
logf6e027da32caabdea57bae9ee806abe1d9e3ac68
tree5cf1dcdf53bad06da5485a6f0578305157815303
parentb8f00ae337a9c36cb33181292c5b6ba345add9ab

x86_64: fix conversions between floats and 128-bit integers


1 files changed, 10 insertions(+), 10 deletions(-)

src/arch/x86_64/CodeGen.zig+10-10
...@@ -11470,9 +11470,13 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {...@@ -11470,9 +11470,13 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
11470 const result = result: {11470 const result = result: {
11471 if (switch (dst_bits) {11471 if (switch (dst_bits) {
11472 16, 80, 128 => true,11472 16, 80, 128 => true,
11473 32, 64 => src_size > 8 and src_size < 16,11473 32, 64 => src_size > 8,
11474 else => unreachable,11474 else => unreachable,
11475 }) {11475 }) {
11476 if (src_bits > 128) return self.fail("TODO implement airFloatFromInt from {} to {}", .{
11477 src_ty.fmt(mod), dst_ty.fmt(mod),
11478 });
11479
11476 var callee: ["__floatun?i?f".len]u8 = undefined;11480 var callee: ["__floatun?i?f".len]u8 = undefined;
11477 break :result try self.genCall(.{ .lib = .{11481 break :result try self.genCall(.{ .lib = .{
11478 .return_type = dst_ty.toIntern(),11482 .return_type = dst_ty.toIntern(),
...@@ -11488,10 +11492,6 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {...@@ -11488,10 +11492,6 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
11488 } }, &.{src_ty}, &.{.{ .air_ref = ty_op.operand }});11492 } }, &.{src_ty}, &.{.{ .air_ref = ty_op.operand }});
11489 }11493 }
1149011494
11491 if (src_size > 8) return self.fail("TODO implement airFloatFromInt from {} to {}", .{
11492 src_ty.fmt(mod), dst_ty.fmt(mod),
11493 });
11494
11495 const src_mcv = try self.resolveInst(ty_op.operand);11495 const src_mcv = try self.resolveInst(ty_op.operand);
11496 const src_reg = if (src_mcv.isRegister())11496 const src_reg = if (src_mcv.isRegister())
11497 src_mcv.getReg().?11497 src_mcv.getReg().?
...@@ -11549,9 +11549,13 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {...@@ -11549,9 +11549,13 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
11549 const result = result: {11549 const result = result: {
11550 if (switch (src_bits) {11550 if (switch (src_bits) {
11551 16, 80, 128 => true,11551 16, 80, 128 => true,
11552 32, 64 => dst_size > 8 and dst_size < 16,11552 32, 64 => dst_size > 8,
11553 else => unreachable,11553 else => unreachable,
11554 }) {11554 }) {
11555 if (dst_bits > 128) return self.fail("TODO implement airIntFromFloat from {} to {}", .{
11556 src_ty.fmt(mod), dst_ty.fmt(mod),
11557 });
11558
11555 var callee: ["__fixuns?f?i".len]u8 = undefined;11559 var callee: ["__fixuns?f?i".len]u8 = undefined;
11556 break :result try self.genCall(.{ .lib = .{11560 break :result try self.genCall(.{ .lib = .{
11557 .return_type = dst_ty.toIntern(),11561 .return_type = dst_ty.toIntern(),
...@@ -11567,10 +11571,6 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {...@@ -11567,10 +11571,6 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
11567 } }, &.{src_ty}, &.{.{ .air_ref = ty_op.operand }});11571 } }, &.{src_ty}, &.{.{ .air_ref = ty_op.operand }});
11568 }11572 }
1156911573
11570 if (dst_size > 8) return self.fail("TODO implement airIntFromFloat from {} to {}", .{
11571 src_ty.fmt(mod), dst_ty.fmt(mod),
11572 });
11573
11574 const src_mcv = try self.resolveInst(ty_op.operand);11574 const src_mcv = try self.resolveInst(ty_op.operand);
11575 const src_reg = if (src_mcv.isRegister())11575 const src_reg = if (src_mcv.isRegister())
11576 src_mcv.getReg().?11576 src_mcv.getReg().?