I think C++ does not cover any sort of transaction memory yet, but still TSX can somehow fit using "as if rule" into something that is governed by C++ memory model.
So, what happens on successful HLE operation, or successful RTM transaction?
Saying "there is data race, but it is ok" is not much helpful, as it does not clarify what "ok" means.
With HLE probably it can be seen as "previous operation happens before subsequent operation. As if the section was still guarded by the lock that was elided".
What is with RTM? As there's no even an elided lock, only (potentially non-atomic) memory operations, which could be loads, stores, both, or no-op. What is synchronized with what? What happens before what?
Apparently before going into specs or asking SO I should have read thoroughly "overview" pages:
Hardware Lock Elision Overview
Restricted Transactional Memory Overview
To complete the answer:
LOCKprefixed instructions map to C++std::memory_order::seq_cst. This covers all successful RTM transactions (which are as if singleLOCK-prefixed instruction). It also covers most of HLE cases. Specifically:LOCKprefixed instructions are executed as if they are executed, this impliesseq_csttooXACQUIRE XCHG/XRELEASE XCHG, as if it is executed, this impliesseq_csttooXRELEASE MOV [mem], opis as ifMOV [mem], op, so it is justrelease(under usual implementation of C++ memory model where sequentially consistent store has memory fence, not load)(The documentation links are for Intel compiler. However they document hardware behavior, so the information should be applicable to other compilers. The only variable that compiler might introduce is compile time reordering. I expect however that if compiler implements intrinsic, it also implements proper reordering prohibition, if still unsure, place compiler barriers. And with direct assembly should just mark assembly code accordingly)