cranelift: fix register for srem.i8 on x86_64 (#5540)

* Change register written to in specific srem case. Add regression test as filetest case. Fixes #5470

* Add another test case, newline

* Update comment
This commit is contained in:
Alexa VanHattum
2023-01-06 17:18:16 -05:00
committed by GitHub
parent e65a2c9280
commit 44913825b5
2 changed files with 11 additions and 2 deletions

View File

@@ -543,10 +543,10 @@ pub(crate) fn emit(
// Here, divisor == -1.
if !kind.is_div() {
// x % -1 = 0; put the result into the destination, $rdx.
// x % -1 = 0; put the result into the destination, $rax.
let done_label = sink.get_label();
let inst = Inst::imm(OperandSize::Size64, 0, Writable::from_reg(regs::rdx()));
let inst = Inst::imm(OperandSize::Size64, 0, Writable::from_reg(regs::rax()));
inst.emit(&[], sink, info, state);
let inst = Inst::jmp_known(done_label);