Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Fixes sign extension in emit_product_quotient_remainder().
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Aug 8, 2023
1 parent c0ebd95 commit ba2b4f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,10 +1221,12 @@ impl<'a, V: Verifier, C: ContextObject> JitCompiler<'a, V, C> {
if dst != RDX {
self.emit_ins(X86Instruction::push(RDX, None));
}
if signed {
self.emit_ins(X86Instruction::sign_extend_rax_rdx(size));
} else if division {
self.emit_ins(X86Instruction::alu(size, 0x31, RDX, RDX, 0, None)); // RDX = 0
if division {
if signed {
self.emit_ins(X86Instruction::sign_extend_rax_rdx(size));
} else {
self.emit_ins(X86Instruction::alu(size, 0x31, RDX, RDX, 0, None)); // RDX = 0
}
}

self.emit_ins(X86Instruction::alu(size, 0xf7, 0x4 | (division as u8) << 1 | signed as u8, R11, 0, None));
Expand Down

0 comments on commit ba2b4f0

Please sign in to comment.