Prev: [PATCH] Warn on unnecessary spaces before quoted newlines
Next: Possible NULL pointer dereference in m32r
From: Andrew Morton on 1 Feb 2010 15:50 On Sat, 30 Jan 2010 17:45:17 +0800 Wu Fengguang <fengguang.wu(a)intel.com> wrote: > This allows use of hweight_long() in BUILD_BUG_ON(). > Suggested by Jamie. > > CC: Jamie Lokier <jamie(a)shareable.org> > CC: Roland Dreier <rdreier(a)cisco.com> > Signed-off-by: Wu Fengguang <fengguang.wu(a)intel.com> > --- > include/linux/bitops.h | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > --- linux-mm.orig/include/linux/bitops.h 2009-07-20 20:10:19.000000000 +0800 > +++ linux-mm/include/linux/bitops.h 2010-01-30 17:41:15.000000000 +0800 > @@ -40,10 +40,14 @@ static __inline__ int get_count_order(un > return order; > } > > -static inline unsigned long hweight_long(unsigned long w) > -{ > - return sizeof(w) == 4 ? hweight32(w) : hweight64(w); > -} > +#define hweight_long(x) \ > +( \ > + __builtin_constant_p(x) ? \ > + __builtin_popcountl(x) : \ > + (sizeof(x) <= 4 ? \ > + hweight32(x) : \ > + hweight64(x)) \ > +) > > /** > * rol32 - rotate a 32-bit value left Peter's been mucking with a compile-time HWEIGHT(). An outdated version of that is presently in linux-next. (I wonder if it could have used __builtin_popcount) (I wonder which gcc versions support __builtin_popcount) Anyway, I suspect you should be using that rather than tweaking hweight_long(). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on 3 Feb 2010 10:20 On Wed, 2010-02-03 at 07:08 -0800, Andrew Morton wrote: > On Wed, 3 Feb 2010 21:39:51 +0800 Wu Fengguang <fengguang.wu(a)intel.com> wrote: > > > Is there an official lowest GCC version that Linux supports? > > Documentation/Changes says gcc-3.2. Anyway, its not like that macro I used isn't straight forward. Not much a builtin can do better. The only benefit the builtin has is possibly use machine popcnt instructions but we already deal with that in the kernel. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on 3 Feb 2010 10:20 On Wed, 3 Feb 2010 21:39:51 +0800 Wu Fengguang <fengguang.wu(a)intel.com> wrote: > Is there an official lowest GCC version that Linux supports? Documentation/Changes says gcc-3.2. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on 3 Feb 2010 10:50 On Wed, 2010-02-03 at 07:42 -0800, Andrew Morton wrote: > On Wed, 03 Feb 2010 16:15:57 +0100 Peter Zijlstra <peterz(a)infradead.org> wrote: > > > On Wed, 2010-02-03 at 07:08 -0800, Andrew Morton wrote: > > > On Wed, 3 Feb 2010 21:39:51 +0800 Wu Fengguang <fengguang.wu(a)intel.com> wrote: > > > > > > > Is there an official lowest GCC version that Linux supports? > > > > > > Documentation/Changes says gcc-3.2. > > > > Anyway, its not like that macro I used isn't straight forward. Not much > > a builtin can do better. > > > > The only benefit the builtin has is possibly use machine popcnt > > instructions but we already deal with that in the kernel. > > We didn't deal with it on every architecture, which is something which > the compiler extension takes care of. > > In fact I can't find anywhere where we dealt with it on x86. >From what I know the popcnt ins on x86 is relatively new, hpa was going to look at supporting it using alternatives. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on 3 Feb 2010 10:50 On Wed, 03 Feb 2010 16:15:57 +0100 Peter Zijlstra <peterz(a)infradead.org> wrote: > On Wed, 2010-02-03 at 07:08 -0800, Andrew Morton wrote: > > On Wed, 3 Feb 2010 21:39:51 +0800 Wu Fengguang <fengguang.wu(a)intel.com> wrote: > > > > > Is there an official lowest GCC version that Linux supports? > > > > Documentation/Changes says gcc-3.2. > > Anyway, its not like that macro I used isn't straight forward. Not much > a builtin can do better. > > The only benefit the builtin has is possibly use machine popcnt > instructions but we already deal with that in the kernel. We didn't deal with it on every architecture, which is something which the compiler extension takes care of. In fact I can't find anywhere where we dealt with it on x86. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Next
|
Last
Pages: 1 2 3 4 5 6 Prev: [PATCH] Warn on unnecessary spaces before quoted newlines Next: Possible NULL pointer dereference in m32r |