From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: [PATCH 2/5] bitops: compile time optimization for hweight_long(CONSTANT) Date: Wed, 03 Feb 2010 09:10:19 -0800 Message-ID: <4B69ADFB.9070502@zytor.com> References: <20100130094515.475881280@intel.com> <20100130094957.692671259@intel.com> <20100201124825.cc024f2a.akpm@linux-foundation.org> <20100203133951.GA24357@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Andrew Morton , LKML , Jamie Lokier , Roland Dreier , Al Viro , "linux-fsdevel@vger.kernel.org" , Ingo Molnar , Peter Zijlstra To: Wu Fengguang Return-path: Received: from terminus.zytor.com ([198.137.202.10]:46258 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757427Ab0BCRLx (ORCPT ); Wed, 3 Feb 2010 12:11:53 -0500 In-Reply-To: <20100203133951.GA24357@localhost> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 02/03/2010 05:39 AM, Wu Fengguang wrote: > >> (I wonder if it could have used __builtin_popcount) >> >> (I wonder which gcc versions support __builtin_popcount) > I think 4.0 or later, but it often generates calls to libgcc, which would mean adding libgcc functions to the kernel (which some arches already do.) > This is how Jamie Lokier first recommended it to me: > > Checked GCC 3.4.3 / 4.1 / 4.4: It expands as a compile-time > constant if the argument is a compile-time constant, so can be > used in BUILD_BUG_ON() and even for array sizes etc. > > Is there an official lowest GCC version that Linux supports? 3.4, I believe. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.