XenonRecomp icon indicating copy to clipboard operation
XenonRecomp copied to clipboard

[Request for instruction] BSO/BNS: Branch if (not) Summary Overflow

Open yellows111 opened this issue 9 months ago • 2 comments

These branch instructions seems to be fairly common in other titles.

Might also be worth considering a instruction implementation tracking issue for anything else that comes up, but that's up to someone else.

yellows111 avatar Mar 02 '25 20:03 yellows111

I noticed there's uint8_t so (summary overflow) in PPCCRRegister, not sure if that's already implemented or not. If so then we can implement bso/bns by

case PPC_INST_BSO:
    printConditionalBranch(false, "so");
    break;

case PPC_INST_BSOLR:
    println("\tif ({}.so) return;", cr(insn.operands[0]));
    break;

case PPC_INST_BNS:
    printConditionalBranch(true, "so");
    break;

case PPC_INST_BNSLR:
    println("\tif (!{}.so) return;", cr(insn.operands[0]));
    break;

Also here's my attempt on lhbrx for tgm ace

case PPC_INST_LHBRX:
    print("\t{}.u64 = __builtin_bswap16(PPC_LOAD_U16(", r(insn.operands[0]));
    if (insn.operands[1] != 0)
        print("{}.u32 + ", r(insn.operands[1]));
    println("{}.u32));", r(insn.operands[2]));
    break;

Edit: Fixed PPC_INST_LHBRX

AllanCat avatar May 27 '25 12:05 AllanCat

Don't forget to use this file: https://github.com/gaiden-dev/XenonRecomp/blob/main/XenonRecomp/recompiler.cpp. Also comment #icnlude simde_wrapper.h and /* */ commit one function which use it(you can work without it) and if it need add #include , if this BSO, BSO, BNS, BNSLR don't work. They useful, I use his function in my project. This just some additional info

testdriveupgrade avatar Jun 07 '25 11:06 testdriveupgrade