JIT: fix divisor masking

oversight. should fix Steam.

Fixes: de4becc26 ("OpcodeDispatcher: mask certain divisors")
Closes: #4652
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig committed 2025-07-09 15:00:42 -04:00
1 parent 60f63ca467
commit d23bb01e96
1 file changed
+6 -2
+6 -2
View File
@@ -969,11 +969,15 @@ DEF_OP(UDiv) {
break;
}
case IR::OpSize::i32Bit: {
// We need to mask divisor if we have Upper bits, since the frontend does
// not on the hope that we can optimize to use the path above.
mov(ARMEmitter::Size::i32Bit, TMP2, Divisor);
// TODO: 32-bit operation should be guaranteed not to leave garbage in the upper bits.
mov(EmitSize, TMP1, Lower);
bfi(EmitSize, TMP1, Upper, 32, 32);
udiv(EmitSize, Quotient, TMP1, Divisor);
msub(EmitSize, Remainder, Quotient, Divisor, TMP1);
udiv(EmitSize, Quotient, TMP1, TMP2);
msub(EmitSize, Remainder, Quotient, TMP2, TMP1);
break;
}
case IR::OpSize::i64Bit: {