[JIT]: Implement non-constant dadd, daddu, daddi and daddiu
This commit is contained in:
@@ -544,24 +544,39 @@ void JIT::dadd(u32 instr) {
|
|||||||
Util::panic("[JIT]: Unhandled Overflow exception in DADD!");
|
Util::panic("[JIT]: Unhandled Overflow exception in DADD!");
|
||||||
}
|
}
|
||||||
regs.Write(RD(instr), result);
|
regs.Write(RD(instr), result);
|
||||||
} else {
|
return;
|
||||||
Util::panic("[JIT]: Implement non constant DADD!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(regs.IsRegConstant(RS(instr))) {
|
||||||
|
auto rs = regs.Read<u64>(RS(instr));
|
||||||
|
regs.Read<u64>(RT(instr), code.rax);
|
||||||
|
code.add(code.rax, rs);
|
||||||
|
regs.Write<u64>(RD(instr), code.rax);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(regs.IsRegConstant(RT(instr))) {
|
||||||
|
auto rt = regs.Read<u64>(RT(instr));
|
||||||
|
regs.Read<u64>(RS(instr), code.rax);
|
||||||
|
code.add(code.rax, rt);
|
||||||
|
regs.Write<u64>(RD(instr), code.rax);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
regs.Read<u64>(RS(instr), code.rax);
|
||||||
|
regs.Read<u64>(RT(instr), code.rdi);
|
||||||
|
code.add(code.rax, code.rdi);
|
||||||
|
regs.Write<u64>(RD(instr), code.rax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JIT::daddu(u32 instr) {
|
void JIT::daddu(u32 instr) {
|
||||||
if (regs.IsRegConstant(RS(instr), RT(instr))) {
|
// TODO: IMPLEMENT DADDU BY ITSELF ACTUALLY
|
||||||
auto rs = regs.Read<s64>(RS(instr));
|
dadd(instr);
|
||||||
auto rt = regs.Read<s64>(RT(instr));
|
|
||||||
regs.Write(RD(instr), rt + rs);
|
|
||||||
} else {
|
|
||||||
Util::panic("[JIT]: Implement non constant DADD!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JIT::daddi(u32 instr) {
|
void JIT::daddi(u32 instr) {
|
||||||
if (regs.IsRegConstant(RS(instr))) {
|
|
||||||
u64 imm = s64(s16(instr));
|
u64 imm = s64(s16(instr));
|
||||||
|
if (regs.IsRegConstant(RS(instr))) {
|
||||||
auto rs = regs.Read<u64>(RS(instr));
|
auto rs = regs.Read<u64>(RS(instr));
|
||||||
u64 result = imm + rs;
|
u64 result = imm + rs;
|
||||||
if (check_signed_overflow(rs, imm, result)) {
|
if (check_signed_overflow(rs, imm, result)) {
|
||||||
@@ -569,19 +584,17 @@ void JIT::daddi(u32 instr) {
|
|||||||
Util::panic("[JIT]: Unhandled Overflow exception in DADDI!");
|
Util::panic("[JIT]: Unhandled Overflow exception in DADDI!");
|
||||||
}
|
}
|
||||||
regs.Write(RT(instr), result);
|
regs.Write(RT(instr), result);
|
||||||
} else {
|
return;
|
||||||
Util::panic("[JIT]: Implement non constant DADDI!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regs.Read<u64>(RS(instr), code.rax);
|
||||||
|
code.add(code.rax, imm);
|
||||||
|
regs.Write(RT(instr), code.rax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JIT::daddiu(u32 instr) {
|
void JIT::daddiu(u32 instr) {
|
||||||
if (regs.IsRegConstant(RS(instr))) {
|
// TODO: IMPLEMENT DADDIU BY ITSELF ACTUALLY
|
||||||
s16 imm = s16(instr);
|
daddi(instr);
|
||||||
auto rs = regs.Read<s64>(RS(instr));
|
|
||||||
regs.Write(RT(instr), imm + rs);
|
|
||||||
} else {
|
|
||||||
Util::panic("[JIT]: Implement non constant DADDI!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JIT::ddiv(u32 instr) {
|
void JIT::ddiv(u32 instr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user