diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2015-02-27 13:59:29 -0500 |
---|---|---|
committer | Sandra Loosemore <sandra@gcc.gnu.org> | 2015-02-27 13:59:29 -0500 |
commit | 8eba66e88067ee0773d2e245c111703de56540d3 (patch) | |
tree | d0f61a6aa1926e3f0f7137b7666169f36524376a | |
parent | 9c78ecc2e6afe8ae7f6335ea8e17fb71535a3284 (diff) | |
download | gcc-8eba66e88067ee0773d2e245c111703de56540d3.zip gcc-8eba66e88067ee0773d2e245c111703de56540d3.tar.gz gcc-8eba66e88067ee0773d2e245c111703de56540d3.tar.bz2 |
extend.texi (x86 transactional memory intrinsics): Reorganize discussion of _xbegin.
2015-02-27 Sandra Loosemore <sandra@codesourcery.com>
gcc/
* doc/extend.texi (x86 transactional memory intrinsics):
Reorganize discussion of _xbegin. Clarify that the return
value is a bit mask. Expand example and move to end of section.
From-SVN: r221068
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 57 |
2 files changed, 46 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bae6265..06ea6d8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-27 Sandra Loosemore <sandra@codesourcery.com> + + * doc/extend.texi (x86 transactional memory intrinsics): + Reorganize discussion of _xbegin. Clarify that the return + value is a bit mask. Expand example and move to end of section. + 2015-02-26 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index c066d32..eb81861 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -17274,24 +17274,11 @@ and suitable fallback code always needs to be supplied. Start a RTM (Restricted Transactional Memory) transaction. Returns @code{_XBEGIN_STARTED} when the transaction started successfully (note this is not 0, so the constant has to be -explicitly tested). If the transaction aborts, all side-effects -are undone and an abort code is returned. There is no guarantee -any transaction ever succeeds, so there always needs to be a valid -fallback path. -@end deftypefn - -@smallexample -#include <immintrin.h> - -if ((status = _xbegin ()) == _XBEGIN_STARTED) @{ - ... transaction code... - _xend (); -@} else @{ - ... non transactional fallback path... -@} -@end smallexample +explicitly tested). -If the transaction aborts, the return value is one of: +If the transaction aborts, all side-effects +are undone and an abort code encoded as a bit mask is returned. +The following macros are defined: @table @code @item _XABORT_EXPLICIT @@ -17309,6 +17296,11 @@ Transaction abort due to a debug trap. Transaction abort in an inner nested transaction. @end table +There is no guarantee +any transaction ever succeeds, so there always needs to be a valid +fallback path. +@end deftypefn + @deftypefn {RTM Function} {void} _xend () Commit the current transaction. When no transaction is active this faults. All memory side-effects of the transaction become visible @@ -17325,6 +17317,37 @@ The @var{status} is an 8-bit constant; its value is encoded in the return value from @code{_xbegin}. @end deftypefn +Here is an example showing handling for @code{_XABORT_RETRY} +and a fallback path for other failures: + +@smallexample +#include <immintrin.h> + +int n_tries, max_tries; +unsigned status = _XABORT_EXPLICIT; +... + +for (n_tries = 0; n_tries < max_tries; n_tries++) + @{ + status = _xbegin (); + if (status == _XBEGIN_STARTED || !(status & _XABORT_RETRY)) + break; + @} +if (status == _XBEGIN_STARTED) + @{ + ... transaction code... + _xend (); + @} +else + @{ + ... non-transactional fallback path... + @} +@end smallexample + +@noindent +Note that, in most cases, the transactional and non-transactional code +must synchronize together to ensure consistency. + @node Target Format Checks @section Format Checks Specific to Particular Target Machines |