diff options
Diffstat (limited to 'devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html')
| -rw-r--r-- | devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html b/devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html deleted file mode 100644 index daa8ebea..00000000 --- a/devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html +++ /dev/null @@ -1,16 +0,0 @@ -<div class="section-level-extent" id="x86-specific-memory-model-extensions-for-transactional-memory"> <div class="nav-panel"> <p> Next: <a href="object-size-checking" accesskey="n" rel="next">Object Size Checking</a>, Previous: <a href="integer-overflow-builtins" accesskey="p" rel="prev">Built-in Functions to Perform Arithmetic with Overflow Checking</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="x86-Specific-Memory-Model-Extensions-for-Transactional-Memory"><span>6.57 x86-Specific Memory Model Extensions for Transactional Memory<a class="copiable-link" href="#x86-Specific-Memory-Model-Extensions-for-Transactional-Memory"> ΒΆ</a></span></h1> <p>The x86 architecture supports additional memory ordering flags to mark critical sections for hardware lock elision. These must be specified in addition to an existing memory order to atomic intrinsics. </p> <dl class="table"> <dt><code class="code">__ATOMIC_HLE_ACQUIRE</code></dt> <dd><p>Start lock elision on a lock variable. Memory order must be <code class="code">__ATOMIC_ACQUIRE</code> or stronger. </p></dd> <dt><code class="code">__ATOMIC_HLE_RELEASE</code></dt> <dd><p>End lock elision on a lock variable. Memory order must be <code class="code">__ATOMIC_RELEASE</code> or stronger. </p></dd> </dl> <p>When a lock acquire fails, it is required for good performance to abort the transaction quickly. This can be done with a <code class="code">_mm_pause</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <immintrin.h> // For _mm_pause - -int lockvar; - -/* Acquire lock with lock elision */ -while (__atomic_exchange_n(&lockvar, 1, __ATOMIC_ACQUIRE|__ATOMIC_HLE_ACQUIRE)) - _mm_pause(); /* Abort failed transaction */ -... -/* Free lock with lock elision */ -__atomic_store_n(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE);</pre> -</div> </div><div class="_attribution"> - <p class="_attribution-p"> - © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> - <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-specific-memory-model-extensions-for-transactional-memory.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-specific-memory-model-extensions-for-transactional-memory.html</a> - </p> -</div> |
