ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
windows_fix_intrin.h
Go to the documentation of this file.
1 /* This file is part of the Vc library.
2 
3  Copyright (C) 2009-2012 Matthias Kretz <kretz@kde.org>
4 
5  Vc is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as
7  published by the Free Software Foundation, either version 3 of
8  the License, or (at your option) any later version.
9 
10  Vc is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with Vc. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #ifndef VC_COMMON_WINDOWS_FIX_INTRIN_H
21 #define VC_COMMON_WINDOWS_FIX_INTRIN_H
22 
23 #if defined(VC_MSVC) && !defined(__midl)
24 // MSVC sucks. If you include intrin.h you get all SSE and AVX intrinsics
25 // declared. This is a problem because we need to implement the intrinsics
26 // that are not supported in hardware ourselves.
27 // Something always includes intrin.h even if you don't
28 // do it explicitly. Therefore we try to be the first to include it
29 // but with __midl defined, in which case it is basically empty.
30 #ifdef __INTRIN_H_
31 #error "intrin.h was already included, polluting the namespace. Please fix your code to include the Vc headers before anything that includes intrin.h. (Vc will declare the relevant intrinsics as they are required by some system headers.)"
32 #endif
33 #define __midl
34 #include <intrin.h>
35 #undef __midl
36 #include <crtdefs.h>
37 #include <setjmp.h>
38 #include <stddef.h>
39 extern "C" {
40 
41 #ifdef _WIN64
42 _CRTIMP double ceil(_In_ double);
43 __int64 _InterlockedDecrement64(__int64 volatile *);
44 __int64 _InterlockedExchange64(__int64 volatile *, __int64);
45 void * _InterlockedExchangePointer(void * volatile *, void *);
46 __int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64);
47 void *_InterlockedCompareExchangePointer (void * volatile *, void *, void *);
48 __int64 _InterlockedIncrement64(__int64 volatile *);
49 int __cdecl _setjmpex(jmp_buf);
50 void __faststorefence(void);
51 __int64 __mulh(__int64,__int64);
52 unsigned __int64 __umulh(unsigned __int64,unsigned __int64);
53 unsigned __int64 __readcr0(void);
54 unsigned __int64 __readcr2(void);
55 unsigned __int64 __readcr3(void);
56 unsigned __int64 __readcr4(void);
57 unsigned __int64 __readcr8(void);
58 void __writecr0(unsigned __int64);
59 void __writecr3(unsigned __int64);
60 void __writecr4(unsigned __int64);
61 void __writecr8(unsigned __int64);
62 unsigned __int64 __readdr(unsigned int);
63 void __writedr(unsigned int, unsigned __int64);
64 unsigned __int64 __readeflags(void);
65 void __writeeflags(unsigned __int64);
66 void __movsq(unsigned long long *, unsigned long long const *, size_t);
67 unsigned char __readgsbyte(unsigned long Offset);
68 unsigned short __readgsword(unsigned long Offset);
69 unsigned long __readgsdword(unsigned long Offset);
70 unsigned __int64 __readgsqword(unsigned long Offset);
71 void __writegsbyte(unsigned long Offset, unsigned char Data);
72 void __writegsword(unsigned long Offset, unsigned short Data);
73 void __writegsdword(unsigned long Offset, unsigned long Data);
74 void __writegsqword(unsigned long Offset, unsigned __int64 Data);
75 void __addgsbyte(unsigned long Offset, unsigned char Data);
76 void __addgsword(unsigned long Offset, unsigned short Data);
77 void __addgsdword(unsigned long Offset, unsigned long Data);
78 void __addgsqword(unsigned long Offset, unsigned __int64 Data);
79 void __incgsbyte(unsigned long Offset);
80 void __incgsword(unsigned long Offset);
81 void __incgsdword(unsigned long Offset);
82 void __incgsqword(unsigned long Offset);
83 unsigned char __vmx_vmclear(unsigned __int64*);
84 unsigned char __vmx_vmlaunch(void);
85 unsigned char __vmx_vmptrld(unsigned __int64*);
86 unsigned char __vmx_vmread(size_t, size_t*);
87 unsigned char __vmx_vmresume(void);
88 unsigned char __vmx_vmwrite(size_t, size_t);
89 unsigned char __vmx_on(unsigned __int64*);
90 void __stosq(unsigned __int64 *, unsigned __int64, size_t);
91 unsigned char _interlockedbittestandset64(__int64 volatile *a, __int64 b);
92 unsigned char _interlockedbittestandreset64(__int64 volatile *a, __int64 b);
93 short _InterlockedCompareExchange16_np(short volatile *Destination, short Exchange, short Comparand);
94 long _InterlockedCompareExchange_np (long volatile *, long, long);
95 __int64 _InterlockedCompareExchange64_np(__int64 volatile *, __int64, __int64);
96 void *_InterlockedCompareExchangePointer_np (void * volatile *, void *, void *);
97 unsigned char _InterlockedCompareExchange128(__int64 volatile *, __int64, __int64, __int64 *);
98 unsigned char _InterlockedCompareExchange128_np(__int64 volatile *, __int64, __int64, __int64 *);
99 long _InterlockedAnd_np(long volatile *, long);
100 char _InterlockedAnd8_np(char volatile *, char);
101 short _InterlockedAnd16_np(short volatile *, short);
102 __int64 _InterlockedAnd64_np(__int64 volatile *, __int64);
103 long _InterlockedOr_np(long volatile *, long);
104 char _InterlockedOr8_np(char volatile *, char);
105 short _InterlockedOr16_np(short volatile *, short);
106 __int64 _InterlockedOr64_np(__int64 volatile *, __int64);
107 long _InterlockedXor_np(long volatile *, long);
108 char _InterlockedXor8_np(char volatile *, char);
109 short _InterlockedXor16_np(short volatile *, short);
110 __int64 _InterlockedXor64_np(__int64 volatile *, __int64);
111 unsigned __int64 __lzcnt64(unsigned __int64);
112 unsigned __int64 __popcnt64(unsigned __int64);
113 __int64 _InterlockedOr64(__int64 volatile *, __int64);
114 __int64 _InterlockedXor64(__int64 volatile *, __int64);
115 __int64 _InterlockedAnd64(__int64 volatile *, __int64);
116 unsigned char _bittest64(__int64 const *a, __int64 b);
117 unsigned char _bittestandset64(__int64 *a, __int64 b);
118 unsigned char _bittestandreset64(__int64 *a, __int64 b);
119 unsigned char _bittestandcomplement64(__int64 *a, __int64 b);
120 unsigned char _BitScanForward64(unsigned long* Index, unsigned __int64 Mask);
121 unsigned char _BitScanReverse64(unsigned long* Index, unsigned __int64 Mask);
122 unsigned __int64 __shiftleft128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift);
123 unsigned __int64 __shiftright128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift);
124 unsigned __int64 _umul128(unsigned __int64 multiplier, unsigned __int64 multiplicand, unsigned __int64 *highproduct);
125 __int64 _mul128(__int64 multiplier, __int64 multiplicand, __int64 *highproduct);
126 #endif
127 
128 long _InterlockedOr(long volatile *, long);
129 char _InterlockedOr8(char volatile *, char);
130 short _InterlockedOr16(short volatile *, short);
131 long _InterlockedXor(long volatile *, long);
132 char _InterlockedXor8(char volatile *, char);
133 short _InterlockedXor16(short volatile *, short);
134 long _InterlockedAnd(long volatile *, long);
135 char _InterlockedAnd8(char volatile *, char);
136 short _InterlockedAnd16(short volatile *, short);
137 unsigned char _bittest(long const *a, long b);
138 unsigned char _bittestandset(long *a, long b);
139 unsigned char _bittestandreset(long *a, long b);
140 unsigned char _bittestandcomplement(long *a, long b);
141 unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
142 unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask);
143 _CRTIMP wchar_t * __cdecl wcscat( _Pre_cap_for_(_Source) _Prepost_z_ wchar_t *, _In_z_ const wchar_t * _Source);
144 _Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *,_In_z_ const wchar_t *);
145 _CRTIMP wchar_t * __cdecl wcscpy(_Pre_cap_for_(_Source) _Post_z_ wchar_t *, _In_z_ const wchar_t * _Source);
146 _Check_return_ _CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *);
147 #pragma warning(suppress: 4985)
148 _CRTIMP wchar_t * __cdecl _wcsset(_Inout_z_ wchar_t *, wchar_t);
149 void _ReadBarrier(void);
150 unsigned char _rotr8(unsigned char value, unsigned char shift);
151 unsigned short _rotr16(unsigned short value, unsigned char shift);
152 unsigned char _rotl8(unsigned char value, unsigned char shift);
153 unsigned short _rotl16(unsigned short value, unsigned char shift);
154 short _InterlockedIncrement16(short volatile *Addend);
155 short _InterlockedDecrement16(short volatile *Addend);
156 short _InterlockedCompareExchange16(short volatile *Destination, short Exchange, short Comparand);
157 void __nvreg_save_fence(void);
158 void __nvreg_restore_fence(void);
159 
160 #ifdef _M_IX86
161 unsigned long __readcr0(void);
162 unsigned long __readcr2(void);
163 unsigned long __readcr3(void);
164 unsigned long __readcr4(void);
165 unsigned long __readcr8(void);
166 void __writecr0(unsigned);
167 void __writecr3(unsigned);
168 void __writecr4(unsigned);
169 void __writecr8(unsigned);
170 unsigned __readdr(unsigned int);
171 void __writedr(unsigned int, unsigned);
172 unsigned __readeflags(void);
173 void __writeeflags(unsigned);
174 void __addfsbyte(unsigned long Offset, unsigned char Data);
175 void __addfsword(unsigned long Offset, unsigned short Data);
176 void __addfsdword(unsigned long Offset, unsigned long Data);
177 void __incfsbyte(unsigned long Offset);
178 void __incfsword(unsigned long Offset);
179 void __incfsdword(unsigned long Offset);
180 unsigned char __readfsbyte(unsigned long Offset);
181 unsigned short __readfsword(unsigned long Offset);
182 unsigned long __readfsdword(unsigned long Offset);
183 unsigned __int64 __readfsqword(unsigned long Offset);
184 void __writefsbyte(unsigned long Offset, unsigned char Data);
185 void __writefsword(unsigned long Offset, unsigned short Data);
186 void __writefsdword(unsigned long Offset, unsigned long Data);
187 void __writefsqword(unsigned long Offset, unsigned __int64 Data);
188 long _InterlockedAddLargeStatistic(__int64 volatile *, long);
189 #endif
190 
191 _Ret_bytecap_(_Size) void * __cdecl _alloca(size_t _Size);
192 int __cdecl abs(_In_ int);
193 _Check_return_ unsigned short __cdecl _byteswap_ushort(_In_ unsigned short value);
194 _Check_return_ unsigned long __cdecl _byteswap_ulong(_In_ unsigned long value);
195 _Check_return_ unsigned __int64 __cdecl _byteswap_uint64(_In_ unsigned __int64 value);
196 void __cdecl __debugbreak(void);
197 void __cdecl _disable(void);
198 __int64 __emul(int,int);
199 unsigned __int64 __emulu(unsigned int,unsigned int);
200 void __cdecl _enable(void);
201 long __cdecl _InterlockedDecrement(long volatile *);
202 long _InterlockedExchange(long volatile *, long);
203 short _InterlockedExchange16(short volatile *, short);
204 char _InterlockedExchange8(char volatile *, char);
205 long _InterlockedExchangeAdd(long volatile *, long);
206 short _InterlockedExchangeAdd16(short volatile *, short);
207 char _InterlockedExchangeAdd8(char volatile *, char);
208 long _InterlockedCompareExchange (long volatile *, long, long);
209 __int64 _InterlockedCompareExchange64(__int64 volatile *, __int64, __int64);
210 long __cdecl _InterlockedIncrement(long volatile *);
211 int __cdecl _inp(unsigned short);
212 int __cdecl inp(unsigned short);
213 unsigned long __cdecl _inpd(unsigned short);
214 unsigned long __cdecl inpd(unsigned short);
215 unsigned short __cdecl _inpw(unsigned short);
216 unsigned short __cdecl inpw(unsigned short);
217 long __cdecl labs(_In_ long);
218 _Check_return_ unsigned long __cdecl _lrotl(_In_ unsigned long,_In_ int);
219 _Check_return_ unsigned long __cdecl _lrotr(_In_ unsigned long,_In_ int);
220 unsigned __int64 __ll_lshift(unsigned __int64,int);
221 __int64 __ll_rshift(__int64,int);
222 _Check_return_ int __cdecl memcmp(_In_opt_bytecount_(_Size) const void *,_In_opt_bytecount_(_Size) const void *,_In_ size_t _Size);
223 void * __cdecl memcpy(_Out_opt_bytecapcount_(_Size) void *,_In_opt_bytecount_(_Size) const void *,_In_ size_t _Size);
224 void * __cdecl memset(_Out_opt_bytecapcount_(_Size) void *,_In_ int,_In_ size_t _Size);
225 int __cdecl _outp(unsigned short,int);
226 int __cdecl outp(unsigned short,int);
227 unsigned long __cdecl _outpd(unsigned short,unsigned long);
228 unsigned long __cdecl outpd(unsigned short,unsigned long);
229 unsigned short __cdecl _outpw(unsigned short,unsigned short);
230 unsigned short __cdecl outpw(unsigned short,unsigned short);
231 void * _ReturnAddress(void);
232 _Check_return_ unsigned int __cdecl _rotl(_In_ unsigned int,_In_ int);
233 _Check_return_ unsigned int __cdecl _rotr(_In_ unsigned int,_In_ int);
234 int __cdecl _setjmp(jmp_buf);
235 _Check_return_ int __cdecl strcmp(_In_z_ const char *,_In_z_ const char *);
236 _Check_return_ size_t __cdecl strlen(_In_z_ const char *);
237 char * __cdecl strset(_Inout_z_ char *,_In_ int);
238 unsigned __int64 __ull_rshift(unsigned __int64,int);
239 void * _AddressOfReturnAddress(void);
240 
241 void _WriteBarrier(void);
242 void _ReadWriteBarrier(void);
243 void __wbinvd(void);
244 void __invlpg(void*);
245 unsigned __int64 __readmsr(unsigned long);
246 void __writemsr(unsigned long, unsigned __int64);
247 unsigned __int64 __rdtsc(void);
248 void __movsb(unsigned char *, unsigned char const *, size_t);
249 void __movsw(unsigned short *, unsigned short const *, size_t);
250 void __movsd(unsigned long *, unsigned long const *, size_t);
251 unsigned char __inbyte(unsigned short Port);
252 unsigned short __inword(unsigned short Port);
253 unsigned long __indword(unsigned short Port);
254 void __outbyte(unsigned short Port, unsigned char Data);
255 void __outword(unsigned short Port, unsigned short Data);
256 void __outdword(unsigned short Port, unsigned long Data);
257 void __inbytestring(unsigned short Port, unsigned char *Buffer, unsigned long Count);
258 void __inwordstring(unsigned short Port, unsigned short *Buffer, unsigned long Count);
259 void __indwordstring(unsigned short Port, unsigned long *Buffer, unsigned long Count);
260 void __outbytestring(unsigned short Port, unsigned char *Buffer, unsigned long Count);
261 void __outwordstring(unsigned short Port, unsigned short *Buffer, unsigned long Count);
262 void __outdwordstring(unsigned short Port, unsigned long *Buffer, unsigned long Count);
263 unsigned int __getcallerseflags();
264 void __vmx_vmptrst(unsigned __int64 *);
265 void __vmx_off(void);
266 void __svm_clgi(void);
267 void __svm_invlpga(void*, int);
268 void __svm_skinit(int);
269 void __svm_stgi(void);
270 void __svm_vmload(size_t);
271 void __svm_vmrun(size_t);
272 void __svm_vmsave(size_t);
273 void __halt(void);
274 void __sidt(void*);
275 void __lidt(void*);
276 void __ud2(void);
277 void __nop(void);
278 void __stosb(unsigned char *, unsigned char, size_t);
279 void __stosw(unsigned short *, unsigned short, size_t);
280 void __stosd(unsigned long *, unsigned long, size_t);
281 unsigned char _interlockedbittestandset(long volatile *a, long b);
282 unsigned char _interlockedbittestandreset(long volatile *a, long b);
283 void __cpuid(int a[4], int b);
284 void __cpuidex(int a[4], int b, int c);
285 unsigned __int64 __readpmc(unsigned long a);
286 unsigned long __segmentlimit(unsigned long a);
287 _Check_return_ unsigned __int64 __cdecl _rotl64(_In_ unsigned __int64,_In_ int);
288 _Check_return_ unsigned __int64 __cdecl _rotr64(_In_ unsigned __int64,_In_ int);
289 __int64 __cdecl _abs64(__int64);
290 void __int2c(void);
291 char _InterlockedCompareExchange8(char volatile *Destination, char Exchange, char Comparand);
292 unsigned short __lzcnt16(unsigned short);
293 unsigned int __lzcnt(unsigned int);
294 unsigned short __popcnt16(unsigned short);
295 unsigned int __popcnt(unsigned int);
296 unsigned __int64 __rdtscp(unsigned int*);
297 }
298 #endif
299 
300 #endif // VC_COMMON_WINDOWS_FIX_INTRIN_H
RooCmdArg Offset(Bool_t flag=kTRUE)
static void __cpuid(int *cpuid_data, int)
void * _ReturnAddress(void)
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
Definition: vector.h:450
RooCmdArg Index(RooCategory &icat)
__int64 __rdtsc()
double ceil(double)