public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1
@ 2011-08-19  1:14 bonzini at gnu dot org
  2011-08-19  7:29 ` [Bug target/50123] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bonzini at gnu dot org @ 2011-08-19  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50123
           Summary: cmpxchg generated for atomic and with zero/or with -1
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bonzini@gnu.org


int x;
int f()
{
        return __sync_fetch_and_and(&x, 0);
}
int g()
{
        return __sync_fetch_and_or(&x, -1);
}

f and g can be optimized to atomic xchg on x86.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/50123] cmpxchg generated for atomic and with zero/or with -1
  2011-08-19  1:14 [Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1 bonzini at gnu dot org
@ 2011-08-19  7:29 ` jakub at gcc dot gnu.org
  2011-11-29 21:06 ` amacleod at redhat dot com
  2013-11-19 15:13 ` bonzini at gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-19  7:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-19 06:53:18 UTC ---
While we could do this on i?86/x86_64 now, it sounds better to do it in the
generic code (folding or expansion), but for that we need to wait for the
extended sync builtins that are currently brewing on cxx-mem-model branch
(because __sync_fetch_and_{and,or} are full barriers, while __sync_test_and_set
is not).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/50123] cmpxchg generated for atomic and with zero/or with -1
  2011-08-19  1:14 [Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1 bonzini at gnu dot org
  2011-08-19  7:29 ` [Bug target/50123] " jakub at gcc dot gnu.org
@ 2011-11-29 21:06 ` amacleod at redhat dot com
  2013-11-19 15:13 ` bonzini at gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amacleod at redhat dot com @ 2011-11-29 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> 2011-11-29 19:42:50 UTC ---
Author: amacleod
Date: Tue Nov 29 19:42:44 2011
New Revision: 181815

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181815
Log:
2011-11-29  Andrew MacLeod  <amacleod@redhat.com>

    PR target/50123
    * optabs.c (maybe_optimize_fetch_op): New.  Look for more optimal
    instructions for a FECTH_OP or OP_FECTH sequence.
    (expand_atomic_fetch_op): Call maybe_optimize_fetch_op.
    * testsuite/gcc.dg/atomic-op-optimize.c: New.  Test for optimizations.


Added:
    trunk/gcc/testsuite/gcc.dg/atomic-op-optimize.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/optabs.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/50123] cmpxchg generated for atomic and with zero/or with -1
  2011-08-19  1:14 [Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1 bonzini at gnu dot org
  2011-08-19  7:29 ` [Bug target/50123] " jakub at gcc dot gnu.org
  2011-11-29 21:06 ` amacleod at redhat dot com
@ 2013-11-19 15:13 ` bonzini at gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bonzini at gnu dot org @ 2013-11-19 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Bonzini <bonzini at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.8.2
         Resolution|---                         |FIXED

--- Comment #4 from Paolo Bonzini <bonzini at gnu dot org> ---
4.8.2 works, will use xchg.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-19 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19  1:14 [Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1 bonzini at gnu dot org
2011-08-19  7:29 ` [Bug target/50123] " jakub at gcc dot gnu.org
2011-11-29 21:06 ` amacleod at redhat dot com
2013-11-19 15:13 ` bonzini at gnu dot org

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).