From d86f6ae61824fa8c1ab71d4fa9e3ac3cebd90ca4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 22 Aug 2023 18:51:43 -0700 Subject: [PATCH] x86jit: Implement set less thans. --- Core/MIPS/x86/X64IRCompALU.cpp | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/x86/X64IRCompALU.cpp b/Core/MIPS/x86/X64IRCompALU.cpp index bf8f7887f2..879ef65b8b 100644 --- a/Core/MIPS/x86/X64IRCompALU.cpp +++ b/Core/MIPS/x86/X64IRCompALU.cpp @@ -179,10 +179,43 @@ void X64JitBackend::CompIR_Compare(IRInst inst) { switch (inst.op) { case IROp::Slt: + regs_.Map(inst); + CMP(32, regs_.R(inst.src1), regs_.R(inst.src2)); + SETcc(CC_L, R(SCRATCH1)); + MOVZX(32, 8, regs_.RX(inst.dest), R(SCRATCH1)); + break; + case IROp::SltConst: + if (inst.constant == 0) { + // Basically, getting the sign bit. Let's shift instead. + regs_.Map(inst); + if (inst.dest != inst.src1) + MOV(32, regs_.R(inst.dest), regs_.R(inst.src1)); + SHR(32, regs_.R(inst.dest), Imm8(31)); + } else { + regs_.Map(inst); + CMP(32, regs_.R(inst.src1), Imm32(inst.constant)); + SETcc(CC_L, R(SCRATCH1)); + MOVZX(32, 8, regs_.RX(inst.dest), R(SCRATCH1)); + } + break; + case IROp::SltU: + regs_.Map(inst); + CMP(32, regs_.R(inst.src1), regs_.R(inst.src2)); + SETcc(CC_B, R(SCRATCH1)); + MOVZX(32, 8, regs_.RX(inst.dest), R(SCRATCH1)); + break; + case IROp::SltUConst: - CompIR_Generic(inst); + if (inst.constant == 0) { + regs_.SetGPRImm(inst.dest, 0); + } else { + regs_.Map(inst); + CMP(32, regs_.R(inst.src1), Imm32(inst.constant)); + SETcc(CC_B, R(SCRATCH1)); + MOVZX(32, 8, regs_.RX(inst.dest), R(SCRATCH1)); + } break; default: