Use __builtin_clz instead of __lzcnt32 for cntlzw instruction.

This commit is contained in:
Skyth 2025-01-23 14:35:46 +03:00
parent 3280a7cf9f
commit 73b75e197a

View File

@ -688,11 +688,11 @@ bool Recompiler::Recompile(
break;
case PPC_INST_CNTLZD:
println("\t{}.u64 = __lzcnt64({}.u64);", r(insn.operands[0]), r(insn.operands[1]));
println("\t{0}.u64 = {1}.u64 == 0 ? 64 : __builtin_clzll({1}.u64);", r(insn.operands[0]), r(insn.operands[1]));
break;
case PPC_INST_CNTLZW:
println("\t{}.u64 = __lzcnt32({}.u32);", r(insn.operands[0]), r(insn.operands[1]));
println("\t{0}.u64 = {1}.u32 == 0 ? 32 : __builtin_clz({1}.u32);", r(insn.operands[0]), r(insn.operands[1]));
break;
case PPC_INST_DB16CYC: