Re: [PATCH] powerpc: emulate power5 popcntb instruction
From: <hidden>
Date: 2006-08-19 18:56:46
From: <hidden>
Date: 2006-08-19 18:56:46
quoted
+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
Nah, just make "tmp" an u64. And/or don't do this emulation on 32-bit machines at all. And if the compiler warns about the non-qualified constants -- well, we should compile with -std=gnu99 anyway, eh? Segher