lkml.org 
[lkml]   [2011]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[70/90] sparc: Use hweight64() in popc emulation.
    3.0-stable review patch.  If anyone has any objections, please let us know.

    ------------------


    From: "David S. Miller" <davem@davemloft.net>

    [ Upstream commit d600cbed0fe8fceec04500824f638dfe4996c653 ]

    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    arch/sparc/kernel/unaligned_64.c | 15 ++++-----------
    1 file changed, 4 insertions(+), 11 deletions(-)

    --- a/arch/sparc/kernel/unaligned_64.c
    +++ b/arch/sparc/kernel/unaligned_64.c
    @@ -22,6 +22,7 @@
    #include <linux/bitops.h>
    #include <linux/perf_event.h>
    #include <linux/ratelimit.h>
    +#include <linux/bitops.h>
    #include <asm/fpumacro.h>

    enum direction {
    @@ -373,16 +374,11 @@ asmlinkage void kernel_unaligned_trap(st
    }
    }

    -static char popc_helper[] = {
    -0, 1, 1, 2, 1, 2, 2, 3,
    -1, 2, 2, 3, 2, 3, 3, 4,
    -};
    -
    int handle_popc(u32 insn, struct pt_regs *regs)
    {
    - u64 value;
    - int ret, i, rd = ((insn >> 25) & 0x1f);
    int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
    + int ret, rd = ((insn >> 25) & 0x1f);
    + u64 value;

    perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
    if (insn & 0x2000) {
    @@ -392,10 +388,7 @@ int handle_popc(u32 insn, struct pt_regs
    maybe_flush_windows(0, insn & 0x1f, rd, from_kernel);
    value = fetch_reg(insn & 0x1f, regs);
    }
    - for (ret = 0, i = 0; i < 16; i++) {
    - ret += popc_helper[value & 0xf];
    - value >>= 4;
    - }
    + ret = hweight64(value);
    if (rd < 16) {
    if (rd)
    regs->u_regs[rd] = ret;



    \
     
     \ /
      Last update: 2011-08-14 18:15    [W:0.019 / U:1.032 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site