From cea0b2fc38422543282b46ae709ef5714b165e0c Mon Sep 17 00:00:00 2001 From: DeaTh-G <55578911+DeaTh-G@users.noreply.github.com> Date: Sun, 3 Nov 2024 19:16:26 +0100 Subject: [PATCH] Fix instruction implementations based on unit tests --- XenonRecomp/recompiler.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/XenonRecomp/recompiler.cpp b/XenonRecomp/recompiler.cpp index d7b311a..bb453fb 100644 --- a/XenonRecomp/recompiler.cpp +++ b/XenonRecomp/recompiler.cpp @@ -532,7 +532,7 @@ bool Recompiler::Recompile( break; 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])); if (strchr(insn.opcode->name, '.')) println("\t{}.compare({}.s32, 0, {});", cr(0), r(insn.operands[0]), xer()); @@ -904,10 +904,9 @@ bool Recompiler::Recompile( break; 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, '.')) println("\t{}.compare({}.s32, 0, {});", cr(0), r(insn.operands[0]), xer()); - break; case PPC_INST_EXTSB: @@ -2131,7 +2130,7 @@ bool Recompiler::Recompile( break; 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; case PPC_INST_VMINFP: @@ -2338,7 +2337,7 @@ bool Recompiler::Recompile( case PPC_INST_VSLH: // TODO: vectorize 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; case PPC_INST_VSLDOI: