public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "yvan.roux at linaro dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55492] New: __atomic_load doesn't match ACQUIRE memory model Date: Tue, 27 Nov 2012 16:13:00 -0000 [thread overview] Message-ID: <bug-55492-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55492 Bug #: 55492 Summary: __atomic_load doesn't match ACQUIRE memory model Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: yvan.roux@linaro.org Created attachment 28796 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28796 Generic expansion patch proposal Compiling this code for ARMv7 int v; int foo() { return __atomic_load_n (&v, __ATOMIC_ACQUIRE); } generates a data memory barrier defore the load: foo: movw r3, #:lower16:v movt r3, #:upper16:v dmb sy ldr r0, [r3, #0] bx lr But, the `Acquire’ semantics imply that no reads in the current thread dependent on the value currently loaded can be reordered before this load. Thus, the barrier needs to be after the load and not before. The issue seems to be in expand_atomic_load which put a memory fence before the load in any memory model. The attached patch fixes the problem.
next reply other threads:[~2012-11-27 16:13 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-27 16:13 yvan.roux at linaro dot org [this message] 2012-11-28 20:06 ` [Bug target/55492] " amacleod at redhat dot com 2012-11-29 9:51 ` yvan.roux at linaro dot org 2012-11-29 15:20 ` amacleod at redhat dot com 2012-12-13 21:01 ` rth at gcc dot gnu.org 2012-12-13 21:17 ` rth at gcc dot gnu.org 2012-12-13 21:18 ` rth at gcc dot gnu.org 2012-12-13 21:19 ` [Bug middle-end/55492] " rth at gcc dot gnu.org 2012-12-14 10:14 ` yvan.roux at linaro dot org 2012-12-14 15:33 ` amacleod at redhat dot com 2012-12-14 16:29 ` rth 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-55492-4@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: linkBe 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).