stage2: add floatCast to zir and ir
This commit is contained in:
@@ -459,16 +459,26 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
.sub => return self.genSub(inst.castTag(.sub).?),
|
||||
.unreach => return MCValue{ .unreach = {} },
|
||||
.not => return self.genNot(inst.castTag(.not).?),
|
||||
.widenorshorten => return self.genWidenOrShorten(isnt.castTag(.widenorshorten).?),
|
||||
.floatcast => return self.genFloatCast(inst.castTag(.floatcast).?),
|
||||
.intcast => return self.genIntCast(inst.castTag(.intcast).?),
|
||||
}
|
||||
}
|
||||
|
||||
fn genWidenOrShorten(self: *Self, inst: *ir.Inst.WidenOrShorten) !MCValue {
|
||||
fn genFloatCast(self: *Self, inst: *ir.Inst.UnOp) !MCValue {
|
||||
// No side effects, so if it's unreferenced, do nothing.
|
||||
if (inst.base.isUnused())
|
||||
return MCValue.dead;
|
||||
switch (arch) {
|
||||
else => return self.fail(inst.base.src, "TODO implement widen or shorten for {}", .{self.target.cpu.arch}),
|
||||
else => return self.fail(inst.base.src, "TODO implement floatCast for {}", .{self.target.cpu.arch}),
|
||||
}
|
||||
}
|
||||
|
||||
fn genIntCast(self: *Self, inst: *ir.Inst.UnOp) !MCValue {
|
||||
// No side effects, so if it's unreferenced, do nothing.
|
||||
if (inst.base.isUnused())
|
||||
return MCValue.dead;
|
||||
switch (arch) {
|
||||
else => return self.fail(inst.base.src, "TODO implement intCast for {}", .{self.target.cpu.arch}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user