https://bugs.kde.org/show_bug.cgi?id=507033
--- Comment #4 from Florian Krohm <flo2...@eich-krohm.de> --- Created attachment 183457 --> https://bugs.kde.org/attachment.cgi?id=183457&action=edit Patch for nanomips There are 2 occurrences of Iop_Clz32. #1 for the CLZ insn: case nano_POOL32Axf4_CLZ: { /* clz */ DIP("clz r%u, r%u", rt, rs); putIReg(rt, unop(Iop_Clz32, getIReg(rs))); break; } This what happens: CLZ insn --ir--> Iop_Clz32 --isel--> NMun_CLZ --emit--> CLZ The CLZ insn has no special behaviour when the input is 0. Using Iop_Clz32 is not the right choice then as it has an undefined result for a 0 input. This all works out, though, because in the end a CLZ insn will be emitted. So we can simply change Iop_Clz64 --> Iop_ClzNat64 and be done here. #2 for the CLO insn: case nano_POOL32Axf4_CLO: { /* clo */ DIP("clo r%u, r%u", rt, rs); t1 = newTemp(Ity_I1); assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff))); putIReg(rt, IRExpr_ITE(mkexpr(t1), mkU32(0x00000020), unop(Iop_Clz32, unop(Iop_Not32, getIReg(rs))))); break; } The special case is not needed because Clz32(0) == 32; case nano_POOL32Axf4_CLO: { /* clo */ DIP("clo r%u, r%u", rt, rs); putIReg(rt, unop(Iop_Clz32, unop(Iop_Not32, getIReg(rs))))); break; } Done. -- You are receiving this mail because: You are watching all bug changes.