Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- From: "H. Peter Anvin" <hpa@xxxxxxxxx>
- Date: Mon, 01 Feb 2010 11:06:08 -0800
- Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, mingo@xxxxxxxxxx, eranian@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxx, linux-tip-commits@xxxxxxxxxxxxxxx
- In-reply-to: <1265028224.24455.154.camel@laptop>
- References: <20100122155535.797688466@xxxxxxxxx> <tip-9f41699ed067fa695faff8e2e9981b2550abec62@xxxxxxxxxxxxxx> <20100129020128.716af8fb.akpm@xxxxxxxxxxxxxxxxxxxx> <1264763023.4283.2213.camel@laptop> <4B636646.50605@xxxxxxxxx> <1264868891.24455.76.camel@laptop> <1265028224.24455.154.camel@laptop>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc12 Thunderbird/3.0.1
On 02/01/2010 04:43 AM, Peter Zijlstra wrote:
>
> The below does work, but is still a tad ugly in that if you want to use
> any of the HWEIGHT functions that use BUILD_BUG_ON_ZERO() you have to
> have included linux/kernel.h yourself.
>
> But at least it builds on x86_64, alpha and sparc64 (didn't have a ia64
> compiler around).
>
> FWIW I was tempted to change the return type of hweight64() from
> unsigned long to unsigned int, its not as if it'll ever return a value
> larger than 64.
>
That might generate worse code in some cases, though (something that
needs it as a 64-bit value would have to extend it unnecessarily), but
probably the easiest is to just compile and see what happens.
x86 also has a POPCNT instruction now, which we should be able to use
via alternatives. That's something to do after your cleanup is in.
Anyway, I like the cleanup.
Acked-by: H. Peter Anvin <hpa@xxxxxxxxx>
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
- References:
- [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- From: tip-bot for Peter Zijlstra
- Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]