postgresql/src/tools
Tom Lane 02a6a54ecd Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT.
Test for the compiler builtins __builtin_clz, __builtin_ctz, and
__builtin_popcount, and make use of these in preference to
handwritten C code if they're available.  Create src/port
infrastructure for "leftmost one", "rightmost one", and "popcount"
so as to centralize these decisions.

On x86_64, __builtin_popcount generally won't make use of the POPCNT
opcode because that's not universally supported yet.  Provide code
that checks CPUID and then calls POPCNT via asm() if available.
This requires indirecting through a function pointer, which is
an annoying amount of overhead for a one-instruction operation,
but it's probably not worth working harder than this for our
current use-cases.

I'm not sure we've found all the existing places that could profit
from this new infrastructure; but we at least touched all the
ones that used copied-and-pasted versions of the bitmapset.c code,
and got rid of multiple copies of the associated constant arrays.

While at it, replace c-compiler.m4's one-per-builtin-function
macros with a single one that can handle all the cases we need
to worry about so far.  Also, because I'm paranoid, make those
checks into AC_LINK checks rather than just AC_COMPILE; the
former coding failed to verify that libgcc has support for the
builtin, in cases where it's not inline code.

David Rowley, Thomas Munro, Alvaro Herrera, Tom Lane

Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com
2019-02-15 23:22:33 -05:00
..
editors Make Emacs perl-mode indent more like perltidy. 2019-01-13 11:32:31 -08:00
findoidjoins Create the infrastructure for planner support functions. 2019-02-09 18:08:48 -05:00
ifaddrs Update copyright for 2019 2019-01-02 12:44:25 -05:00
make_diff Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
msvc Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT. 2019-02-15 23:22:33 -05:00
perlcheck Fix whitespace 2018-06-27 08:03:54 +02:00
pginclude Don't fall off the end of perl functions 2018-05-27 09:08:42 -04:00
pgindent Change function call information to be variable length. 2019-01-26 14:17:52 -08:00
FAQ2txt Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
PerfectHash.pm Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
RELEASE_CHANGES Doc: in each release branch, keep only that branch's own release notes. 2019-02-04 19:18:49 -05:00
ccsym tools/ccsym: update for modern versions of gcc 2015-01-20 13:02:58 -05:00
check_bison_recursion.pl Update copyright for 2019 2019-01-02 12:44:25 -05:00
codelines Fix remaining stray references to CVS. 2010-09-22 19:51:39 -04:00
copyright.pl Update copyright for 2019 2019-01-02 12:44:25 -05:00
find_badmacros Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
find_static Fix omission of -X (--no-psqlrc) in some psql invocations. 2015-12-28 11:46:43 -05:00
find_typedef Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
fix-old-flex-code.pl Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
gen_keywordlist.pl Fix perl searchpath for gen_keywordlist.pl 2019-02-07 11:14:29 -05:00
git-external-diff Preserve information on use of git-external-diff 2018-05-24 23:45:31 +09:30
git_changelog Stamp HEAD as 12devel 2018-06-30 12:47:59 -04:00
make_ctags Improve missing-program error handling in make_ctags and make_etags. 2019-01-13 13:33:50 -05:00
make_etags Improve missing-program error handling in make_ctags and make_etags. 2019-01-13 13:33:50 -05:00
make_mkid Add another pgdefine path check, and a cvs-git change. 2011-08-26 21:52:35 -04:00
pgtest pgtest: run clean, build, and check stages separately 2018-07-28 15:34:06 -04:00
testint128.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
valgrind.supp Revert "Add valgrind suppressions for wcsrtombs optimizations" 2019-01-19 20:49:51 +01:00
version_stamp.pl Update copyright for 2019 2019-01-02 12:44:25 -05:00
win32tzlist.pl Update copyright for 2019 2019-01-02 12:44:25 -05:00