diff options
author | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
commit | abdaadbcae30fe0c9a66c7516798279fdfd97750 (patch) | |
tree | 00a54a6e25601e43876d03c1a4a12a749d4a914c /share/doc/gcc/x86-transactional-memory-intrinsics.html |
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Change-Id: I7303388733328cd98ab9aa3c30236db67f2e9e9c
Diffstat (limited to 'share/doc/gcc/x86-transactional-memory-intrinsics.html')
-rw-r--r-- | share/doc/gcc/x86-transactional-memory-intrinsics.html | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/share/doc/gcc/x86-transactional-memory-intrinsics.html b/share/doc/gcc/x86-transactional-memory-intrinsics.html new file mode 100644 index 0000000..a850c3e --- /dev/null +++ b/share/doc/gcc/x86-transactional-memory-intrinsics.html @@ -0,0 +1,200 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This file documents the use of the GNU compilers. + +Copyright (C) 1988-2023 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Funding Free Software", the Front-Cover +Texts being (a) (see below), and with the Back-Cover Texts being (b) +(see below). A copy of the license is included in the section entitled +"GNU Free Documentation License". + +(a) The FSF's Front-Cover Text is: + +A GNU Manual + +(b) The FSF's Back-Cover Text is: + +You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. --> +<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>Using the GNU Compiler Collection (GCC): x86 transactional memory intrinsics</title> + +<meta name="description" content="Using the GNU Compiler Collection (GCC): x86 transactional memory intrinsics"> +<meta name="keywords" content="Using the GNU Compiler Collection (GCC): x86 transactional memory intrinsics"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Indices.html#Indices" rel="index" title="Indices"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="Target-Builtins.html#Target-Builtins" rel="up" title="Target Builtins"> +<link href="x86-control_002dflow-protection-intrinsics.html#x86-control_002dflow-protection-intrinsics" rel="next" title="x86 control-flow protection intrinsics"> +<link href="x86-Built_002din-Functions.html#x86-Built_002din-Functions" rel="previous" title="x86 Built-in Functions"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en_US" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="x86-transactional-memory-intrinsics"></a> +<div class="header"> +<p> +Next: <a href="x86-control_002dflow-protection-intrinsics.html#x86-control_002dflow-protection-intrinsics" accesskey="n" rel="next">x86 control-flow protection intrinsics</a>, Previous: <a href="x86-Built_002din-Functions.html#x86-Built_002din-Functions" accesskey="p" rel="previous">x86 Built-in Functions</a>, Up: <a href="Target-Builtins.html#Target-Builtins" accesskey="u" rel="up">Target Builtins</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> +<hr> +<a name="x86-Transactional-Memory-Intrinsics"></a> +<h4 class="subsection">6.60.36 x86 Transactional Memory Intrinsics</h4> + +<p>These hardware transactional memory intrinsics for x86 allow you to use +memory transactions with RTM (Restricted Transactional Memory). +This support is enabled with the <samp>-mrtm</samp> option. +For using HLE (Hardware Lock Elision) see +<a href="x86-specific-memory-model-extensions-for-transactional-memory.html#x86-specific-memory-model-extensions-for-transactional-memory">x86 specific memory model extensions for transactional memory</a> instead. +</p> +<p>A memory transaction commits all changes to memory in an atomic way, +as visible to other threads. If the transaction fails it is rolled back +and all side effects discarded. +</p> +<p>Generally there is no guarantee that a memory transaction ever succeeds +and suitable fallback code always needs to be supplied. +</p> +<dl> +<dt><a name="index-_005fxbegin"></a>RTM Function: <em>unsigned</em> <strong>_xbegin</strong> <em>()</em></dt> +<dd><p>Start a RTM (Restricted Transactional Memory) transaction. +Returns <code>_XBEGIN_STARTED</code> when the transaction +started successfully (note this is not 0, so the constant has to be +explicitly tested). +</p> +<p>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: +</p> +<dl> +<dt><a name="index-_005fXABORT_005fEXPLICIT"></a>Macro: <strong>_XABORT_EXPLICIT</strong></dt> +<dd><p>Transaction was explicitly aborted with <code>_xabort</code>. The parameter passed +to <code>_xabort</code> is available with <code>_XABORT_CODE(status)</code>. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fXABORT_005fRETRY"></a>Macro: <strong>_XABORT_RETRY</strong></dt> +<dd><p>Transaction retry is possible. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fXABORT_005fCONFLICT"></a>Macro: <strong>_XABORT_CONFLICT</strong></dt> +<dd><p>Transaction abort due to a memory conflict with another thread. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fXABORT_005fCAPACITY"></a>Macro: <strong>_XABORT_CAPACITY</strong></dt> +<dd><p>Transaction abort due to the transaction using too much memory. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fXABORT_005fDEBUG"></a>Macro: <strong>_XABORT_DEBUG</strong></dt> +<dd><p>Transaction abort due to a debug trap. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fXABORT_005fNESTED"></a>Macro: <strong>_XABORT_NESTED</strong></dt> +<dd><p>Transaction abort in an inner nested transaction. +</p></dd></dl> + +<p>There is no guarantee +any transaction ever succeeds, so there always needs to be a valid +fallback path. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fxend"></a>RTM Function: <em>void</em> <strong>_xend</strong> <em>()</em></dt> +<dd><p>Commit the current transaction. When no transaction is active this faults. +All memory side effects of the transaction become visible +to other threads in an atomic manner. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fxtest"></a>RTM Function: <em>int</em> <strong>_xtest</strong> <em>()</em></dt> +<dd><p>Return a nonzero value if a transaction is currently active, otherwise 0. +</p></dd></dl> + +<dl> +<dt><a name="index-_005fxabort"></a>RTM Function: <em>void</em> <strong>_xabort</strong> <em>(status)</em></dt> +<dd><p>Abort the current transaction. When no transaction is active this is a no-op. +The <var>status</var> is an 8-bit constant; its value is encoded in the return +value from <code>_xbegin</code>. +</p></dd></dl> + +<p>Here is an example showing handling for <code>_XABORT_RETRY</code> +and a fallback path for other failures: +</p> +<div class="smallexample"> +<pre class="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... + } +</pre></div> + +<p>Note that, in most cases, the transactional and non-transactional code +must synchronize together to ensure consistency. +</p> +<hr> +<div class="header"> +<p> +Next: <a href="x86-control_002dflow-protection-intrinsics.html#x86-control_002dflow-protection-intrinsics" accesskey="n" rel="next">x86 control-flow protection intrinsics</a>, Previous: <a href="x86-Built_002din-Functions.html#x86-Built_002din-Functions" accesskey="p" rel="previous">x86 Built-in Functions</a>, Up: <a href="Target-Builtins.html#Target-Builtins" accesskey="u" rel="up">Target Builtins</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> + + + +</body> +</html> |