[Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1

bonzini at gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 19 01:14:00 GMT 2011


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.



More information about the Gcc-bugs mailing list