pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Use more of gcc's __sync_fetch_and_xxx builtin functions for ato
Date: Wed, 06 Sep 2017 18:21:53 +0000
Message-ID: <E1dpexV-0002qO-I3@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Use more of gcc's __sync_fetch_and_xxx builtin functions for atomic ops.

In addition to __sync_fetch_and_add, gcc offers __sync_fetch_and_sub,
__sync_fetch_and_and, and __sync_fetch_and_or, which correspond directly
to primitive atomic ops that we want.  Testing shows that in some cases
they generate better code than our generic implementations, so use them.

We've assumed that configure's test for __sync_val_compare_and_swap is
sufficient to allow assuming that __sync_fetch_and_add is available, so
make the same assumption for these functions.  Should that prove to be
wrong, we can add more configure tests.

Yura Sokolov, reviewed by Jesper Pedersen and myself

Discussion: https://postgr.es/m/7f65886daca545067f82bf2b463b218d@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e09db94c0a5f3b440d96c5c9e8e6c1638d1ec39f

Modified Files
--------------
src/include/port/atomics/generic-gcc.h | 58 ++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1dpexV-0002qO-I3@gemulon.postgresql.org>
Permalink:  ../E1dpexV-0002qO-I3@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dpexV-0002qO-I3@gemulon.postgresql.org

 · 

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 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
  Subject: Re: pgsql: Use more of gcc's __sync_fetch_and_xxx builtin functions for ato
  In-Reply-To: <E1dpexV-0002qO-I3@gemulon.postgresql.org>
  References: <E1dpexV-0002qO-I3@gemulon.postgresql.org>

* 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