Re: Using POPCNT and other advanced bit manipulation instructions - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Using POPCNT and other advanced bit manipulation instructions
Date
Msg-id 20190215145425.GA32071@alvherre.pgsql
Whole thread Raw
In response to Re: Using POPCNT and other advanced bit manipulation instructions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Using POPCNT and other advanced bit manipulation instructions
List pgsql-hackers
On 2019-Feb-14, Tom Lane wrote:

> Then the correct test to see if we want to build pg_popcount.c (BTW,
> please pick a less generic name for that) and the choose function
> is whether we have *both* HAVE__BUILTIN_POPCOUNT and nonempty
> CFLAGS_POPCNT.

I used pg_bitutils_sse42.c to host the specially-compiled functions.
The name is not entirely correct, but seems clear enough.

I noticed in Compiler Explorer that some (ancient?) Power cpus
implement instruction "popcntb", and GCC support for those uses
-mpopcntb switch enabling __builtin_popcount() to use it.  I added the
switch to configure.in but I'm not sure how well that will work ...  I
don't know if this is represented in buildfarm.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Using POPCNT and other advanced bit manipulation instructions
Next
From: Tom Lane
Date:
Subject: Re: Reporting script runtimes in pg_regress