As we know from from C11-memory_order: http://en.cppreference.com/w/c/atomic/memory_order
And the same from C++11-std::memory_order: http://en.cppreference.com/w/cpp/atomic/memory_order
On strongly-ordered systems (x86, SPARC, IBM mainframe), release-acquire ordering is automatic. No additional CPU instructions are issued for this synchronization mode, only certain compiler optimizations are affected (e.g. the compiler is prohibited from moving non-atomic stores past the atomic store-release or perform non-atomic loads earlier than the atomic load-acquire)
But is this true for x86-SSE-instructions (except of [NT] - non-temporal, where we always must use L/S/MFENCE)?
Here said, that "sse instructions ... is no requirement on backwards compatibility and memory order is undefined". It is believed that the strict orderability left for compatibility with older versions of processors x86, when it was needed, but new commands, namely SSE(except of [NT]) - deprived automatically release-acquire of order, is it?
MFENCE
, then alsostd::memory_order_acq_req
must useMOV+MFENCE
for these some x86-instructions, is it right? – Anisaanisestrcpy
doesn't use "new" in your example? https://mcmap.net/q/17446/-why-gcc-does-not-use-load-without-fence-and-store-sfence-for-sequential-consistency But you can see "new" in stringstd::string* p = new std::string("Hello");
in example for Release-Acquire ordering, or if you mean "new SSE instructions", thatstd::string
can have their, by link from my question: en.cppreference.com/w/cpp/atomic/memory_order – AnisaaniseMFENCE
for "new SSE-instructions", then and acquire-release needMFENCE
for the same "new SSE-instructions". And if acquire-release need notMFENCE
, then and sequential consistency need not it (only needSFENCE
afterSTORE
). – Anisaanise