1 /*===---- rtmintrin.h - RTM intrinsics -------------------------------------=== 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 *===-----------------------------------------------------------------------=== 8 */ 9 10 #ifndef __IMMINTRIN_H 11 #error "Never use <rtmintrin.h> directly; include <immintrin.h> instead." 12 #endif 13 14 #ifndef __RTMINTRIN_H 15 #define __RTMINTRIN_H 16 17 #define _XBEGIN_STARTED (~0u) 18 #define _XABORT_EXPLICIT (1 << 0) 19 #define _XABORT_RETRY (1 << 1) 20 #define _XABORT_CONFLICT (1 << 2) 21 #define _XABORT_CAPACITY (1 << 3) 22 #define _XABORT_DEBUG (1 << 4) 23 #define _XABORT_NESTED (1 << 5) 24 #define _XABORT_CODE(x) (((x) >> 24) & 0xFF) 25 26 /* Define the default attributes for the functions in this file. */ 27 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rtm"))) 28 29 static __inline__ unsigned int __DEFAULT_FN_ATTRS 30 _xbegin(void) 31 { 32 return (unsigned int)__builtin_ia32_xbegin(); 33 } 34 35 static __inline__ void __DEFAULT_FN_ATTRS 36 _xend(void) 37 { 38 __builtin_ia32_xend(); 39 } 40 41 #define _xabort(imm) __builtin_ia32_xabort((imm)) 42 43 #undef __DEFAULT_FN_ATTRS 44 45 #endif /* __RTMINTRIN_H */ 46