aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv64/CodeGen.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/riscv64/CodeGen.zig')
-rw-r--r--src/arch/riscv64/CodeGen.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig
index 65983a5661..36c1752e5d 100644
--- a/src/arch/riscv64/CodeGen.zig
+++ b/src/arch/riscv64/CodeGen.zig
@@ -2074,6 +2074,20 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
return self.fail("TODO genSetReg 33-64 bit immediates for riscv64", .{}); // glhf
}
},
+ .register => |src_reg| {
+ // If the registers are the same, nothing to do.
+ if (src_reg.id() == reg.id())
+ return;
+
+ // mov reg, src_reg
+ _ = try self.addInst(.{
+ .tag = .mv,
+ .data = .{ .rr = .{
+ .rd = reg,
+ .rs = src_reg,
+ } },
+ });
+ },
.memory => |addr| {
// The value is in memory at a hard-coded address.
// If the type is a pointer, it means the pointer address is at this memory location.