On Sat, 3 Jul 2010, Shinya Kuribayashi wrote: > Ok, now I've come to the same conclusion. Revised patch will be like > this. Malta is a development platform supporting various types of > MIPS32/MIPS64 cores, hence use cpu_has_clo_clz directly. The same goes > to MIPSSim. Malta also supports a couple of MIPS IV processors too, so please be careful about such assumptions. > + if (__builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) { > + int x; > + __asm__( > + " .set push \n" > + " .set mips32 \n" > + " clz %0, %1 \n" > + " .set pop \n" > + : "=r" (x) > + : "r" (pending)); > + > + return -x + 31 - CAUSEB_IP; > + } Hmm, ".set mips32" looks dodgy here. For pre-MIPS32/64 platforms this code should never make it to the assembler and if it did, then a build-time error is better than a run-time problem. It might be simpler just to use __builtin_ffs() for this variant though. Inline assembly is better avoided unless absolutely required. Not even mentioning readability. Maciej