* gimplify.c (nonlocal_vlas): Delete.
[official-gcc.git] / gcc / config / s390 / htmxlintrin.h
blobd35194f79569f99344c50ef162862c7e88993448
1 /* XL compiler hardware transactional execution intrinsics
2 Copyright (C) 2013-2018 Free Software Foundation, Inc.
3 Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef _HTMXLINTRIN_H
22 #define _HTMXLINTRIN_H
24 #include <stdint.h>
26 #include <htmintrin.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 /* These intrinsics are being made available for compatibility with
33 the IBM XL compiler. For documentation please see the "z/OS XL
34 C/C++ Programming Guide" publicly available on the web. */
36 /* FIXME: __TM_simple_begin and __TM_begin should be marked
37 __always_inline__ as well but this currently produces an error
38 since the tbegin builtins are "returns_twice" and setjmp_call_p
39 (calls.c) therefore identifies the functions as calling setjmp.
40 The tree inliner currently refuses to inline functions calling
41 setjmp. */
43 long
44 __TM_simple_begin ()
46 return __builtin_tbegin_nofloat (0);
49 long
50 __TM_begin (void* const tdb)
52 return __builtin_tbegin_nofloat (tdb);
55 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
56 __TM_end ()
58 return __builtin_tend ();
61 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
62 __TM_abort ()
64 return __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE);
67 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
68 __TM_named_abort (unsigned char const code)
70 return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + code);
73 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
74 __TM_non_transactional_store (void* const addr, long long const value)
76 __builtin_non_tx_store ((uint64_t*)addr, (uint64_t)value);
79 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
80 __TM_nesting_depth (void* const tdb_ptr)
82 int depth = __builtin_tx_nesting_depth ();
83 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
85 if (depth != 0)
86 return depth;
88 if (tdb->format != 1)
89 return 0;
90 return tdb->nesting_depth;
93 /* Transaction failure diagnostics */
95 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
96 __TM_is_user_abort (void* const tdb_ptr)
98 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
100 if (tdb->format != 1)
101 return 0;
103 return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE);
106 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
107 __TM_is_named_user_abort (void* const tdb_ptr, unsigned char* code)
109 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
111 if (tdb->format != 1)
112 return 0;
114 if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE)
116 *code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE;
117 return 1;
119 return 0;
122 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
123 __TM_is_illegal (void* const tdb_ptr)
125 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
127 return (tdb->format == 1
128 && (tdb->abort_code == 4 /* unfiltered program interruption */
129 || tdb->abort_code == 11 /* restricted instruction */));
132 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
133 __TM_is_footprint_exceeded (void* const tdb_ptr)
135 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
137 return (tdb->format == 1
138 && (tdb->abort_code == 7 /* fetch overflow */
139 || tdb->abort_code == 8 /* store overflow */));
142 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
143 __TM_is_nested_too_deep (void* const tdb_ptr)
145 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
147 return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */
150 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
151 __TM_is_conflict (void* const tdb_ptr)
153 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
155 return (tdb->format == 1
156 && (tdb->abort_code == 9 /* fetch conflict */
157 || tdb->abort_code == 10 /* store conflict */));
160 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
161 __TM_is_failure_persistent (long const result)
163 return result == _HTM_TBEGIN_PERSISTENT;
166 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
167 __TM_failure_address (void* const tdb_ptr)
169 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
170 #ifdef __s390x__
171 return tdb->atia;
172 #else
173 return tdb->atia & 0xffffffff;
174 #endif
177 extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
178 __TM_failure_code (void* const tdb_ptr)
180 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
182 return tdb->abort_code;
185 #ifdef __cplusplus
187 #endif
189 #endif /* _HTMXLINTRIN_H */