[Bug target/55966] New: __atomic_fetch_* generate wrong code for HLE
andi-gcc at firstfloor dot org
gcc-bugzilla@gcc.gnu.org
Mon Jan 14 06:11:00 GMT 2013
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.
More information about the Gcc-bugs
mailing list