public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "andi-gcc at firstfloor dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/55966] New: __atomic_fetch_* generate wrong code for HLE
Date: Mon, 14 Jan 2013 06:11:00 -0000	[thread overview]
Message-ID: <bug-55966-4@http.gcc.gnu.org/bugzilla/> (raw)


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

             Bug #: 55966
           Summary: __atomic_fetch_* generate wrong code for HLE
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: andi-gcc@firstfloor.org
            Target: x86_64-linux


__atomic_fetch_(and|xor|or|nand) sometimes generate a cmpxchg loop instead of
the direct instruction. nand always does that because there is no x86 nand 
The others can in principle generate direct instructions, and do, but not
always.

When specifying __ATOMIC_HLE_RELEASE or ACQUIRE the HLE prefix is not
generated.
Also when the CMPXCHG loop is generated it would be needed to put a PAUSE for
the unsuccessfull path, otherwise poor performance will happen.

Generating correct code for a CMPXCHG HLE loop is tricky and it may be better
to forbid the nand case. But for others which can be implemented as a single
atomic operations it would be better to ensure they always do that instead of
falling back to cmpxchg.

Testcase TBD.


             reply	other threads:[~2013-01-14  6:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14  6:11 andi-gcc at firstfloor dot org [this message]
2013-01-14 19:06 ` [Bug target/55966] " andi-gcc at firstfloor dot org
2013-01-14 19:52 ` andi-gcc at firstfloor dot org
2013-01-14 20:15 ` andi-gcc at firstfloor dot org
2013-01-14 21:22 ` ubizjak at gmail dot com
2013-01-14 21:25 ` ubizjak at gmail dot com
2013-01-14 22:05 ` andi-gcc at firstfloor dot org
2013-01-14 22:23 ` amacleod at redhat dot com
2013-01-14 22:32 ` andi-gcc at firstfloor dot org
2013-01-14 22:34 ` andi-gcc at firstfloor dot org
2024-04-09  2:58 ` pinskia 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-55966-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: 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).