[Bug rtl-optimization/70825] x86_64: __atomic_compare_exchange_n() accesses stack unnecessarily
ghalliday at hpccsystems dot com
gcc-bugzilla@gcc.gnu.org
Sat May 14 06:08:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70825
ghalliday at hpccsystems dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ghalliday at hpccsystems dot com
--- Comment #4 from ghalliday at hpccsystems dot com ---
I have also hit this problem on x86 and Power8, and am adding a comment about
its significance. Although it seems a minor bug it can have a very significant
effect on performance.
I have code which uses __sync_bool_compare_and_swap() to implement a lock free
linked list (inside a memory manager). Replacing it with
__atomic_compare_exchange_n should allow better performance - by avoiding
reloading the expected value (and also selecting a less restrictive memory
order).
However on one example test query, the new code using
__atomic_compare_exchange_n is over 40% *slower* on x86. It is also slower on
Power8 despite using a lwsync instead of sync in the generated code.
More information about the Gcc-bugs
mailing list