[Bug libstdc++/91719] New: gcc compiles seq_cst store on x86-64 differently from clang/icc
oliver.giersch@b-tu.de
gcc-bugzilla@gcc.gnu.org
Tue Sep 10 08:56:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91719
Bug ID: 91719
Summary: gcc compiles seq_cst store on x86-64 differently from
clang/icc
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: oliver.giersch@b-tu.de
Target Milestone: ---
On x86-64 all versions of gcc compile a sequentially consistent atomic store as
'mov + mfence'. Both clang and icc on the other hand instead compile such a
store using only a 'xchg' instruction, which appears to be more efficient
according to my tests.
Example code:
------------------------------
#include <atomic>
std::atomic<int> G{0};
void store() {
G.store(1);
}
------------------------------
More information about the Gcc-bugs
mailing list