6.58.23 S/390 System z Built-in Functions

— Built-in Function: int __builtin_tbegin (void*)

Generates the tbegin 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 tbegin. This buffer can be defined using the struct __htm_tdb C struct defined in htmintrin.h and must reside on a double-word boundary. The second tbegin operand is set to 0xff0c. 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 *_nofloat 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.

Macros for the possible return codes of tbegin are defined in the htmintrin.h header file:

_HTM_TBEGIN_STARTED
tbegin has been executed as part of normal processing. The transaction body is supposed to be executed.
_HTM_TBEGIN_INDETERMINATE
The transaction was aborted due to an indeterminate condition which might be persistent.
_HTM_TBEGIN_TRANSIENT
The transaction aborted due to a transient failure. The transaction should be re-executed in that case.
_HTM_TBEGIN_PERSISTENT
The transaction aborted due to a persistent failure. Re-execution under same circumstances will not be productive.
— Macro: _HTM_FIRST_USER_ABORT_CODE

The _HTM_FIRST_USER_ABORT_CODE defined in htmintrin.h specifies the first abort code which can be used for __builtin_tabort. Values below this threshold are reserved for machine use.

— Data type: struct __htm_tdb

The struct __htm_tdb defined in htmintrin.h describes the structure of the transaction diagnostic block as specified in the Principles of Operation manual chapter 5-91.

— Built-in Function: int __builtin_tbegin_nofloat (void*)

Same as __builtin_tbegin 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.

— Built-in Function: int __builtin_tbegin_retry (void*, int)

In addition to __builtin_tbegin 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.

— Built-in Function: int __builtin_tbegin_retry_nofloat (void*, int)

Same as __builtin_tbegin_retry 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.

— Built-in Function: void __builtin_tbeginc (void)

Generates the tbeginc machine instruction starting a constraint hardware transaction. The second operand is set to 0xff08.

— Built-in Function: int __builtin_tend (void)

Generates the tend machine instruction finishing a transaction and making the changes visible to other threads. The condition code generated by tend is returned as integer value.

— Built-in Function: void __builtin_tabort (int)

Generates the tabort machine instruction with the specified abort code. Abort codes from 0 through 255 are reserved and will result in an error message.

— Built-in Function: void __builtin_tx_assist (int)

Generates the ppa rX,rY,1 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.

— Built-in Function: int __builtin_tx_nesting_depth (void)

Generates the etnd 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.

— Built-in Function: void __builtin_non_tx_store (uint64_t *, uint64_t)

Generates the ntstg 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.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gcc/S_002f390-System-z-Built_002din-Functions.html