17 #if !defined(__TBB_machine_H) || defined(__TBB_machine_icc_generic_H)
18 #error Do not #include this internal file directly; use public TBB headers instead.
21 #if ! __TBB_ICC_BUILTIN_ATOMICS_PRESENT
22 #error "Intel(R) C++ Compiler of at least 12.0 version is needed to use ICC intrinsics port"
25 #define __TBB_machine_icc_generic_H
38 #define __TBB_WORDSIZE 4
40 #define __TBB_WORDSIZE 8
42 #define __TBB_ENDIANNESS __TBB_ENDIAN_LITTLE
45 #ifndef __TBB_compiler_fence
48 #pragma intrinsic(_ReadWriteBarrier)
49 #define __TBB_compiler_fence() _ReadWriteBarrier()
51 #define __TBB_compiler_fence() __asm__ __volatile__("": : :"memory")
55 #ifndef __TBB_full_memory_fence
58 #pragma intrinsic(_mm_mfence)
59 #define __TBB_full_memory_fence() _mm_mfence()
61 #define __TBB_full_memory_fence() __asm__ __volatile__("mfence": : :"memory")
65 #ifndef __TBB_control_consistency_helper
66 #define __TBB_control_consistency_helper() __TBB_compiler_fence()
79 namespace icc_intrinsics_port {
93 template <
typename T,
size_t S>
103 template <
typename T,
size_t S>
105 static inline T
load (
const T& location ) {
113 template <
typename T,
size_t S>
115 static T
load (
const volatile T& location ) {
126 namespace tbb{
namespace internal {
namespace icc_intrinsics_port{
135 #define __TBB_MACHINE_DEFINE_ATOMICS(S,T,M) \
136 inline T __TBB_machine_cmpswp##S##M( volatile void *ptr, T value, T comparand ) { \
137 __atomic_compare_exchange_strong_explicit( \
141 , tbb::internal::icc_intrinsics_port::M \
142 , tbb::internal::icc_intrinsics_port::M); \
146 inline T __TBB_machine_fetchstore##S##M(volatile void *ptr, T value) { \
147 return __atomic_exchange_explicit((T*)ptr, value, tbb::internal::icc_intrinsics_port::M); \
150 inline T __TBB_machine_fetchadd##S##M(volatile void *ptr, T value) { \
151 return __atomic_fetch_add_explicit((T*)ptr, value, tbb::internal::icc_intrinsics_port::M); \
175 #undef __TBB_MACHINE_DEFINE_ATOMICS
177 #define __TBB_USE_FENCED_ATOMICS 1
180 #if __TBB_FORCE_64BIT_ALIGNMENT_BROKEN
190 template <
typename T>
191 struct machine_load_store<T,8> {
196 return __TBB_machine_generic_load8acquire(&location);
203 return __TBB_machine_generic_store8release(&location,
value);
208 template <
typename T>
209 struct machine_load_store_relaxed<T,8> {
210 static T
load(
const volatile T& location ) {
214 return __TBB_machine_generic_load8relaxed(&location);
217 static void store(
volatile T &location, T
value ) {
221 return __TBB_machine_generic_store8relaxed(&location,
value);
226 template <
typename T >
227 struct machine_load_store_seq_cst<T,8> {
228 static T
load (
const volatile T& location ) {
232 return __TBB_machine_generic_load8full_fence(&location);
237 static void store (
volatile T &location, T
value ) {
241 return __TBB_machine_generic_store8full_fence(&location,
value);
249 template <
typename T>
254 template <
typename T>