Skip to content

Commit 73b75e1

Browse files
Use __builtin_clz instead of __lzcnt32 for cntlzw instruction.
1 parent 3280a7c commit 73b75e1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

XenonRecomp/recompiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,11 @@ bool Recompiler::Recompile(
688688
break;
689689

690690
case PPC_INST_CNTLZD:
691-
println("\t{}.u64 = __lzcnt64({}.u64);", r(insn.operands[0]), r(insn.operands[1]));
691+
println("\t{0}.u64 = {1}.u64 == 0 ? 64 : __builtin_clzll({1}.u64);", r(insn.operands[0]), r(insn.operands[1]));
692692
break;
693693

694694
case PPC_INST_CNTLZW:
695-
println("\t{}.u64 = __lzcnt32({}.u32);", r(insn.operands[0]), r(insn.operands[1]));
695+
println("\t{0}.u64 = {1}.u32 == 0 ? 32 : __builtin_clz({1}.u32);", r(insn.operands[0]), r(insn.operands[1]));
696696
break;
697697

698698
case PPC_INST_DB16CYC:

0 commit comments

Comments
 (0)