21 #if !defined(__TBB_machine_H) || defined(__TBB_machine_gcc_itsx_H) 22 #error Do not #include this internal file directly; use public TBB headers instead. 25 #define __TBB_machine_gcc_itsx_H 27 #define __TBB_OP_XACQUIRE 0xF2 28 #define __TBB_OP_XRELEASE 0xF3 29 #define __TBB_OP_LOCK 0xF0 31 #define __TBB_STRINGIZE_INTERNAL(arg) #arg 32 #define __TBB_STRINGIZE(arg) __TBB_STRINGIZE_INTERNAL(arg) 35 #define __TBB_r_out "=r" 37 #define __TBB_r_out "=q" 40 inline static uint8_t __TBB_machine_try_lock_elided(
volatile uint8_t* lk )
43 __asm__
volatile (
".byte " __TBB_STRINGIZE(__TBB_OP_XACQUIRE)
"; lock; xchgb %0, %1;" 44 : __TBB_r_out(value),
"=m"(*lk) :
"0"(value),
"m"(*lk) :
"memory" );
45 return uint8_t(value^1);
48 inline static void __TBB_machine_try_lock_elided_cancel()
51 __asm__
volatile (
"pause\n" : : :
"memory" );
54 inline static void __TBB_machine_unlock_elided(
volatile uint8_t* lk )
56 __asm__
volatile (
".byte " __TBB_STRINGIZE(__TBB_OP_XRELEASE)
"; movb $0, %0" 57 :
"=m"(*lk) :
"m"(*lk) :
"memory" );
60 #if __TBB_TSX_INTRINSICS_PRESENT 61 #include <immintrin.h> 63 #define __TBB_machine_is_in_transaction _xtest 64 #define __TBB_machine_begin_transaction _xbegin 65 #define __TBB_machine_end_transaction _xend 66 #define __TBB_machine_transaction_conflict_abort() _xabort(0xff) 73 inline static bool __TBB_machine_is_in_transaction()
77 __asm__
volatile (
".byte 0x0F; .byte 0x01; .byte 0xD6;\n" 78 "setz %0" :
"=q"(res) : :
"memory" );
80 __asm__
volatile (
".byte 0x0F; .byte 0x01; .byte 0xD6;\n" 81 "setz %0" :
"=r"(res) : :
"memory" );
91 inline static uint32_t __TBB_machine_begin_transaction()
93 uint32_t res = ~uint32_t(0);
94 __asm__
volatile (
"1: .byte 0xC7; .byte 0xF8;\n" 103 :
"=r"(res):
"0"(res):
"memory",
"%eax");
110 inline static void __TBB_machine_end_transaction()
112 __asm__
volatile (
".byte 0x0F; .byte 0x01; .byte 0xD5" :::
"memory");
118 inline static void __TBB_machine_transaction_conflict_abort()
120 __asm__
volatile (
".byte 0xC6; .byte 0xF8; .byte 0xFF" :::
"memory");