From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix compiler builtin usage in new pg_bitutils.c
Date: Fri, 15 Feb 2019 23:30:33 -0500
Message-ID: <31413.1550291433@sss.pgh.pa.us> (raw)
In-Reply-To: <20190215201804.GA791@alvherre.pgsql>
References: <20190215201804.GA791@alvherre.pgsql>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> (BTW, my reading of the articles I cited, as well as my own runs of the
> test programs therein, suggest that in order to get a really good
> performance improvement you need to hand-code calls to the POPCNT
> instruction in assembly rather than rely on the compiler intrinsics.
That observation led me to think about using asm() instead of
__builtin_popcount + -mpopcnt, and I realized there are several
fewer moving parts if we do it that way: we don't need to worry
about the compiler switch, and we don't need to rely on faith that
it actually changes the emitted code, and we don't need a separate
source file to limit the scope of the switch. And really, requiring
__builtin_popcount + -mpopcnt is pretty much restricting the
optimization to GCC-alikes anyway, so requiring asm() probably
doesn't eliminate any toolchains that would've handled the other way.
Hence, I made it work like that. Committed with that and some cosmetic
cleanups.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com
Subject: Re: pgsql: Fix compiler builtin usage in new pg_bitutils.c
In-Reply-To: <31413.1550291433@sss.pgh.pa.us>
References: <20190215201804.GA791@alvherre.pgsql> <31413.1550291433@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox