S/390 System z Built-in Functions#
tbeginmachine instruction starting a non-constrained 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_tdbC struct defined in
htmintrin.hand 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
*_nofloatvariant. In order to prevent a TDB from being written it is required to pass a constant zero value as parameter. Passing a 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:
tbeginhas been executed as part of normal processing. The transaction body is supposed to be executed.
The transaction was aborted due to an indeterminate condition which might be persistent.
The transaction aborted due to a transient failure. The transaction should be re-executed in that case.
The transaction aborted due to a persistent failure. Re-execution under same circumstances will not be productive.
htmintrin.hspecifies the first abort code which can be used for
__builtin_tabort. Values below this threshold are reserved for machine use.
Data type struct __htm_tdbThe
struct __htm_tdb defined in
the structure of the transaction diagnostic block as specified in the
Principles of Operation manual chapter 5-91.
__builtin_tbeginbut 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.
int __builtin_tbegin_retry(void*, int)#
In addition to
__builtin_tbegina 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.
int __builtin_tbegin_retry_nofloat(void*, int)#
__builtin_tbegin_retrybut 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.
tbegincmachine instruction starting a constrained hardware transaction. The second operand is set to
tendmachine instruction finishing a transaction and making the changes visible to other threads. The condition code generated by tend is returned as integer value.
tabortmachine instruction with the specified abort code. Abort codes from 0 through 255 are reserved and will result in an error message.
ppa rX,rY,1machine 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.
etndmachine 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.
void __builtin_non_tx_store(uint64_t*, uint64_t)#
ntstgmachine 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.