[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121127014505.GB25222@thunk.org>
Date: Mon, 26 Nov 2012 20:45:05 -0500
From: Theodore Ts'o <tytso@....edu>
To: Zach Brown <zab@...bo.net>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 3/6 -v3] libext2fs: add ext2fs_bitcount() function
On Mon, Nov 26, 2012 at 03:17:45PM -0800, Zach Brown wrote:
> > This function efficiently counts the number of bits in a block of
> > memory.
>
> Would it be worth the annoying build- and run-time machinery to detect
> and use the -msse4.2 __builtin_popcount() gcc intrinsic?
I thought about doing it, but I was in a bit of a hurry implementing
this patch set, and I wasn't even sure how to correctly implement the
build- and run-time machinery (i.e., detecting whether the gcc you're
compiling with supports __builtin_popcount, and implementing a
run-time fallback is the CPU doesn't support popcount instruction ---
which by the way isn't properly part of SSE 4.2; it has its own
separate CPUID bit, IIRC). Is there some userspace application
licensed under LGPLv2 which does this cleanly from which I could
borrow code?
I suppose I should first check and see how much difference it makes to
with a hard-coded use __builtin_popcnt(). If it makes a sufficiently
large improvement, it's probably worth the hair of implementing the
fallback machinery.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists