xref: /freebsd/contrib/llvm-project/clang/lib/Headers/htmxlintrin.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric /*===---- htmxlintrin.h - XL compiler HTM execution intrinsics-------------===*\
2*0b57cec5SDimitry Andric  *
3*0b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric  *
7*0b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #ifndef __HTMXLINTRIN_H
10*0b57cec5SDimitry Andric #define __HTMXLINTRIN_H
11*0b57cec5SDimitry Andric 
12*0b57cec5SDimitry Andric #ifndef __HTM__
13*0b57cec5SDimitry Andric #error "HTM instruction set not enabled"
14*0b57cec5SDimitry Andric #endif
15*0b57cec5SDimitry Andric 
16*0b57cec5SDimitry Andric #include <htmintrin.h>
17*0b57cec5SDimitry Andric 
18*0b57cec5SDimitry Andric #ifdef __powerpc__
19*0b57cec5SDimitry Andric 
20*0b57cec5SDimitry Andric #ifdef __cplusplus
21*0b57cec5SDimitry Andric extern "C" {
22*0b57cec5SDimitry Andric #endif
23*0b57cec5SDimitry Andric 
24*0b57cec5SDimitry Andric #define _TEXASR_PTR(TM_BUF) ((texasr_t *)((char *)(TM_BUF) + 0))
25*0b57cec5SDimitry Andric #define _TEXASRU_PTR(TM_BUF) ((texasru_t *)((char *)(TM_BUF) + 0))
26*0b57cec5SDimitry Andric #define _TEXASRL_PTR(TM_BUF) ((texasrl_t *)((char *)(TM_BUF) + 4))
27*0b57cec5SDimitry Andric #define _TFIAR_PTR(TM_BUF) ((tfiar_t *)((char *)(TM_BUF) + 8))
28*0b57cec5SDimitry Andric 
29*0b57cec5SDimitry Andric typedef char TM_buff_type[16];
30*0b57cec5SDimitry Andric 
31*0b57cec5SDimitry Andric /* This macro can be used to determine whether a transaction was successfully
32*0b57cec5SDimitry Andric    started from the __TM_begin() and __TM_simple_begin() intrinsic functions
33*0b57cec5SDimitry Andric    below.  */
34*0b57cec5SDimitry Andric #define _HTM_TBEGIN_STARTED     1
35*0b57cec5SDimitry Andric 
36*0b57cec5SDimitry Andric extern __inline long
37*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_simple_begin(void)38*0b57cec5SDimitry Andric __TM_simple_begin (void)
39*0b57cec5SDimitry Andric {
40*0b57cec5SDimitry Andric   if (__builtin_expect (__builtin_tbegin (0), 1))
41*0b57cec5SDimitry Andric     return _HTM_TBEGIN_STARTED;
42*0b57cec5SDimitry Andric   return 0;
43*0b57cec5SDimitry Andric }
44*0b57cec5SDimitry Andric 
45*0b57cec5SDimitry Andric extern __inline long
46*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_begin(void * const __TM_buff)47*0b57cec5SDimitry Andric __TM_begin (void* const __TM_buff)
48*0b57cec5SDimitry Andric {
49*0b57cec5SDimitry Andric   *_TEXASRL_PTR (__TM_buff) = 0;
50*0b57cec5SDimitry Andric   if (__builtin_expect (__builtin_tbegin (0), 1))
51*0b57cec5SDimitry Andric     return _HTM_TBEGIN_STARTED;
52*0b57cec5SDimitry Andric #ifdef __powerpc64__
53*0b57cec5SDimitry Andric   *_TEXASR_PTR (__TM_buff) = __builtin_get_texasr ();
54*0b57cec5SDimitry Andric #else
55*0b57cec5SDimitry Andric   *_TEXASRU_PTR (__TM_buff) = __builtin_get_texasru ();
56*0b57cec5SDimitry Andric   *_TEXASRL_PTR (__TM_buff) = __builtin_get_texasr ();
57*0b57cec5SDimitry Andric #endif
58*0b57cec5SDimitry Andric   *_TFIAR_PTR (__TM_buff) = __builtin_get_tfiar ();
59*0b57cec5SDimitry Andric   return 0;
60*0b57cec5SDimitry Andric }
61*0b57cec5SDimitry Andric 
62*0b57cec5SDimitry Andric extern __inline long
63*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_end(void)64*0b57cec5SDimitry Andric __TM_end (void)
65*0b57cec5SDimitry Andric {
66*0b57cec5SDimitry Andric   if (__builtin_expect (__builtin_tend (0), 1))
67*0b57cec5SDimitry Andric     return 1;
68*0b57cec5SDimitry Andric   return 0;
69*0b57cec5SDimitry Andric }
70*0b57cec5SDimitry Andric 
71*0b57cec5SDimitry Andric extern __inline void
72*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_abort(void)73*0b57cec5SDimitry Andric __TM_abort (void)
74*0b57cec5SDimitry Andric {
75*0b57cec5SDimitry Andric   __builtin_tabort (0);
76*0b57cec5SDimitry Andric }
77*0b57cec5SDimitry Andric 
78*0b57cec5SDimitry Andric extern __inline void
79*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_named_abort(unsigned char const __code)80*0b57cec5SDimitry Andric __TM_named_abort (unsigned char const __code)
81*0b57cec5SDimitry Andric {
82*0b57cec5SDimitry Andric   __builtin_tabort (__code);
83*0b57cec5SDimitry Andric }
84*0b57cec5SDimitry Andric 
85*0b57cec5SDimitry Andric extern __inline void
86*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_resume(void)87*0b57cec5SDimitry Andric __TM_resume (void)
88*0b57cec5SDimitry Andric {
89*0b57cec5SDimitry Andric   __builtin_tresume ();
90*0b57cec5SDimitry Andric }
91*0b57cec5SDimitry Andric 
92*0b57cec5SDimitry Andric extern __inline void
93*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_suspend(void)94*0b57cec5SDimitry Andric __TM_suspend (void)
95*0b57cec5SDimitry Andric {
96*0b57cec5SDimitry Andric   __builtin_tsuspend ();
97*0b57cec5SDimitry Andric }
98*0b57cec5SDimitry Andric 
99*0b57cec5SDimitry Andric extern __inline long
100*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_user_abort(void * const __TM_buff)101*0b57cec5SDimitry Andric __TM_is_user_abort (void* const __TM_buff)
102*0b57cec5SDimitry Andric {
103*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
104*0b57cec5SDimitry Andric   return _TEXASRU_ABORT (texasru);
105*0b57cec5SDimitry Andric }
106*0b57cec5SDimitry Andric 
107*0b57cec5SDimitry Andric extern __inline long
108*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_named_user_abort(void * const __TM_buff,unsigned char * __code)109*0b57cec5SDimitry Andric __TM_is_named_user_abort (void* const __TM_buff, unsigned char *__code)
110*0b57cec5SDimitry Andric {
111*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
112*0b57cec5SDimitry Andric 
113*0b57cec5SDimitry Andric   *__code = _TEXASRU_FAILURE_CODE (texasru);
114*0b57cec5SDimitry Andric   return _TEXASRU_ABORT (texasru);
115*0b57cec5SDimitry Andric }
116*0b57cec5SDimitry Andric 
117*0b57cec5SDimitry Andric extern __inline long
118*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_illegal(void * const __TM_buff)119*0b57cec5SDimitry Andric __TM_is_illegal (void* const __TM_buff)
120*0b57cec5SDimitry Andric {
121*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
122*0b57cec5SDimitry Andric   return _TEXASRU_DISALLOWED (texasru);
123*0b57cec5SDimitry Andric }
124*0b57cec5SDimitry Andric 
125*0b57cec5SDimitry Andric extern __inline long
126*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_footprint_exceeded(void * const __TM_buff)127*0b57cec5SDimitry Andric __TM_is_footprint_exceeded (void* const __TM_buff)
128*0b57cec5SDimitry Andric {
129*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
130*0b57cec5SDimitry Andric   return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
131*0b57cec5SDimitry Andric }
132*0b57cec5SDimitry Andric 
133*0b57cec5SDimitry Andric extern __inline long
134*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_nesting_depth(void * const __TM_buff)135*0b57cec5SDimitry Andric __TM_nesting_depth (void* const __TM_buff)
136*0b57cec5SDimitry Andric {
137*0b57cec5SDimitry Andric   texasrl_t texasrl;
138*0b57cec5SDimitry Andric 
139*0b57cec5SDimitry Andric   if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
140*0b57cec5SDimitry Andric     {
141*0b57cec5SDimitry Andric       texasrl = *_TEXASRL_PTR (__TM_buff);
142*0b57cec5SDimitry Andric       if (!_TEXASR_FAILURE_SUMMARY (texasrl))
143*0b57cec5SDimitry Andric         texasrl = 0;
144*0b57cec5SDimitry Andric     }
145*0b57cec5SDimitry Andric   else
146*0b57cec5SDimitry Andric     texasrl = (texasrl_t) __builtin_get_texasr ();
147*0b57cec5SDimitry Andric 
148*0b57cec5SDimitry Andric   return _TEXASR_TRANSACTION_LEVEL (texasrl);
149*0b57cec5SDimitry Andric }
150*0b57cec5SDimitry Andric 
151*0b57cec5SDimitry Andric extern __inline long
152*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_nested_too_deep(void * const __TM_buff)153*0b57cec5SDimitry Andric __TM_is_nested_too_deep(void* const __TM_buff)
154*0b57cec5SDimitry Andric {
155*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
156*0b57cec5SDimitry Andric   return _TEXASRU_NESTING_OVERFLOW (texasru);
157*0b57cec5SDimitry Andric }
158*0b57cec5SDimitry Andric 
159*0b57cec5SDimitry Andric extern __inline long
160*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_conflict(void * const __TM_buff)161*0b57cec5SDimitry Andric __TM_is_conflict(void* const __TM_buff)
162*0b57cec5SDimitry Andric {
163*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
164*0b57cec5SDimitry Andric   /* Return TEXASR bits 11 (Self-Induced Conflict) through
165*0b57cec5SDimitry Andric      14 (Translation Invalidation Conflict).  */
166*0b57cec5SDimitry Andric   return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0;
167*0b57cec5SDimitry Andric }
168*0b57cec5SDimitry Andric 
169*0b57cec5SDimitry Andric extern __inline long
170*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_failure_persistent(void * const __TM_buff)171*0b57cec5SDimitry Andric __TM_is_failure_persistent(void* const __TM_buff)
172*0b57cec5SDimitry Andric {
173*0b57cec5SDimitry Andric   texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
174*0b57cec5SDimitry Andric   return _TEXASRU_FAILURE_PERSISTENT (texasru);
175*0b57cec5SDimitry Andric }
176*0b57cec5SDimitry Andric 
177*0b57cec5SDimitry Andric extern __inline long
178*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_failure_address(void * const __TM_buff)179*0b57cec5SDimitry Andric __TM_failure_address(void* const __TM_buff)
180*0b57cec5SDimitry Andric {
181*0b57cec5SDimitry Andric   return *_TFIAR_PTR (__TM_buff);
182*0b57cec5SDimitry Andric }
183*0b57cec5SDimitry Andric 
184*0b57cec5SDimitry Andric extern __inline long long
185*0b57cec5SDimitry Andric __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_failure_code(void * const __TM_buff)186*0b57cec5SDimitry Andric __TM_failure_code(void* const __TM_buff)
187*0b57cec5SDimitry Andric {
188*0b57cec5SDimitry Andric   return *_TEXASR_PTR (__TM_buff);
189*0b57cec5SDimitry Andric }
190*0b57cec5SDimitry Andric 
191*0b57cec5SDimitry Andric #ifdef __cplusplus
192*0b57cec5SDimitry Andric }
193*0b57cec5SDimitry Andric #endif
194*0b57cec5SDimitry Andric 
195*0b57cec5SDimitry Andric #endif /* __powerpc__ */
196*0b57cec5SDimitry Andric 
197*0b57cec5SDimitry Andric #ifdef __s390__
198*0b57cec5SDimitry Andric 
199*0b57cec5SDimitry Andric #include <stdint.h>
200*0b57cec5SDimitry Andric 
201*0b57cec5SDimitry Andric /* These intrinsics are being made available for compatibility with
202*0b57cec5SDimitry Andric    the IBM XL compiler.  For documentation please see the "z/OS XL
203*0b57cec5SDimitry Andric    C/C++ Programming Guide" publicly available on the web.  */
204*0b57cec5SDimitry Andric 
205*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_simple_begin()206*0b57cec5SDimitry Andric __TM_simple_begin ()
207*0b57cec5SDimitry Andric {
208*0b57cec5SDimitry Andric   return __builtin_tbegin_nofloat (0);
209*0b57cec5SDimitry Andric }
210*0b57cec5SDimitry Andric 
211*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_begin(void * const __tdb)212*0b57cec5SDimitry Andric __TM_begin (void* const __tdb)
213*0b57cec5SDimitry Andric {
214*0b57cec5SDimitry Andric   return __builtin_tbegin_nofloat (__tdb);
215*0b57cec5SDimitry Andric }
216*0b57cec5SDimitry Andric 
217*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_end()218*0b57cec5SDimitry Andric __TM_end ()
219*0b57cec5SDimitry Andric {
220*0b57cec5SDimitry Andric   return __builtin_tend ();
221*0b57cec5SDimitry Andric }
222*0b57cec5SDimitry Andric 
223*0b57cec5SDimitry Andric static __inline void __attribute__((__always_inline__))
__TM_abort()224*0b57cec5SDimitry Andric __TM_abort ()
225*0b57cec5SDimitry Andric {
226*0b57cec5SDimitry Andric   return __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE);
227*0b57cec5SDimitry Andric }
228*0b57cec5SDimitry Andric 
229*0b57cec5SDimitry Andric static __inline void __attribute__((__always_inline__, __nodebug__))
__TM_named_abort(unsigned char const __code)230*0b57cec5SDimitry Andric __TM_named_abort (unsigned char const __code)
231*0b57cec5SDimitry Andric {
232*0b57cec5SDimitry Andric   return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + __code);
233*0b57cec5SDimitry Andric }
234*0b57cec5SDimitry Andric 
235*0b57cec5SDimitry Andric static __inline void __attribute__((__always_inline__, __nodebug__))
__TM_non_transactional_store(void * const __addr,long long const __value)236*0b57cec5SDimitry Andric __TM_non_transactional_store (void* const __addr, long long const __value)
237*0b57cec5SDimitry Andric {
238*0b57cec5SDimitry Andric   __builtin_non_tx_store ((uint64_t*)__addr, (uint64_t)__value);
239*0b57cec5SDimitry Andric }
240*0b57cec5SDimitry Andric 
241*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_nesting_depth(void * const __tdb_ptr)242*0b57cec5SDimitry Andric __TM_nesting_depth (void* const __tdb_ptr)
243*0b57cec5SDimitry Andric {
244*0b57cec5SDimitry Andric   int depth = __builtin_tx_nesting_depth ();
245*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
246*0b57cec5SDimitry Andric 
247*0b57cec5SDimitry Andric   if (depth != 0)
248*0b57cec5SDimitry Andric     return depth;
249*0b57cec5SDimitry Andric 
250*0b57cec5SDimitry Andric   if (tdb->format != 1)
251*0b57cec5SDimitry Andric     return 0;
252*0b57cec5SDimitry Andric   return tdb->nesting_depth;
253*0b57cec5SDimitry Andric }
254*0b57cec5SDimitry Andric 
255*0b57cec5SDimitry Andric /* Transaction failure diagnostics */
256*0b57cec5SDimitry Andric 
257*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_user_abort(void * const __tdb_ptr)258*0b57cec5SDimitry Andric __TM_is_user_abort (void* const __tdb_ptr)
259*0b57cec5SDimitry Andric {
260*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
261*0b57cec5SDimitry Andric 
262*0b57cec5SDimitry Andric   if (tdb->format != 1)
263*0b57cec5SDimitry Andric     return 0;
264*0b57cec5SDimitry Andric 
265*0b57cec5SDimitry Andric   return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE);
266*0b57cec5SDimitry Andric }
267*0b57cec5SDimitry Andric 
268*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_named_user_abort(void * const __tdb_ptr,unsigned char * __code)269*0b57cec5SDimitry Andric __TM_is_named_user_abort (void* const __tdb_ptr, unsigned char* __code)
270*0b57cec5SDimitry Andric {
271*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
272*0b57cec5SDimitry Andric 
273*0b57cec5SDimitry Andric   if (tdb->format != 1)
274*0b57cec5SDimitry Andric     return 0;
275*0b57cec5SDimitry Andric 
276*0b57cec5SDimitry Andric   if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE)
277*0b57cec5SDimitry Andric     {
278*0b57cec5SDimitry Andric       *__code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE;
279*0b57cec5SDimitry Andric       return 1;
280*0b57cec5SDimitry Andric     }
281*0b57cec5SDimitry Andric   return 0;
282*0b57cec5SDimitry Andric }
283*0b57cec5SDimitry Andric 
284*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_illegal(void * const __tdb_ptr)285*0b57cec5SDimitry Andric __TM_is_illegal (void* const __tdb_ptr)
286*0b57cec5SDimitry Andric {
287*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
288*0b57cec5SDimitry Andric 
289*0b57cec5SDimitry Andric   return (tdb->format == 1
290*0b57cec5SDimitry Andric 	  && (tdb->abort_code == 4 /* unfiltered program interruption */
291*0b57cec5SDimitry Andric 	      || tdb->abort_code == 11 /* restricted instruction */));
292*0b57cec5SDimitry Andric }
293*0b57cec5SDimitry Andric 
294*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_footprint_exceeded(void * const __tdb_ptr)295*0b57cec5SDimitry Andric __TM_is_footprint_exceeded (void* const __tdb_ptr)
296*0b57cec5SDimitry Andric {
297*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
298*0b57cec5SDimitry Andric 
299*0b57cec5SDimitry Andric   return (tdb->format == 1
300*0b57cec5SDimitry Andric 	  && (tdb->abort_code == 7 /* fetch overflow */
301*0b57cec5SDimitry Andric 	      || tdb->abort_code == 8 /* store overflow */));
302*0b57cec5SDimitry Andric }
303*0b57cec5SDimitry Andric 
304*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_nested_too_deep(void * const __tdb_ptr)305*0b57cec5SDimitry Andric __TM_is_nested_too_deep (void* const __tdb_ptr)
306*0b57cec5SDimitry Andric {
307*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
308*0b57cec5SDimitry Andric 
309*0b57cec5SDimitry Andric   return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */
310*0b57cec5SDimitry Andric }
311*0b57cec5SDimitry Andric 
312*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_conflict(void * const __tdb_ptr)313*0b57cec5SDimitry Andric __TM_is_conflict (void* const __tdb_ptr)
314*0b57cec5SDimitry Andric {
315*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
316*0b57cec5SDimitry Andric 
317*0b57cec5SDimitry Andric   return (tdb->format == 1
318*0b57cec5SDimitry Andric 	  && (tdb->abort_code == 9 /* fetch conflict */
319*0b57cec5SDimitry Andric 	      || tdb->abort_code == 10 /* store conflict */));
320*0b57cec5SDimitry Andric }
321*0b57cec5SDimitry Andric 
322*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_failure_persistent(long const __result)323*0b57cec5SDimitry Andric __TM_is_failure_persistent (long const __result)
324*0b57cec5SDimitry Andric {
325*0b57cec5SDimitry Andric   return __result == _HTM_TBEGIN_PERSISTENT;
326*0b57cec5SDimitry Andric }
327*0b57cec5SDimitry Andric 
328*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_failure_address(void * const __tdb_ptr)329*0b57cec5SDimitry Andric __TM_failure_address (void* const __tdb_ptr)
330*0b57cec5SDimitry Andric {
331*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
332*0b57cec5SDimitry Andric   return tdb->atia;
333*0b57cec5SDimitry Andric }
334*0b57cec5SDimitry Andric 
335*0b57cec5SDimitry Andric static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_failure_code(void * const __tdb_ptr)336*0b57cec5SDimitry Andric __TM_failure_code (void* const __tdb_ptr)
337*0b57cec5SDimitry Andric {
338*0b57cec5SDimitry Andric   struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
339*0b57cec5SDimitry Andric 
340*0b57cec5SDimitry Andric   return tdb->abort_code;
341*0b57cec5SDimitry Andric }
342*0b57cec5SDimitry Andric 
343*0b57cec5SDimitry Andric #endif /* __s390__ */
344*0b57cec5SDimitry Andric 
345*0b57cec5SDimitry Andric #endif /* __HTMXLINTRIN_H  */
346