public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>,
	Torvald Riegel <triegel@redhat.com>
Cc: <nd@arm.com>, Gabriel Paubert <paubert@iram.es>,
	"Bin Fan@Work"	<bin.x.fan@oracle.com>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: GCC libatomic ABI specification draft
Date: Tue, 20 Dec 2016 13:58:00 -0000	[thread overview]
Message-ID: <58593903.4020508@arm.com> (raw)
In-Reply-To: <20161220132658.30E8E103E6E@oc8523832656.ibm.com>

On 20/12/16 13:26, Ulrich Weigand wrote:
> Torvald Riegel wrote:
>> On Fri, 2016-12-02 at 12:13 +0100, Gabriel Paubert wrote:
>>> On Thu, Dec 01, 2016 at 11:13:37AM -0800, Bin Fan at Work wrote:
>>>> Thanks for the comment. Yes, the ABI requires libatomic must query the hardware. This is 
>>>> necessary if we want the compiler to generate inlined code for 16-byte atomics. Note that 
>>>> this particular issue only affects x86. 
>>>
>>> Why? Power (at least recent ones) has 128 bit atomic instructions
>>> (lqarx/stqcx.) and Z has 128 bit compare and swap. 
>>
>> That's not the only factor affecting whether cmpxchg16b or such is used
>> for atomics.  If the HW just offers a wide CAS but no wide atomic load,
>> then even an atomic load is not truly just a load, which breaks (1)
>> atomic loads on read-only mapped memory and (2) volatile atomic loads
>> (unless we claim that an idempotent store is like a load, which is quite
>> a stretch for volatile I think).
> 
> I may have missed the context of the discussion, but just on the
> specific ISA question here: both Power and z not only have the
> 16-byte CAS (or load-and-reserve/store-conditional), but they also both
> have specific 16-byte atomic load and store instructions (lpq/stpq
> on z, lq/stq on Power).
> 
> Those are available on any system supporting z/Architecture (z900 and up),
> and on any Power system supporting the V2.07 ISA (POWER8 and up).  GCC
> does in fact use those instructions to implement atomic operations on
> 16-byte data types on those machines.

that's a bug.

at least i don't see how gcc makes sure the libatomic
calls can interoperate with inlined atomics.

  reply	other threads:[~2016-12-20 13:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cbd2c83a-b50b-b2ac-b62d-b2d26178c2b1@oracle.com>
2016-07-06 17:50 ` Fwd: Re: GCC libatomic questions Richard Henderson
2016-07-06 19:41   ` Richard Henderson
2016-07-07 23:56     ` Bin Fan
     [not found]       ` <ac2d60ed-a659-f018-1f11-63fa8f5847f5@oracle.com>
     [not found]         ` <1470412312.14544.4.camel@localhost.localdomain>
     [not found]           ` <4a182edd-41a8-4ad9-444a-bf0af567ae98@oracle.com>
     [not found]             ` <8317ec9d-41ad-d806-9144-eac2984cdd38@oracle.com>
2016-11-17 20:12               ` GCC libatomic ABI specification draft Bin Fan
2016-11-29 11:12                 ` Szabolcs Nagy
2016-12-01 19:14                   ` Bin Fan at Work
2016-12-02 11:13                     ` Gabriel Paubert
2016-12-19 16:33                       ` Torvald Riegel
2016-12-20 13:27                         ` Ulrich Weigand
2016-12-20 13:58                           ` Szabolcs Nagy [this message]
2016-12-22 14:29                             ` Ulrich Weigand
2016-12-22 17:38                               ` Segher Boessenkool
2017-01-04 11:25                                 ` Szabolcs Nagy
2017-01-19 15:18                                 ` Torvald Riegel
2017-01-17 17:00                 ` Torvald Riegel
2017-01-18 22:23                   ` Richard Henderson
2017-01-19 15:02                     ` Torvald Riegel
2017-01-20 13:42                     ` Michael Matz
2017-01-20 17:17                       ` Richard Henderson
2017-01-23 14:00                         ` Michael Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58593903.4020508@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=bin.x.fan@oracle.com \
    --cc=gcc@gcc.gnu.org \
    --cc=nd@arm.com \
    --cc=paubert@iram.es \
    --cc=triegel@redhat.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).