pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Using POPCNT and other advanced bit manipulation instructions
Date: Thu, 14 Feb 2019 21:22:08 -0300
Message-ID: <20190215002208.GA25042@alvherre.pgsql> (raw)
In-Reply-To: <4022.1550185074@sss.pgh.pa.us>

On 2019-Feb-14, Tom Lane wrote:

> I think we need a clean test for __builtin_popcount(), and to be willing
> to use it if available, independently of -mpopcnt.  Then separately we
> should test to see if -mpopcnt works, probably with the same
> infrastructure we use for checking for other compiler flags, viz
> 
>    # Optimization flags for specific files that benefit from vectorization
>    PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTOR, [-funroll-loops])
>    PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTOR, [-ftree-vectorize])
> +  # Optimization flags for bit-twiddling
> +  PGAC_PROG_CC_VAR_OPT(CFLAGS_POPCNT, [-mpopcnt])
>    # We want to suppress clang's unhelpful unused-command-line-argument warnings
> 
> 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.

Yeah, this works.  I'll post the patch tomorrow.

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




view thread (49+ messages)  latest in thread

Message-ID: <20190215002208.GA25042@alvherre.pgsql>
Permalink:  ../20190215002208.GA25042@alvherre.pgsql/
Also on:    postgresql.org/message-id/20190215002208.GA25042@alvherre.pgsql

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, andrew@tao11.riddles.org.uk, david.rowley@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Using POPCNT and other advanced bit manipulation instructions
  In-Reply-To: <20190215002208.GA25042@alvherre.pgsql>

* 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