xref: /freebsd/contrib/llvm-project/clang/lib/Headers/rtmintrin.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
10b57cec5SDimitry Andric /*===---- rtmintrin.h - RTM intrinsics -------------------------------------===
20b57cec5SDimitry Andric  *
30b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric  *
70b57cec5SDimitry Andric  *===-----------------------------------------------------------------------===
80b57cec5SDimitry Andric  */
90b57cec5SDimitry Andric 
100b57cec5SDimitry Andric #ifndef __IMMINTRIN_H
110b57cec5SDimitry Andric #error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
120b57cec5SDimitry Andric #endif
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef __RTMINTRIN_H
150b57cec5SDimitry Andric #define __RTMINTRIN_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric #define _XBEGIN_STARTED   (~0u)
180b57cec5SDimitry Andric #define _XABORT_EXPLICIT  (1 << 0)
190b57cec5SDimitry Andric #define _XABORT_RETRY     (1 << 1)
200b57cec5SDimitry Andric #define _XABORT_CONFLICT  (1 << 2)
210b57cec5SDimitry Andric #define _XABORT_CAPACITY  (1 << 3)
220b57cec5SDimitry Andric #define _XABORT_DEBUG     (1 << 4)
230b57cec5SDimitry Andric #define _XABORT_NESTED    (1 << 5)
240b57cec5SDimitry Andric #define _XABORT_CODE(x)   (((x) >> 24) & 0xFF)
250b57cec5SDimitry Andric 
260b57cec5SDimitry Andric /* Define the default attributes for the functions in this file. */
270b57cec5SDimitry Andric #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rtm")))
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric static __inline__ unsigned int __DEFAULT_FN_ATTRS
_xbegin(void)300b57cec5SDimitry Andric _xbegin(void)
310b57cec5SDimitry Andric {
32*81ad6265SDimitry Andric   return (unsigned int)__builtin_ia32_xbegin();
330b57cec5SDimitry Andric }
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_xend(void)360b57cec5SDimitry Andric _xend(void)
370b57cec5SDimitry Andric {
380b57cec5SDimitry Andric   __builtin_ia32_xend();
390b57cec5SDimitry Andric }
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric #define _xabort(imm) __builtin_ia32_xabort((imm))
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS
440b57cec5SDimitry Andric 
450b57cec5SDimitry Andric #endif /* __RTMINTRIN_H */
46