stage2: implement some casts for numbers

This commit is contained in:
Vexu
2020-07-20 22:45:27 +03:00
parent da217fadeb
commit 7b52dbbf83
4 changed files with 74 additions and 15 deletions

View File

@@ -459,6 +459,16 @@ 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).?),
}
}
fn genWidenOrShorten(self: *Self, inst: *ir.Inst.WidenOrShorten) !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}),
}
}