public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/51766] [4.7 regression] sync_fetch_and_xxx atomicity
Date: Tue, 10 Jan 2012 09:43:00 -0000	[thread overview]
Message-ID: <bug-51766-4-CK1bX4fMYc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51766-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51766

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-10 09:43:16 UTC ---
(In reply to comment #3)
> > It says above them "In most cases, these
> > builtins are considered a full barrier." and only __sync_lock_test_and_set and
> > __sync_lock_release specify different barrier semantics.
> 
> The next sentence is:
> 
> "That is, no memory operand will be moved across the operation, either forward
> or
> backward."
> 
> Note that this refers to memory operands, not memory operations -- memory
> stores and memory loads referenced in documentation of the other sync builtins.
>  In other words, one could interpret "full memory barrier" as:
> 
> asm volatile ("" : : : "memory");
> 
> that refers to a GCC scheduling barrier.
> 
> The GCC documentation references Intel processors, which do not have have a
> distinction between instructions for RELEASE, ACQ_REL and SEQ_CST semantics.
> 
> The basic problem is that the GCC builtins and atomic instruction semantics
> were designed for Intel processors that do not provide the level of granularity
> implemented in POWER processors.  The POWER port implemented lighter weight
> ACQ_REL semantics. Retrofitting the original builtins on the new C++11 memory
> model semantics and imposing SEQ_CST interpretation has changed the behavior
> and performance on POWER, but not on other targets.

But for more precise semantics we now have the __atomic_* builtins, right?
And the __sync_* ones are deprecated.  I don't see how we can preserve
old behavior for the __sync_* ones without adding a new target hook.
The documentation would need to be adjusted, of course, I'm not sure
that different atomic semantics are "useful" for these "portable"
synchronization primitives?

Thus, fixing the libstdc++ side seems worthwhile, but I'm not sure
with respect to the deprecated __sync builtins?


  parent reply	other threads:[~2012-01-10  9:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 15:01 [Bug middle-end/51766] New: " dje at gcc dot gnu.org
2012-01-05 15:02 ` [Bug middle-end/51766] " dje at gcc dot gnu.org
2012-01-09 15:40 ` rguenth at gcc dot gnu.org
2012-01-09 15:45 ` redi at gcc dot gnu.org
2012-01-09 16:51 ` dje at gcc dot gnu.org
2012-01-10  9:43 ` rguenth at gcc dot gnu.org [this message]
2012-01-10 14:40 ` dje at gcc dot gnu.org
2012-01-10 14:49 ` rguenth at gcc dot gnu.org
2012-01-10 15:31 ` redi at gcc dot gnu.org
2012-01-10 18:09 ` dje at gcc dot gnu.org
2012-01-10 18:20 ` redi at gcc dot gnu.org
2012-01-10 18:24 ` redi at gcc dot gnu.org
2012-01-10 18:34 ` dje at gcc dot gnu.org
2012-01-10 18:47 ` jakub at gcc dot gnu.org
2012-01-10 19:14 ` amacleod at redhat dot com
2012-01-10 20:26 ` dje at gcc dot gnu.org
2012-01-12 20:41 ` dje at gcc dot gnu.org

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=bug-51766-4-CK1bX4fMYc@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).