blob: b92521e2962bb6c1b27cf755b5464dc48b7efccd [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2015 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.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Using the GNU Compiler Collection (GCC): S/390 System z Built-in Functions</title>
<meta name="description" content="Using the GNU Compiler Collection (GCC): S/390 System z Built-in Functions">
<meta name="keywords" content="Using the GNU Compiler Collection (GCC): S/390 System z Built-in Functions">
<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="Option-Index.html#Option-Index" rel="index" title="Option Index">
<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="SH-Built_002din-Functions.html#SH-Built_002din-Functions" rel="next" title="SH Built-in Functions">
<link href="RX-Built_002din-Functions.html#RX-Built_002din-Functions" rel="prev" title="RX 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" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="S_002f390-System-z-Built_002din-Functions"></a>
<div class="header">
<p>
Next: <a href="SH-Built_002din-Functions.html#SH-Built_002din-Functions" accesskey="n" rel="next">SH Built-in Functions</a>, Previous: <a href="RX-Built_002din-Functions.html#RX-Built_002din-Functions" accesskey="p" rel="prev">RX Built-in Functions</a>, Up: <a href="Target-Builtins.html#Target-Builtins" accesskey="u" rel="up">Target Builtins</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="S_002f390-System-z-Built_002din-Functions-1"></a>
<h4 class="subsection">6.57.25 S/390 System z Built-in Functions</h4>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftbegin"></a>Built-in Function: <em>int</em> <strong>__builtin_tbegin</strong> <em>(void*)</em></dt>
<dd><p>Generates the <code>tbegin</code> machine instruction starting a
non-constraint hardware transaction. If the parameter is non-NULL the
memory area is used to store the transaction diagnostic buffer and
will be passed as first operand to <code>tbegin</code>. This buffer can be
defined using the <code>struct __htm_tdb</code> C struct defined in
<code>htmintrin.h</code> and must reside on a double-word boundary. The
second tbegin operand is set to <code>0xff0c</code>. This enables
save/restore of all GPRs and disables aborts for FPR and AR
manipulations inside the transaction body. The condition code set by
the tbegin instruction is returned as integer value. The tbegin
instruction by definition overwrites the content of all FPRs. The
compiler will generate code which saves and restores the FPRs. For
soft-float code it is recommended to used the <code>*_nofloat</code>
variant. In order to prevent a TDB from being written it is required
to pass an constant zero value as parameter. Passing the zero value
through a variable is not sufficient. Although modifications of
access registers inside the transaction will not trigger an
transaction abort it is not supported to actually modify them. Access
registers do not get saved when entering a transaction. They will have
undefined state when reaching the abort code.
</p></dd></dl>
<p>Macros for the possible return codes of tbegin are defined in the
<code>htmintrin.h</code> header file:
</p>
<dl compact="compact">
<dt><code>_HTM_TBEGIN_STARTED</code></dt>
<dd><p><code>tbegin</code> has been executed as part of normal processing. The
transaction body is supposed to be executed.
</p></dd>
<dt><code>_HTM_TBEGIN_INDETERMINATE</code></dt>
<dd><p>The transaction was aborted due to an indeterminate condition which
might be persistent.
</p></dd>
<dt><code>_HTM_TBEGIN_TRANSIENT</code></dt>
<dd><p>The transaction aborted due to a transient failure. The transaction
should be re-executed in that case.
</p></dd>
<dt><code>_HTM_TBEGIN_PERSISTENT</code></dt>
<dd><p>The transaction aborted due to a persistent failure. Re-execution
under same circumstances will not be productive.
</p></dd>
</dl>
<dl>
<dt><a name="index-_005fHTM_005fFIRST_005fUSER_005fABORT_005fCODE"></a>Macro: <strong>_HTM_FIRST_USER_ABORT_CODE</strong></dt>
<dd><p>The <code>_HTM_FIRST_USER_ABORT_CODE</code> defined in <code>htmintrin.h</code>
specifies the first abort code which can be used for
<code>__builtin_tabort</code>. Values below this threshold are reserved for
machine use.
</p></dd></dl>
<dl>
<dt><a name="index-struct-_005f_005fhtm_005ftdb"></a>Data type: <strong>struct __htm_tdb</strong></dt>
<dd><p>The <code>struct __htm_tdb</code> defined in <code>htmintrin.h</code> describes
the structure of the transaction diagnostic block as specified in the
Principles of Operation manual chapter 5-91.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftbegin_005fnofloat"></a>Built-in Function: <em>int</em> <strong>__builtin_tbegin_nofloat</strong> <em>(void*)</em></dt>
<dd><p>Same as <code>__builtin_tbegin</code> but without FPR saves and restores.
Using this variant in code making use of FPRs will leave the FPRs in
undefined state when entering the transaction abort handler code.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftbegin_005fretry"></a>Built-in Function: <em>int</em> <strong>__builtin_tbegin_retry</strong> <em>(void*, int)</em></dt>
<dd><p>In addition to <code>__builtin_tbegin</code> a loop for transient failures
is generated. If tbegin returns a condition code of 2 the transaction
will be retried as often as specified in the second argument. The
perform processor assist instruction is used to tell the CPU about the
number of fails so far.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftbegin_005fretry_005fnofloat"></a>Built-in Function: <em>int</em> <strong>__builtin_tbegin_retry_nofloat</strong> <em>(void*, int)</em></dt>
<dd><p>Same as <code>__builtin_tbegin_retry</code> but without FPR saves and
restores. Using this variant in code making use of FPRs will leave
the FPRs in undefined state when entering the transaction abort
handler code.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftbeginc"></a>Built-in Function: <em>void</em> <strong>__builtin_tbeginc</strong> <em>(void)</em></dt>
<dd><p>Generates the <code>tbeginc</code> machine instruction starting a constraint
hardware transaction. The second operand is set to <code>0xff08</code>.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftend"></a>Built-in Function: <em>int</em> <strong>__builtin_tend</strong> <em>(void)</em></dt>
<dd><p>Generates the <code>tend</code> machine instruction finishing a transaction
and making the changes visible to other threads. The condition code
generated by tend is returned as integer value.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftabort"></a>Built-in Function: <em>void</em> <strong>__builtin_tabort</strong> <em>(int)</em></dt>
<dd><p>Generates the <code>tabort</code> machine instruction with the specified
abort code. Abort codes from 0 through 255 are reserved and will
result in an error message.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftx_005fassist"></a>Built-in Function: <em>void</em> <strong>__builtin_tx_assist</strong> <em>(int)</em></dt>
<dd><p>Generates the <code>ppa rX,rY,1</code> machine instruction. Where the
integer parameter is loaded into rX and a value of zero is loaded into
rY. The integer parameter specifies the number of times the
transaction repeatedly aborted.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005ftx_005fnesting_005fdepth"></a>Built-in Function: <em>int</em> <strong>__builtin_tx_nesting_depth</strong> <em>(void)</em></dt>
<dd><p>Generates the <code>etnd</code> machine instruction. The current nesting
depth is returned as integer value. For a nesting depth of 0 the code
is not executed as part of an transaction.
</p></dd></dl>
<dl>
<dt><a name="index-_005f_005fbuiltin_005fnon_005ftx_005fstore"></a>Built-in Function: <em>void</em> <strong>__builtin_non_tx_store</strong> <em>(uint64_t *, uint64_t)</em></dt>
<dd>
<p>Generates the <code>ntstg</code> machine instruction. The second argument
is written to the first arguments location. The store operation will
not be rolled-back in case of an transaction abort.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="SH-Built_002din-Functions.html#SH-Built_002din-Functions" accesskey="n" rel="next">SH Built-in Functions</a>, Previous: <a href="RX-Built_002din-Functions.html#RX-Built_002din-Functions" accesskey="p" rel="prev">RX Built-in Functions</a>, Up: <a href="Target-Builtins.html#Target-Builtins" accesskey="u" rel="up">Target Builtins</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>