Skip to content

Commit

Permalink
[arm/jit] Fix RSB
Browse files Browse the repository at this point in the history
  • Loading branch information
Senryoku committed Dec 3, 2024
1 parent 638bc60 commit f829b61
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/jit/arm_jit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,10 @@ fn handle_data_processing(b: *JITBlock, ctx: *JITContext, instruction: u32) !boo
.RSB => {
// cpu.r(inst.rd).* = op2 -% op1;
try load_register(b, ReturnRegister, inst.rn);
try b.append(.{ .Sub = .{ .dst = .{ .reg = ArgRegisters[0] }, .src = op2 } });
if (op2 == .imm32) {
try b.mov(.{ .reg = ArgRegisters[0] }, op2);
} else std.debug.assert(op2.reg == ArgRegisters[0]);
try b.append(.{ .Sub = .{ .dst = .{ .reg = ArgRegisters[0] }, .src = .{ .reg = ReturnRegister } } });
try store_register(b, inst.rd, .{ .reg = ArgRegisters[0] });
},
.ADD => {
Expand Down

0 comments on commit f829b61

Please sign in to comment.