From d2ff40d90ac31ff2dd8da26915b9fbc52fe1d73e Mon Sep 17 00:00:00 2001 From: SimoneN64 Date: Sun, 26 May 2024 23:34:57 +0200 Subject: [PATCH] More instructions --- src/backend/core/jit/instructions.cpp | 57 ++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/backend/core/jit/instructions.cpp b/src/backend/core/jit/instructions.cpp index b2611616..091ecf83 100644 --- a/src/backend/core/jit/instructions.cpp +++ b/src/backend/core/jit/instructions.cpp @@ -513,24 +513,61 @@ void JIT::mtlo(u32 instr) { } } -void JIT::nor(u32) { - +void JIT::nor(u32 instr) { + if(regs.IsRegConstant(RS(instr), RT(instr))) { + if (RD(instr) != 0) [[likely]] { + regs.gpr[RD(instr)] = ~(regs.gpr[RS(instr)] | regs.gpr[RT(instr)]); + regs.gprIsConstant[RD(instr)] = true; + } + } else { + Util::panic("[JIT]: Implement non constant NOR!"); + } } -void JIT::slti(u32) { - +void JIT::slti(u32 instr) { + if(regs.IsRegConstant(RS(instr))) { + s16 imm = instr; + if (RT(instr) != 0) [[likely]] { + regs.gpr[RT(instr)] = regs.gpr[RS(instr)] < imm; + regs.gprIsConstant[RT(instr)] = true; + } + } else { + Util::panic("[JIT]: Implement non constant SLTI!"); + } } -void JIT::sltiu(u32) { - +void JIT::sltiu(u32 instr) { + if(regs.IsRegConstant(RS(instr))) { + s16 imm = instr; + if (RT(instr) != 0) [[likely]] { + regs.gpr[RT(instr)] = (u64) regs.gpr[RS(instr)] < imm; + regs.gprIsConstant[RT(instr)] = true; + } + } else { + Util::panic("[JIT]: Implement non constant SLTIU!"); + } } -void JIT::slt(u32) { - +void JIT::slt(u32 instr) { + if(regs.IsRegConstant(RS(instr), RT(instr))) { + if (RD(instr) != 0) [[likely]] { + regs.gpr[RD(instr)] = regs.gpr[RS(instr)] < regs.gpr[RT(instr)]; + regs.gprIsConstant[RD(instr)] = true; + } + } else { + Util::panic("[JIT]: Implement non constant SLT!"); + } } -void JIT::sltu(u32) { - +void JIT::sltu(u32 instr) { + if(regs.IsRegConstant(RS(instr), RT(instr))) { + if (RD(instr) != 0) [[likely]] { + regs.gpr[RD(instr)] = (u64)regs.gpr[RS(instr)] < (u64)regs.gpr[RT(instr)]; + regs.gprIsConstant[RD(instr)] = true; + } + } else { + Util::panic("[JIT]: Implement non constant SLT!"); + } } void JIT::sll(u32) {