diff --git a/src/backend_x64/a64_emit_x64.cpp b/src/backend_x64/a64_emit_x64.cpp index 4c53f0db..98c25cb8 100644 --- a/src/backend_x64/a64_emit_x64.cpp +++ b/src/backend_x64/a64_emit_x64.cpp @@ -261,8 +261,8 @@ void A64EmitX64::EmitA64SetQ(A64EmitContext& ctx, IR::Inst* inst) { void A64EmitX64::EmitA64SetSP(A64EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); auto addr = qword[r15 + offsetof(A64JitState, sp)]; - if (args[0].FitsInImmediateU32()) { - code->mov(addr, args[0].GetImmediateU32()); + if (args[0].FitsInImmediateS32()) { + code->mov(addr, args[0].GetImmediateS32()); } else if (args[0].IsInXmm()) { Xbyak::Xmm to_store = ctx.reg_alloc.UseXmm(args[0]); code->movq(addr, to_store); @@ -275,8 +275,8 @@ void A64EmitX64::EmitA64SetSP(A64EmitContext& ctx, IR::Inst* inst) { void A64EmitX64::EmitA64SetPC(A64EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); auto addr = qword[r15 + offsetof(A64JitState, pc)]; - if (args[0].FitsInImmediateU32()) { - code->mov(addr, args[0].GetImmediateU32()); + if (args[0].FitsInImmediateS32()) { + code->mov(addr, args[0].GetImmediateS32()); } else if (args[0].IsInXmm()) { Xbyak::Xmm to_store = ctx.reg_alloc.UseXmm(args[0]); code->movq(addr, to_store);