BackendX64: ArithmeticShiftRight: Fix incorrect immediate size for SAR
This commit is contained in:
parent
6097a21955
commit
864081d1a0
1 changed files with 2 additions and 2 deletions
|
@ -497,10 +497,10 @@ void EmitX64::EmitArithmeticShiftRight(IR::Block& block, IR::Inst* inst) {
|
||||||
auto shift_arg = inst->GetArg(1);
|
auto shift_arg = inst->GetArg(1);
|
||||||
|
|
||||||
if (shift_arg.IsImmediate()) {
|
if (shift_arg.IsImmediate()) {
|
||||||
u32 shift = shift_arg.GetU8();
|
u8 shift = shift_arg.GetU8();
|
||||||
X64Reg result = reg_alloc.UseDefRegister(inst->GetArg(0), inst);
|
X64Reg result = reg_alloc.UseDefRegister(inst->GetArg(0), inst);
|
||||||
|
|
||||||
code->SAR(32, R(result), Imm32(shift < 31 ? shift : 31));
|
code->SAR(32, R(result), Imm8(shift < 31 ? shift : 31));
|
||||||
} else {
|
} else {
|
||||||
X64Reg shift = reg_alloc.UseScratchRegister(shift_arg.GetInst(), {HostLoc::RCX});
|
X64Reg shift = reg_alloc.UseScratchRegister(shift_arg.GetInst(), {HostLoc::RCX});
|
||||||
X64Reg result = reg_alloc.UseDefRegister(inst->GetArg(0), inst);
|
X64Reg result = reg_alloc.UseDefRegister(inst->GetArg(0), inst);
|
||||||
|
|
Loading…
Reference in a new issue