Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
windows_ia32.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005-2020 Intel Corporation
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #if !defined(__TBB_machine_H) || defined(__TBB_machine_windows_ia32_H)
18 #error Do not #include this internal file directly; use public TBB headers instead.
19 #endif
20 
21 #define __TBB_machine_windows_ia32_H
22 
23 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
24  // Workaround for overzealous compiler warnings in /Wp64 mode
25  #pragma warning (push)
26  #pragma warning (disable: 4244 4267)
27 #endif
28 
29 #include "msvc_ia32_common.h"
30 
31 #define __TBB_WORDSIZE 4
32 #define __TBB_ENDIANNESS __TBB_ENDIAN_LITTLE
33 
34 extern "C" {
35  __int64 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp8 (volatile void *ptr, __int64 value, __int64 comparand );
36  __int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd8 (volatile void *ptr, __int64 addend );
37  __int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore8 (volatile void *ptr, __int64 value );
38  void __TBB_EXPORTED_FUNC __TBB_machine_store8 (volatile void *ptr, __int64 value );
39  __int64 __TBB_EXPORTED_FUNC __TBB_machine_load8 (const volatile void *ptr);
40 }
41 
42 #if !__TBB_MSVC_PART_WORD_INTERLOCKED_INTRINSICS_PRESENT
43 
44 #define __TBB_MACHINE_DEFINE_ATOMICS(S,T,U,A,C) \
45 static inline T __TBB_machine_cmpswp##S ( volatile void * ptr, U value, U comparand ) { \
46  T result; \
47  volatile T *p = (T *)ptr; \
48  __asm \
49  { \
50  __asm mov edx, p \
51  __asm mov C , value \
52  __asm mov A , comparand \
53  __asm lock cmpxchg [edx], C \
54  __asm mov result, A \
55  } \
56  return result; \
57 } \
58 \
59 static inline T __TBB_machine_fetchadd##S ( volatile void * ptr, U addend ) { \
60  T result; \
61  volatile T *p = (T *)ptr; \
62  __asm \
63  { \
64  __asm mov edx, p \
65  __asm mov A, addend \
66  __asm lock xadd [edx], A \
67  __asm mov result, A \
68  } \
69  return result; \
70 }\
71 \
72 static inline T __TBB_machine_fetchstore##S ( volatile void * ptr, U value ) { \
73  T result; \
74  volatile T *p = (T *)ptr; \
75  __asm \
76  { \
77  __asm mov edx, p \
78  __asm mov A, value \
79  __asm lock xchg [edx], A \
80  __asm mov result, A \
81  } \
82  return result; \
83 }
84 
85 
86 __TBB_MACHINE_DEFINE_ATOMICS(1, __int8, __int8, al, cl)
87 __TBB_MACHINE_DEFINE_ATOMICS(2, __int16, __int16, ax, cx)
88 __TBB_MACHINE_DEFINE_ATOMICS(4, ptrdiff_t, ptrdiff_t, eax, ecx)
89 
90 #undef __TBB_MACHINE_DEFINE_ATOMICS
91 
92 #endif /* __TBB_MSVC_PART_WORD_INTERLOCKED_INTRINSICS_PRESENT */
93 
94 //TODO: Check if it possible and profitable for IA-32 architecture on (Linux and Windows)
95 //to use of 64-bit load/store via floating point registers together with full fence
96 //for sequentially consistent load/store, instead of CAS.
97 #define __TBB_USE_FETCHSTORE_AS_FULL_FENCED_STORE 1
98 #define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE 1
99 #define __TBB_USE_GENERIC_RELAXED_LOAD_STORE 1
100 #define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE 1
101 
102 
103 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
104  #pragma warning (pop)
105 #endif // warnings 4244, 4267 are back
#define __TBB_MACHINE_DEFINE_ATOMICS(S, T, U, A, C)
Definition: windows_ia32.h:44
__int64 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp8(volatile void *ptr, __int64 value, __int64 comparand)
__int64 __TBB_EXPORTED_FUNC __TBB_machine_load8(const volatile void *ptr)
#define __TBB_EXPORTED_FUNC
__int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore8(volatile void *ptr, __int64 value)
void __TBB_EXPORTED_FUNC __TBB_machine_store8(volatile void *ptr, __int64 value)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
__int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd8(volatile void *ptr, __int64 addend)

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.