From owner-svn-src-all@FreeBSD.ORG Mon Feb 9 22:27:46 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:1900:2254:206a::19:2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBC6D968; Mon, 9 Feb 2015 22:27:46 +0000 (UTC) Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx2.freebsd.org (Postfix) with ESMTP id 73E658F3; Mon, 9 Feb 2015 22:27:46 +0000 (UTC) Message-ID: <54D93461.8010109@FreeBSD.org> Date: Mon, 09 Feb 2015 17:27:45 -0500 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r278474 - head/sys/sys References: <201502092103.t19L3OAn013792@svn.freebsd.org> <1698688.fEq0HxqPxg@ralph.baldwin.cx> <54D92CE8.1030803@FreeBSD.org> <3501684.yzo0NMkRZd@ralph.baldwin.cx> In-Reply-To: <3501684.yzo0NMkRZd@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2015 22:27:47 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 02/09/2015 17:12, John Baldwin wrote: > On Monday, February 09, 2015 04:55:52 PM Jung-uk Kim wrote: >> On 02/09/2015 16:08, John Baldwin wrote: >>> On Monday, February 09, 2015 09:03:24 PM John Baldwin wrote: >>>> Author: jhb Date: Mon Feb 9 21:03:23 2015 New Revision: >>>> 278474 URL: https://svnweb.freebsd.org/changeset/base/278474 >>>> >>>> Log: Use __builtin_popcnt() to implement a BIT_COUNT() >>>> operation for bitsets and use this to implement CPU_COUNT() >>>> to count the number of CPUs in a cpuset. >>>> >>>> MFC after: 2 weeks >>> >>> Yes, __builtin_popcnt() works with GCC 4.2. It should also >>> allow the compiler to DTRT in userland uses of this if -msse4.2 >>> is enabled. >> >> Back in 2012, when I submitted a similar patch, bde noted >> __builtin_popcount*() cannot be used with GCC 4.2 for *kernel* >> because it emits a library call. >> >> http://docs.freebsd.org/cgi/mid.cgi?20121116171923.L1135 >> >> FYI... > > Weird, I though I built a kernel with this in a tree that uses it > in the igb(4) driver. We need a CPU_COUNT() no matter what, but if > this emits a library call under GCC I will need to add the call. > We could also adopt your bitcount header, though I think it is more > consistent to keep the loop in BIT_COUNT() and use something that > emulates popcountl() rather than directly using bitcount() in > BIT_COUNT() (primarily because the rest of sys/bitset.h is > structured that way: explicit loops in sys/bitset.h itself). I think you should back it out for now and move the discussion to arch or hackers. I gave it up at the time but you may have better luck. :-) FYI, the following was the last version of my patch at the time. https://people.freebsd.org/~jkim/bitcount5.diff Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJU2TRdAAoJEHyflib82/FGUK8H/jnrTqxqw6k5mK2hL3jslBuK yAQKlfCV+pq3jJm6Ixqxk9vszZUwAMw02mPhxkHEPAB4vzZnnhH18u5cOrB1r7MA NFTva6UKoo5F00GO0yKyK9rGaHXxuoSGjdntEckYJuFxZ8Zh9K1dYIRXGW42f55c JEK9aU8uVtFTov8RF0pVGDqiezWJRGlTrftDwq8tUHfv8pJG2p0Z9rfLYsP1DTx2 fMcb7iz6IIQKO2aUYytXv8UdqkA2VtwOGrqC0nLTL4RF5bC5i61WHRJYxNWJ5+sV XQx9cXutkNIIj7IHIw2kpyvx0ynZGIN/jwpBy0d58aq3jv2wQhzk/F1ID51guNk= =uINd -----END PGP SIGNATURE-----