This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1
- From: "bonzini at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Aug 2011 00:44:47 +0000
- Subject: [Bug target/50123] New: cmpxchg generated for atomic and with zero/or with -1
- Auto-submitted: auto-generated
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.