JitArm64: Mask input to 32-bit ADDI2R

In case the input was a s32 that got sign extended as part of conversion
to u64.
This commit is contained in:
JosJuice 2023-12-01 21:18:37 +01:00
parent 5f7e9d3bf1
commit 25ffb0dbfc

View File

@ -4125,6 +4125,9 @@ void ARM64XEmitter::AddImmediate(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool shift,
void ARM64XEmitter::ADDI2R_internal(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool negative, bool flags, void ARM64XEmitter::ADDI2R_internal(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool negative, bool flags,
ARM64Reg scratch) ARM64Reg scratch)
{ {
if (!Is64Bit(Rd))
imm &= 0xFFFFFFFFULL;
bool has_scratch = scratch != ARM64Reg::INVALID_REG; bool has_scratch = scratch != ARM64Reg::INVALID_REG;
u64 imm_neg = Is64Bit(Rd) ? u64(-s64(imm)) : u64(-s64(imm)) & 0xFFFFFFFFuLL; u64 imm_neg = Is64Bit(Rd) ? u64(-s64(imm)) : u64(-s64(imm)) & 0xFFFFFFFFuLL;
bool neg_neg = negative ? false : true; bool neg_neg = negative ? false : true;