Fix instruction implementations based on unit tests

This commit is contained in:
DeaTh-G
2024-11-03 19:16:26 +01:00
committed by DeaTh-G
parent f6193ebe43
commit cea0b2fc38

View File

@@ -532,7 +532,7 @@ bool Recompiler::Recompile(
break; break;
case PPC_INST_ADDC: case PPC_INST_ADDC:
println("\t{}.ca = {}.u32 >= ~{}.u32;", xer(), r(insn.operands[2]), r(insn.operands[1])); println("\t{}.ca = {}.u32 > ~{}.u32;", xer(), r(insn.operands[2]), r(insn.operands[1]));
println("\t{}.u64 = {}.u64 + {}.u64;", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2])); println("\t{}.u64 = {}.u64 + {}.u64;", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2]));
if (strchr(insn.opcode->name, '.')) if (strchr(insn.opcode->name, '.'))
println("\t{}.compare<int32_t>({}.s32, 0, {});", cr(0), r(insn.operands[0]), xer()); println("\t{}.compare<int32_t>({}.s32, 0, {});", cr(0), r(insn.operands[0]), xer());
@@ -904,10 +904,9 @@ bool Recompiler::Recompile(
break; break;
case PPC_INST_EQV: case PPC_INST_EQV:
println("\t{}.u64 = ~({}.u32 ^ {}.u32);", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2])); println("\t{}.u64 = ~({}.u64 ^ {}.u64);", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2]));
if (strchr(insn.opcode->name, '.')) if (strchr(insn.opcode->name, '.'))
println("\t{}.compare<int32_t>({}.s32, 0, {});", cr(0), r(insn.operands[0]), xer()); println("\t{}.compare<int32_t>({}.s32, 0, {});", cr(0), r(insn.operands[0]), xer());
break; break;
case PPC_INST_EXTSB: case PPC_INST_EXTSB:
@@ -2131,7 +2130,7 @@ bool Recompiler::Recompile(
break; break;
case PPC_INST_VMINSH: case PPC_INST_VMINSH:
println("\t_mm_store_si128((__m128i*){}.u16, _mm_max_epi16(_mm_load_si128((__m128i*){}.u16), _mm_load_si128((__m128i*){}.u16)));", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); println("\t_mm_store_si128((__m128i*){}.u16, _mm_min_epi16(_mm_load_si128((__m128i*){}.u16), _mm_load_si128((__m128i*){}.u16)));", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2]));
break; break;
case PPC_INST_VMINFP: case PPC_INST_VMINFP:
@@ -2338,7 +2337,7 @@ bool Recompiler::Recompile(
case PPC_INST_VSLH: case PPC_INST_VSLH:
// TODO: vectorize // TODO: vectorize
for (size_t i = 0; i < 8; i++) for (size_t i = 0; i < 8; i++)
println("\t{}.u16[{}] = {}.u16[{}] << ({}.u8[{}] & 0xF);", v(insn.operands[0]), i, v(insn.operands[1]), i, v(insn.operands[2]), i); println("\t{}.u16[{}] = {}.u16[{}] << ({}.u8[{}] & 0xF);", v(insn.operands[0]), i, v(insn.operands[1]), i, v(insn.operands[2]), i * 2);
break; break;
case PPC_INST_VSLDOI: case PPC_INST_VSLDOI: