public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tuliom at linux dot vnet.ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67281] HTM builtins aren't treated as compiler barriers on powerpc
Date: Wed, 19 Aug 2015 19:07:00 -0000 [thread overview]
Message-ID: <bug-67281-4-dspjAvbBYa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67281-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67281
--- Comment #4 from Tulio Magno Quites Machado Filho <tuliom at linux dot vnet.ibm.com> ---
(In reply to Andrew Pinski from comment #3)
> Since there are no stores, the load seems like it can be pulled out of the
> loop too.
I disagree with you.
If I use the value of dest to take a decision inside the transaction, I need
the memory barrier before the access to *src0.
Here's an example:
long
foo (long dest, long *src0, long src1, long tries)
{
long i;
for (i = 0; i < tries; i++)
{
__builtin_tbegin (0);
dest = *src0 + src1;
if (dest == 13)
__builtin_tabort(0);
__builtin_tend (0);
}
return dest;
}
In other words, if you access *src0 before the memory barrier, its value may
change when the memory barrier is created. This is particularly useful if dest
says if a lock has been acquired by another thread or not.
For the reference, this has been found in glibc source code:
https://sourceware.org/ml/libc-alpha/2015-07/msg00986.html
next prev parent reply other threads:[~2015-08-19 19:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 17:22 [Bug target/67281] New: " tuliom at linux dot vnet.ibm.com
2015-08-19 17:52 ` [Bug target/67281] " pinskia at gcc dot gnu.org
2015-08-19 18:43 ` tuliom at linux dot vnet.ibm.com
2015-08-19 18:51 ` pinskia at gcc dot gnu.org
2015-08-19 19:07 ` tuliom at linux dot vnet.ibm.com [this message]
2015-08-23 12:27 ` torvald at gcc dot gnu.org
2015-10-15 16:39 ` bergner at gcc dot gnu.org
2015-10-15 16:40 ` bergner at gcc dot gnu.org
2015-10-15 16:44 ` bergner 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-67281-4-dspjAvbBYa@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).