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.gier...@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);
}
------------------------------

Reply via email to