[PATCH] powerpc: emulate power5 popcntb instruction
Kumar Gala
galak at kernel.crashing.org
Sat Aug 19 05:42:16 EST 2006
>
> +static int emulate_popcntb_inst(struct pt_regs *regs, u32 instword)
> +{
> + u32 ra,rs;
> + unsigned long tmp;
> +
> + ra = (instword >> 16) & 0x1f;
> + rs = (instword >> 21) & 0x1f;
> +
> + tmp = regs->gpr[rs];
> + tmp = tmp - ((tmp >> 1) & 0x5555555555555555);
> + tmp = (tmp & 0x3333333333333333) + ((tmp >> 2) &
> 0x3333333333333333);
> + tmp = (tmp + (tmp >> 4)) & 0x0f0f0f0f0f0f0f0f;
> + regs->gpr[ra] = tmp;
> +
> + return 0;
> +}
This is going to give warnings on ppc32 kernel compiles, maybe
something like:
(unsigned long) 0x5555555555555555ull
- kumar
More information about the Linuxppc-dev
mailing list