[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | /* There are 3 separate ways this file is intended to be used:
|
---|
| 8 |
|
---|
| 9 | 1) Included from intrin.h. In this case, all intrinsics in this file get declarations and
|
---|
| 10 | implementations. No special #defines are needed for this case.
|
---|
| 11 |
|
---|
| 12 | 2) Included from the library versions of these functions (ie mingw-w64-crt\intrincs\*.c). All
|
---|
| 13 | intrinsics in this file must also be included in the library. In this case, only the
|
---|
| 14 | specific functions requested will get defined, and they will not be defined as inline. If
|
---|
| 15 | you have followed the instructions (below) for adding functions to this file, then all you
|
---|
| 16 | need to have in the .c file is the following:
|
---|
| 17 |
|
---|
| 18 | #define __INTRINSIC_ONLYSPECIAL
|
---|
| 19 | #define __INTRINSIC_SPECIAL___stosb // Causes code generation in intrin-impl.h
|
---|
| 20 |
|
---|
| 21 | #include <intrin.h>
|
---|
| 22 |
|
---|
| 23 | 3) Included from various platform sdk headers. Some platform sdk headers (such as winnt.h)
|
---|
| 24 | define a subset of intrinsics. To avoid potential conflicts, this file is designed to
|
---|
| 25 | allow for specific subsets of functions to be defined. This is done by defining the
|
---|
| 26 | appropriate variable before including this file:
|
---|
| 27 |
|
---|
| 28 | #define __INTRINSIC_GROUP_WINNT
|
---|
| 29 | #include <psdk_inc/intrin-impl.h>
|
---|
| 30 |
|
---|
| 31 | In all cases, it is acceptable to include this file multiple times in any order (ie include
|
---|
| 32 | winnt.h to get its subset, then include intrin.h to get everything, or vice versa).
|
---|
| 33 |
|
---|
| 34 | See also the comments at the top of intrin.h.
|
---|
| 35 | */
|
---|
| 36 |
|
---|
| 37 | /* To add an implementation for a new intrinsic to this file, you should comment out the current prototype in intrin.h.
|
---|
| 38 | If the function you are adding is not in intrin.h, you should not be adding it to this file. This file is only
|
---|
| 39 | for MSVC intrinsics.
|
---|
| 40 |
|
---|
| 41 | Make sure you put your definition in the right section (x86 vs x64), and use this outline when adding definitions
|
---|
| 42 | to this file:
|
---|
| 43 |
|
---|
| 44 | #if __INTRINSIC_PROLOG(__int2c)
|
---|
| 45 |
|
---|
| 46 | <prototype goes here>
|
---|
| 47 |
|
---|
| 48 | __INTRINSICS_USEINLINE
|
---|
| 49 | <code goes here>
|
---|
| 50 |
|
---|
| 51 | #define __INTRINSIC_DEFINED___int2c
|
---|
| 52 | #endif
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /* Note that there is no file-wide #if to prevent intrin-impl.h from being
|
---|
| 56 | included multiple times. This is because this file might be included multiple
|
---|
| 57 | times to define various subsets of the functions it contains. */
|
---|
| 58 |
|
---|
| 59 | /* However we do check for __MINGW_INTRIN_INLINE. In theory this means we
|
---|
| 60 | can work with other compilers. */
|
---|
| 61 |
|
---|
| 62 | #ifdef __MINGW_INTRIN_INLINE
|
---|
| 63 |
|
---|
| 64 | /* Clang has support for MSVC builtins, GCC doesn't */
|
---|
| 65 | #pragma push_macro("__has_builtin")
|
---|
| 66 | #ifndef __has_builtin
|
---|
| 67 | #define __has_builtin(x) 0
|
---|
| 68 | #endif
|
---|
| 69 |
|
---|
| 70 | /* These macros are used by the routines below. While this file may be included
|
---|
| 71 | multiple times, these macros only need to be defined once. */
|
---|
| 72 | #ifndef _INTRIN_MAC_
|
---|
| 73 | #define _INTRIN_MAC_
|
---|
| 74 |
|
---|
| 75 | /* GCC v6 added support for outputting flags. This allows better code to be
|
---|
| 76 | produced for a number of intrinsics. */
|
---|
| 77 | #ifndef __GCC_ASM_FLAG_OUTPUTS__
|
---|
| 78 | #define __FLAGCONSTRAINT "=qm"
|
---|
| 79 | #define __FLAGSET "\n\tsetc %[old]"
|
---|
| 80 | #define __FLAGCLOBBER1 , "cc"
|
---|
| 81 | #define __FLAGCLOBBER2 "cc"
|
---|
| 82 | #else
|
---|
| 83 | #define __FLAGCONSTRAINT "=@ccc"
|
---|
| 84 | #define __FLAGSET
|
---|
| 85 | #define __FLAGCLOBBER1
|
---|
| 86 | #define __FLAGCLOBBER2
|
---|
| 87 | #endif
|
---|
| 88 |
|
---|
| 89 | /* This macro is used by __stosb, __stosw, __stosd, __stosq */
|
---|
| 90 |
|
---|
| 91 | /* Parameters: (FunctionName, DataType, Operator)
|
---|
| 92 | FunctionName: Any valid function name
|
---|
| 93 | DataType: BYTE, WORD, DWORD or DWORD64
|
---|
| 94 | InstructionSize: b|b, w|w, l|d, q|q */
|
---|
| 95 |
|
---|
| 96 | /* While we don't need the output values for Dest or Count, we
|
---|
| 97 | must still inform the compiler the asm changes them. */
|
---|
| 98 | #define __buildstos(x, y, z) void x(y *Dest, y Data, size_t Count) \
|
---|
| 99 | { \
|
---|
| 100 | __asm__ __volatile__ ("rep stos{" z "}" \
|
---|
| 101 | : "+D" (Dest), "+c" (Count) \
|
---|
| 102 | : [Data] "a" (Data) \
|
---|
| 103 | : "memory"); \
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | /* This macro is used by InterlockedAnd, InterlockedOr, InterlockedXor, InterlockedAnd64, InterlockedOr64, InterlockedXor64 */
|
---|
| 107 |
|
---|
| 108 | /* Parameters: (FunctionName, DataType, Operator)
|
---|
| 109 | FunctionName: Any valid function name
|
---|
| 110 | DataType: __LONG32 or __int64
|
---|
| 111 | Operator: One of xor, or, and */
|
---|
| 112 | #define __buildlogicali(x, y, o) y x(volatile y *Destination, y Value) \
|
---|
| 113 | { \
|
---|
| 114 | return __sync_fetch_and_ ## o(Destination, Value); \
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | /* This macro is used by InterlockedBitTestAndSet, InterlockedBitTestAndReset, InterlockedBitTestAndComplement,
|
---|
| 118 | InterlockedBitTestAndSet64, InterlockedBitTestAndReset64, InterlockedBitTestAndComplement64
|
---|
| 119 | _interlockedbittestandset, _interlockedbittestandreset, _interlockedbittestandcomplement
|
---|
| 120 | _interlockedbittestandset64, _interlockedbittestandreset64, _interlockedbittestandcomplement64 */
|
---|
| 121 |
|
---|
| 122 | /* Parameters: (FunctionName, DataType, AsmCode, OffsetConstraint)
|
---|
| 123 | FunctionName: Any valid function name
|
---|
| 124 | DataType: __LONG32 or __int64
|
---|
| 125 | OffsetConstraint: either "I" for 32bit data types or "J" for 64. */
|
---|
| 126 | #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_)
|
---|
| 127 | #define __buildbittesti(x, y, z, a) unsigned char x(y volatile *Base, y Offset) \
|
---|
| 128 | { \
|
---|
| 129 | unsigned char old; \
|
---|
| 130 | __asm__ __volatile__ (z \
|
---|
| 131 | : [old] __FLAGCONSTRAINT (old), [Base] "+m" (*Base) \
|
---|
| 132 | : [Offset] a "r" (Offset) \
|
---|
| 133 | : "memory" __FLAGCLOBBER1); \
|
---|
| 134 | return old; \
|
---|
| 135 | }
|
---|
| 136 | #elif defined(__arm__) || defined(_ARM_)
|
---|
| 137 | #define __buildbittesti(x, y, z, a) unsigned char x(y volatile *Base, y Offset) \
|
---|
| 138 | { \
|
---|
| 139 | unsigned int old, tmp1, tmp2; \
|
---|
| 140 | unsigned int bit = 1 << Offset; \
|
---|
| 141 | __asm__ __volatile__ ("dmb sy\n\t" \
|
---|
| 142 | "1: ldrex %[old], %[Base]\n\t" \
|
---|
| 143 | "mov %[tmp1], %[old]\n\t" \
|
---|
| 144 | z " %[tmp1], %[tmp1], %[bit]\n\t" \
|
---|
| 145 | "strex %[tmp2], %[tmp1], %[Base]\n\t" \
|
---|
| 146 | "cmp %[tmp2], #0\n\t" \
|
---|
| 147 | "bne 1b\n\t" \
|
---|
| 148 | "dmb sy" \
|
---|
| 149 | : [old] "=&r" (old), [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [Base] "+m" (*Base) \
|
---|
| 150 | : [bit] a "r" (bit) \
|
---|
| 151 | : "memory", "cc"); \
|
---|
| 152 | return (old >> Offset) & 1; \
|
---|
| 153 | }
|
---|
| 154 | #elif defined(__aarch64__) || defined(_ARM64_)
|
---|
| 155 | #define __buildbittesti(x, y, z, a) unsigned char x(y volatile *Base, y Offset) \
|
---|
| 156 | { \
|
---|
| 157 | unsigned int old, tmp1, tmp2; \
|
---|
| 158 | unsigned int bit = 1 << Offset; \
|
---|
| 159 | __asm__ __volatile__ ("dmb sy\n\t" \
|
---|
| 160 | "1: ldxr %w[old], %[Base]\n\t" \
|
---|
| 161 | "mov %w[tmp1], %w[old]\n\t" \
|
---|
| 162 | z " %w[tmp1], %w[tmp1], %w[bit]\n\t" \
|
---|
| 163 | "stxr %w[tmp2], %w[tmp1], %[Base]\n\t" \
|
---|
| 164 | "cmp %w[tmp2], #0\n\t" \
|
---|
| 165 | "b.ne 1b\n\t" \
|
---|
| 166 | "dmb sy" \
|
---|
| 167 | : [old] "=&r" (old), [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [Base] "+m" (*Base) \
|
---|
| 168 | : [bit] a "r" (bit) \
|
---|
| 169 | : "memory", "cc"); \
|
---|
| 170 | return (old >> Offset) & 1; \
|
---|
| 171 | }
|
---|
| 172 | #define __buildbittesti64(x, y, z, a) unsigned char x(y volatile *Base, y Offset) \
|
---|
| 173 | { \
|
---|
| 174 | unsigned __int64 old, tmp1; \
|
---|
| 175 | unsigned int tmp2; \
|
---|
| 176 | unsigned __int64 bit = 1ULL << Offset; \
|
---|
| 177 | __asm__ __volatile__ ("dmb sy\n\t" \
|
---|
| 178 | "1: ldxr %[old], %[Base]\n\t" \
|
---|
| 179 | "mov %[tmp1], %[old]\n\t" \
|
---|
| 180 | z " %[tmp1], %[tmp1], %[bit]\n\t" \
|
---|
| 181 | "stxr %w[tmp2], %[tmp1], %[Base]\n\t" \
|
---|
| 182 | "cmp %w[tmp2], #0\n\t" \
|
---|
| 183 | "b.ne 1b\n\t" \
|
---|
| 184 | "dmb sy" \
|
---|
| 185 | : [old] "=&r" (old), [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [Base] "+m" (*Base) \
|
---|
| 186 | : [bit] a "r" (bit) \
|
---|
| 187 | : "memory", "cc"); \
|
---|
| 188 | return (old >> Offset) & 1; \
|
---|
| 189 | }
|
---|
| 190 | #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) */
|
---|
| 191 |
|
---|
| 192 | /* This macro is used by YieldProcessor when compiling x86 w/o SSE2.
|
---|
| 193 | It generates the same opcodes as _mm_pause. */
|
---|
| 194 | #define __buildpause() __asm__ __volatile__("rep nop")
|
---|
| 195 |
|
---|
| 196 | /* This macro is used by DbgRaiseAssertionFailure and __int2c
|
---|
| 197 |
|
---|
| 198 | Parameters: (IntNum)
|
---|
| 199 | IntNum: Interrupt number in hex */
|
---|
| 200 | #define __buildint(a) __asm__ __volatile__("int {$}" #a :)
|
---|
| 201 |
|
---|
| 202 | /* This macro is used by MemoryBarrier when compiling x86 w/o SSE2.
|
---|
| 203 | Note that on i386, xchg performs an implicit lock. */
|
---|
| 204 | #define __buildmemorybarrier() \
|
---|
| 205 | { \
|
---|
| 206 | unsigned char Barrier; \
|
---|
| 207 | __asm__ __volatile__("xchg{b %%| }al, %0" :"=m" (Barrier) : /* no inputs */ : "eax", "memory"); \
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | /* This macro is used by __readfsbyte, __readfsword, __readfsdword
|
---|
| 211 | __readgsbyte, __readgsword, __readgsdword, __readgsqword
|
---|
| 212 |
|
---|
| 213 | Parameters: (FunctionName, DataType, Segment)
|
---|
| 214 | FunctionName: Any valid function name
|
---|
| 215 | DataType: char, short, __LONG32 or __int64
|
---|
| 216 | Segment: fs or gs
|
---|
| 217 | Type: b, w, l, q
|
---|
| 218 | */
|
---|
| 219 |
|
---|
| 220 | #define __buildreadseg(x, y, z, a) y x(unsigned __LONG32 Offset) { \
|
---|
| 221 | y ret; \
|
---|
| 222 | __asm__ ("mov{" a " %%" z ":%[offset], %[ret] | %[ret], %%" z ":%[offset]}" \
|
---|
| 223 | : [ret] "=r" (ret) \
|
---|
| 224 | : [offset] "m" ((*(y *) (size_t) Offset))); \
|
---|
| 225 | return ret; \
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | /* This macro is used by __writefsbyte, __writefsword, __writefsdword
|
---|
| 229 | __writegsbyte, __writegsword, __writegsdword, __writegsqword
|
---|
| 230 |
|
---|
| 231 | Parameters: (FunctionName, DataType, Segment)
|
---|
| 232 | FunctionName: Any valid function name
|
---|
| 233 | DataType: char, short, __LONG32 or __int64
|
---|
| 234 | Segment: fs or gs
|
---|
| 235 | Type: b, w, l, q
|
---|
| 236 | */
|
---|
| 237 |
|
---|
| 238 | #define __buildwriteseg(x, y, z, a) void x(unsigned __LONG32 Offset, y Data) { \
|
---|
| 239 | __asm__ ("mov{" a " %[Data], %%" z ":%[offset] | %%" z ":%[offset], %[Data]}" \
|
---|
| 240 | : [offset] "=m" ((*(y *) (size_t) Offset)) \
|
---|
| 241 | : [Data] "ri" (Data)); \
|
---|
| 242 | }
|
---|
| 243 |
|
---|
| 244 | /* This macro is used by _BitScanForward, _BitScanForward64, _BitScanReverse _BitScanReverse64
|
---|
| 245 |
|
---|
| 246 | Parameters: (FunctionName, DataType, Segment)
|
---|
| 247 | FunctionName: Any valid function name
|
---|
| 248 | DataType: unsigned __LONG32 or unsigned __int64
|
---|
| 249 | Statement: BSF or BSR */
|
---|
| 250 |
|
---|
| 251 | /* GCC v6 added support for outputting flags. This allows better code to be
|
---|
| 252 | produced for a number of intrinsics. */
|
---|
| 253 | #ifndef __GCC_ASM_FLAG_OUTPUTS__
|
---|
| 254 | #define __buildbitscan(x, y, z) unsigned char x(unsigned __LONG32 *Index, y Mask) \
|
---|
| 255 | { \
|
---|
| 256 | y n; \
|
---|
| 257 | __asm__ (z \
|
---|
| 258 | : [Index] "=r" (n) \
|
---|
| 259 | : [Mask] "r" (Mask) \
|
---|
| 260 | : "cc"); \
|
---|
| 261 | *Index = n; \
|
---|
| 262 | return Mask!=0; \
|
---|
| 263 | }
|
---|
| 264 | #else
|
---|
| 265 | #define __buildbitscan(x, y, z) unsigned char x(unsigned __LONG32 *Index, y Mask) \
|
---|
| 266 | { \
|
---|
| 267 | y n; \
|
---|
| 268 | unsigned char old; \
|
---|
| 269 | __asm__ (z \
|
---|
| 270 | : "=@ccnz" (old), [Index] "=r" (n) \
|
---|
| 271 | : [Mask] "r" (Mask)); \
|
---|
| 272 | *Index = n; \
|
---|
| 273 | return old; \
|
---|
| 274 | }
|
---|
| 275 | #endif
|
---|
| 276 |
|
---|
| 277 | /* This macro is used by _bittest & _bittest64
|
---|
| 278 |
|
---|
| 279 | Parameters: (FunctionName, DataType, OffsetConstraint)
|
---|
| 280 | FunctionName: Any valid function name
|
---|
| 281 | DataType: __LONG32 or __int64
|
---|
| 282 | Type: l, q
|
---|
| 283 | OffsetConstraint: either "I" for 32bit data types or "J" for 64.
|
---|
| 284 |
|
---|
| 285 | */
|
---|
| 286 | #define __buildbittest(x, y, z, a) unsigned char x(const y *Base, y Offset) \
|
---|
| 287 | { \
|
---|
| 288 | unsigned char old; \
|
---|
| 289 | __asm__ ("bt{" z " %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET \
|
---|
| 290 | : [old] __FLAGCONSTRAINT (old) \
|
---|
| 291 | : [Offset] a "r" (Offset), [Base] "rm" (*Base) \
|
---|
| 292 | : __FLAGCLOBBER2); \
|
---|
| 293 | return old; \
|
---|
| 294 | }
|
---|
| 295 |
|
---|
| 296 | /* This macro is used by _bittestandset, _bittestandreset, _bittestandcomplement,
|
---|
| 297 | _bittestandset64, _bittestandreset64, _bittestandcomplement64
|
---|
| 298 |
|
---|
| 299 | Parameters: (FunctionName, DataType, Statement, OffsetConstraint)
|
---|
| 300 | FunctionName: Any valid function name
|
---|
| 301 | DataType: __LONG32 or __int64
|
---|
| 302 | Statement: asm statement (bts, btr, btc)
|
---|
| 303 | OffsetConstraint: either "I" for 32bit data types or "J" for 64.
|
---|
| 304 | Type: l, q
|
---|
| 305 | */
|
---|
| 306 | #define __buildbittestand(x, y, z, a, b) unsigned char x(y *Base, y Offset) \
|
---|
| 307 | { \
|
---|
| 308 | unsigned char old; \
|
---|
| 309 | __asm__ (z "{" b " %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET \
|
---|
| 310 | : [old] __FLAGCONSTRAINT (old), [Base] "+rm" (*Base) \
|
---|
| 311 | : [Offset] a "r" (Offset) \
|
---|
| 312 | : __FLAGCLOBBER2); \
|
---|
| 313 | return old; \
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | /* This macro is used by __inbyte, __inword, __indword
|
---|
| 317 |
|
---|
| 318 | Parameters: (FunctionName, DataType)
|
---|
| 319 | FunctionName: Any valid function name
|
---|
| 320 | DataType: unsigned char, unsigned short, unsigned __LONG32
|
---|
| 321 | Type: b, w, l
|
---|
| 322 | */
|
---|
| 323 | #define __build_inport(x, y, z) y x(unsigned short Port) { \
|
---|
| 324 | y value; \
|
---|
| 325 | __asm__ __volatile__ ("in{" z " %w[port],%[value]| %[value],%w[port]}" \
|
---|
| 326 | : [value] "=a" (value) \
|
---|
| 327 | : [port] "Nd" (Port)); \
|
---|
| 328 | return value; \
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | /* This macro is used by __outbyte, __outword, __outdword
|
---|
| 332 |
|
---|
| 333 | Parameters: (FunctionName, DataType)
|
---|
| 334 | FunctionName: Any valid function name
|
---|
| 335 | DataType: unsigned char, unsigned short, unsigned __LONG32
|
---|
| 336 | Type: b, w, l
|
---|
| 337 | */
|
---|
| 338 | #define __build_outport(x, y, z) void x(unsigned short Port, y Data) { \
|
---|
| 339 | __asm__ __volatile__ ("out{" z " %[data],%w[port]| %w[port],%[data]}" \
|
---|
| 340 | : \
|
---|
| 341 | : [data] "a" (Data), [port] "Nd" (Port)); \
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | /* This macro is used by __inbytestring, __inwordstring, __indwordstring
|
---|
| 345 |
|
---|
| 346 | Parameters: (FunctionName, DataType, InstructionSizeAtt, InstructionSizeIntel)
|
---|
| 347 | FunctionName: Any valid function name
|
---|
| 348 | DataType: unsigned char, unsigned short, unsigned __LONG32
|
---|
| 349 | InstructionSizeAtt: b, w, l
|
---|
| 350 | InstructionSizeIntel: b, w, d (not b,w,l)
|
---|
| 351 | */
|
---|
| 352 | #define __build_inportstring(x, y, z, a) void x(unsigned short Port, y *Buffer, unsigned __LONG32 Count) { \
|
---|
| 353 | __asm__ __volatile__ ("cld ; rep ins{" z "|" a "}" \
|
---|
| 354 | : "=D" (Buffer), "=c" (Count) \
|
---|
| 355 | : "d"(Port), "0"(Buffer), "1" (Count) \
|
---|
| 356 | : "memory"); \
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | /* This macro is used by __outbytestring, __outwordstring, __outdwordstring
|
---|
| 360 |
|
---|
| 361 | Parameters: (FunctionName, DataType, InstructionSizeAtt, InstructionSizeIntel)
|
---|
| 362 | FunctionName: Any valid function name
|
---|
| 363 | DataType: unsigned char, unsigned short, unsigned __LONG32
|
---|
| 364 | InstructionSizeAtt: b, w, l
|
---|
| 365 | InstructionSizeIntel: b, w, d (not b,w,l)
|
---|
| 366 |
|
---|
| 367 | */
|
---|
| 368 | #define __build_outportstring(x, y, z, a) void x(unsigned short Port, y *Buffer, unsigned __LONG32 Count) { \
|
---|
| 369 | __asm__ __volatile__ ("cld ; rep outs{" z "|" a "}" \
|
---|
| 370 | : "=S" (Buffer), "=c" (Count) \
|
---|
| 371 | : "d"(Port), "0"(Buffer), "1" (Count) \
|
---|
| 372 | : "memory"); \
|
---|
| 373 | }
|
---|
| 374 |
|
---|
| 375 | /* This macro is used by __readcr0, __readcr2, __readcr3, __readcr4, __readcr8
|
---|
| 376 |
|
---|
| 377 | Parameters: (FunctionName, DataType, RegisterNumber)
|
---|
| 378 | FunctionName: Any valid function name
|
---|
| 379 | DataType: unsigned __LONG32, unsigned __int64
|
---|
| 380 | RegisterNumber: 0, 2, 3, 4, 8
|
---|
| 381 |
|
---|
| 382 | */
|
---|
| 383 | #define __build_readcr(x, y, z) y x(void) { \
|
---|
| 384 | y value; \
|
---|
| 385 | __asm__ __volatile__ ("mov {%%cr" z ", %[value] | %[value], %%cr" z "}" \
|
---|
| 386 | : [value] "=q" (value)); \
|
---|
| 387 | return value; \
|
---|
| 388 | }
|
---|
| 389 |
|
---|
| 390 | /* This macro is used by __writecr0, __writecr2, __writecr3, __writecr4, __writecr8
|
---|
| 391 |
|
---|
| 392 | Parameters: (FunctionName, DataType, RegisterNumber)
|
---|
| 393 | FunctionName: Any valid function name
|
---|
| 394 | DataType: unsigned __LONG32, unsigned __int64
|
---|
| 395 | RegisterNumber: 0, 2, 3, 4, 8
|
---|
| 396 |
|
---|
| 397 | */
|
---|
| 398 | #define __build_writecr(x, y, z) void x(y Data) { \
|
---|
| 399 | __asm__ __volatile__ ("mov {%[Data], %%cr" z "|%%cr" z ", %[Data]}" \
|
---|
| 400 | : \
|
---|
| 401 | : [Data] "q" (Data) \
|
---|
| 402 | : "memory"); \
|
---|
| 403 | }
|
---|
| 404 |
|
---|
| 405 | /* This macro is used by __movsb, __movsd, __movsq, __movsw
|
---|
| 406 |
|
---|
| 407 | Parameters: (FunctionName, DataType, RegisterNumber)
|
---|
| 408 | FunctionName: Any valid function name
|
---|
| 409 | DataType: unsigned char, unsigned short, unsigned __LONG32, unsigned __int64
|
---|
| 410 | InstructionSize: b, w, d, q
|
---|
| 411 |
|
---|
| 412 | */
|
---|
| 413 | #define __buildmov(x, y, z) void x(y *Destination, y const *Source, size_t Count) \
|
---|
| 414 | { \
|
---|
| 415 | __asm__ __volatile__ ( \
|
---|
| 416 | "rep movs" z \
|
---|
| 417 | : "=D" (Destination), "=S" (Source), "=c" (Count) \
|
---|
| 418 | : "0" (Destination), "1" (Source), "2" (Count) \
|
---|
| 419 | : "memory"); \
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | #endif /* _INTRIN_MAC_ */
|
---|
| 423 |
|
---|
| 424 | /* The Barrier functions can never be in the library. Since gcc only
|
---|
| 425 | supports ReadWriteBarrier, map all 3 to do the same. */
|
---|
| 426 | #ifndef _ReadWriteBarrier
|
---|
| 427 |
|
---|
| 428 | #define _ReadWriteBarrier() __asm__ __volatile__ ("" ::: "memory")
|
---|
| 429 | #define _ReadBarrier _ReadWriteBarrier
|
---|
| 430 | #define _WriteBarrier _ReadWriteBarrier
|
---|
| 431 |
|
---|
| 432 | #endif
|
---|
| 433 |
|
---|
| 434 | /* The logic for this macro is:
|
---|
| 435 | if the function is not yet defined AND
|
---|
| 436 | (
|
---|
| 437 | (if we are not just defining special OR
|
---|
| 438 | (we are defining special AND this is one of the ones we are defining)
|
---|
| 439 | )
|
---|
| 440 | )
|
---|
| 441 | */
|
---|
| 442 | #define __INTRINSIC_PROLOG(name) (!defined(__INTRINSIC_DEFINED_ ## name)) && ((!defined (__INTRINSIC_ONLYSPECIAL)) || (defined (__INTRINSIC_ONLYSPECIAL) && defined(__INTRINSIC_SPECIAL_ ## name)))
|
---|
| 443 |
|
---|
| 444 | #ifdef __INTRINSIC_ONLYSPECIAL
|
---|
| 445 | #define __INTRINSICS_USEINLINE
|
---|
| 446 | #else
|
---|
| 447 | #define __INTRINSICS_USEINLINE __MINGW_INTRIN_INLINE
|
---|
| 448 | #endif
|
---|
| 449 |
|
---|
| 450 | /* Normally __INTRINSIC_ONLYSPECIAL is used to indicate that we are
|
---|
| 451 | being included in the library version of the intrinsic (case 2). However,
|
---|
| 452 | that really only affects the definition of __INTRINSICS_USEINLINE.
|
---|
| 453 | So here we are letting it serve an additional purpose of only defining
|
---|
| 454 | the intrinsics for a certain file (case 3). For example, to create the
|
---|
| 455 | intrinsics for the functions in winnt.h, define __INTRINSIC_GROUP_WINNT.
|
---|
| 456 |
|
---|
| 457 | Note that this file can be included multiple times, and as a result
|
---|
| 458 | there can be overlap (definitions that appear in more than one
|
---|
| 459 | file). This is handled by __INTRINSIC_DEFINED_*
|
---|
| 460 |
|
---|
| 461 | If no groups are defined (such as what happens when including intrin.h),
|
---|
| 462 | all intrinsics are defined. */
|
---|
| 463 |
|
---|
| 464 | /* If __INTRINSIC_ONLYSPECIAL is defined at this point, we are processing case 2. In
|
---|
| 465 | that case, don't go looking for groups */
|
---|
| 466 | #ifndef __INTRINSIC_ONLYSPECIAL
|
---|
| 467 |
|
---|
| 468 | #ifdef __INTRINSIC_GROUP_WINNT
|
---|
| 469 | #undef __INTRINSIC_GROUP_WINNT /* Remove this for efficiency if intrin-impl.h is included again */
|
---|
| 470 |
|
---|
| 471 | /* Note that this gets undefined at the end of this file */
|
---|
| 472 | #define __INTRINSIC_ONLYSPECIAL
|
---|
| 473 |
|
---|
| 474 | #define __INTRINSIC_SPECIAL___faststorefence
|
---|
| 475 | #define __INTRINSIC_SPECIAL___int2c
|
---|
| 476 | #define __INTRINSIC_SPECIAL___stosb
|
---|
| 477 | #define __INTRINSIC_SPECIAL___stosd
|
---|
| 478 | #define __INTRINSIC_SPECIAL___stosq
|
---|
| 479 | #define __INTRINSIC_SPECIAL___stosw
|
---|
| 480 | #define __INTRINSIC_SPECIAL__InterlockedAnd
|
---|
| 481 | #define __INTRINSIC_SPECIAL__InterlockedAnd64
|
---|
| 482 | #define __INTRINSIC_SPECIAL__interlockedbittestandcomplement
|
---|
| 483 | #define __INTRINSIC_SPECIAL__interlockedbittestandcomplement64
|
---|
| 484 | #define __INTRINSIC_SPECIAL__interlockedbittestandreset
|
---|
| 485 | #define __INTRINSIC_SPECIAL__interlockedbittestandreset64
|
---|
| 486 | #define __INTRINSIC_SPECIAL__interlockedbittestandset
|
---|
| 487 | #define __INTRINSIC_SPECIAL__interlockedbittestandset64
|
---|
| 488 | #define __INTRINSIC_SPECIAL__InterlockedOr
|
---|
| 489 | #define __INTRINSIC_SPECIAL__InterlockedOr64
|
---|
| 490 | #define __INTRINSIC_SPECIAL__InterlockedXor
|
---|
| 491 | #define __INTRINSIC_SPECIAL__InterlockedXor64
|
---|
| 492 | #define __INTRINSIC_SPECIAL_InterlockedBitTestAndComplement
|
---|
| 493 | #define __INTRINSIC_SPECIAL_InterlockedBitTestAndComplement64
|
---|
| 494 | #define __INTRINSIC_SPECIAL_InterlockedBitTestAndReset
|
---|
| 495 | #define __INTRINSIC_SPECIAL_InterlockedBitTestAndReset64
|
---|
| 496 | #define __INTRINSIC_SPECIAL_InterlockedBitTestAndSet
|
---|
| 497 | #define __INTRINSIC_SPECIAL_InterlockedBitTestAndSet64
|
---|
| 498 | #define __INTRINSIC_SPECIAL__InterlockedIncrement16
|
---|
| 499 | #define __INTRINSIC_SPECIAL__InterlockedDecrement16
|
---|
| 500 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchange16
|
---|
| 501 | #define __INTRINSIC_SPECIAL__InterlockedIncrement
|
---|
| 502 | #define __INTRINSIC_SPECIAL__InterlockedDecrement
|
---|
| 503 | #define __INTRINSIC_SPECIAL__InterlockedAdd
|
---|
| 504 | #define __INTRINSIC_SPECIAL__InterlockedExchange
|
---|
| 505 | #define __INTRINSIC_SPECIAL__InterlockedExchangeAdd
|
---|
| 506 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchange
|
---|
| 507 | #define __INTRINSIC_SPECIAL__InterlockedIncrement64
|
---|
| 508 | #define __INTRINSIC_SPECIAL__InterlockedDecrement64
|
---|
| 509 | #define __INTRINSIC_SPECIAL__InterlockedAdd64
|
---|
| 510 | #define __INTRINSIC_SPECIAL__InterlockedExchangeAdd64
|
---|
| 511 | #define __INTRINSIC_SPECIAL__InterlockedExchange64
|
---|
| 512 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchange64
|
---|
| 513 | #define __INTRINSIC_SPECIAL__InterlockedExchangePointer
|
---|
| 514 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchangePointer
|
---|
| 515 | #define __INTRINSIC_SPECIAL___readgsbyte
|
---|
| 516 | #define __INTRINSIC_SPECIAL___readgsword
|
---|
| 517 | #define __INTRINSIC_SPECIAL___readgsdword
|
---|
| 518 | #define __INTRINSIC_SPECIAL___readgsqword
|
---|
| 519 | #define __INTRINSIC_SPECIAL___writegsbyte
|
---|
| 520 | #define __INTRINSIC_SPECIAL___writegsword
|
---|
| 521 | #define __INTRINSIC_SPECIAL___writegsdword
|
---|
| 522 | #define __INTRINSIC_SPECIAL___writegsqword
|
---|
| 523 | #define __INTRINSIC_SPECIAL___readfsbyte
|
---|
| 524 | #define __INTRINSIC_SPECIAL___readfsword
|
---|
| 525 | #define __INTRINSIC_SPECIAL___readfsdword
|
---|
| 526 | #define __INTRINSIC_SPECIAL___writefsbyte
|
---|
| 527 | #define __INTRINSIC_SPECIAL___writefsword
|
---|
| 528 | #define __INTRINSIC_SPECIAL___writefsdword
|
---|
| 529 | #define __INTRINSIC_SPECIAL__BitScanForward
|
---|
| 530 | #define __INTRINSIC_SPECIAL__BitScanForward64
|
---|
| 531 | #define __INTRINSIC_SPECIAL__BitScanReverse
|
---|
| 532 | #define __INTRINSIC_SPECIAL__BitScanReverse64
|
---|
| 533 | #define __INTRINSIC_SPECIAL__bittest
|
---|
| 534 | #define __INTRINSIC_SPECIAL__bittestandset
|
---|
| 535 | #define __INTRINSIC_SPECIAL__bittestandreset
|
---|
| 536 | #define __INTRINSIC_SPECIAL__bittestandcomplement
|
---|
| 537 | #define __INTRINSIC_SPECIAL__bittest64
|
---|
| 538 | #define __INTRINSIC_SPECIAL__bittestandset64
|
---|
| 539 | #define __INTRINSIC_SPECIAL__bittestandreset64
|
---|
| 540 | #define __INTRINSIC_SPECIAL__bittestandcomplement64
|
---|
| 541 | #define __INTRINSIC_SPECIAL___movsb
|
---|
| 542 | #define __INTRINSIC_SPECIAL___movsw
|
---|
| 543 | #define __INTRINSIC_SPECIAL___movsd
|
---|
| 544 | #define __INTRINSIC_SPECIAL___movsq
|
---|
| 545 |
|
---|
| 546 | #endif /* __INTRINSIC_GROUP_WINNT */
|
---|
| 547 |
|
---|
| 548 | #ifdef __INTRINSIC_GROUP_WINBASE
|
---|
| 549 | #undef __INTRINSIC_GROUP_WINBASE /* Remove this for efficiency if intrin-impl.h is included again */
|
---|
| 550 |
|
---|
| 551 | /* Note that this gets undefined at the end of this file */
|
---|
| 552 | #define __INTRINSIC_ONLYSPECIAL
|
---|
| 553 |
|
---|
| 554 | #define __INTRINSIC_SPECIAL__InterlockedIncrement
|
---|
| 555 | #define __INTRINSIC_SPECIAL__InterlockedDecrement
|
---|
| 556 | #define __INTRINSIC_SPECIAL__InterlockedAdd
|
---|
| 557 | #define __INTRINSIC_SPECIAL__InterlockedExchange
|
---|
| 558 | #define __INTRINSIC_SPECIAL__InterlockedExchangeAdd
|
---|
| 559 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchange
|
---|
| 560 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchangePointer
|
---|
| 561 | #define __INTRINSIC_SPECIAL__InterlockedExchangePointer
|
---|
| 562 | #define __INTRINSIC_SPECIAL__InterlockedAnd64
|
---|
| 563 | #define __INTRINSIC_SPECIAL__InterlockedOr64
|
---|
| 564 | #define __INTRINSIC_SPECIAL__InterlockedXor64
|
---|
| 565 | #define __INTRINSIC_SPECIAL__InterlockedIncrement64
|
---|
| 566 | #define __INTRINSIC_SPECIAL__InterlockedDecrement64
|
---|
| 567 | #define __INTRINSIC_SPECIAL__InterlockedAdd64
|
---|
| 568 | #define __INTRINSIC_SPECIAL__InterlockedExchange64
|
---|
| 569 | #define __INTRINSIC_SPECIAL__InterlockedExchangeAdd64
|
---|
| 570 | #define __INTRINSIC_SPECIAL__InterlockedCompareExchange64
|
---|
| 571 |
|
---|
| 572 | #endif /* __INTRINSIC_GROUP_WINBASE */
|
---|
| 573 |
|
---|
| 574 | /* To add an additional group, put the #ifdef and definitions here. */
|
---|
| 575 |
|
---|
| 576 | #endif /* __INTRINSIC_ONLYSPECIAL */
|
---|
| 577 |
|
---|
| 578 | #ifdef __cplusplus
|
---|
| 579 | extern "C" {
|
---|
| 580 | #endif
|
---|
| 581 |
|
---|
| 582 | /* Before 4.9.2, ia32intrin.h had broken versions of these. */
|
---|
| 583 | #undef _lrotl
|
---|
| 584 | #undef _lrotr
|
---|
| 585 |
|
---|
| 586 | #if __INTRINSIC_PROLOG(_lrotl)
|
---|
| 587 | unsigned long _lrotl(unsigned long __X, int __C);
|
---|
| 588 | #if !__has_builtin(_lrotl)
|
---|
| 589 | __INTRINSICS_USEINLINE
|
---|
| 590 | unsigned long _lrotl(unsigned long __X, int __C)
|
---|
| 591 | {
|
---|
| 592 | return (__X << __C) | (__X >> ((sizeof(long) * 8) - __C));
|
---|
| 593 | }
|
---|
| 594 | #endif
|
---|
| 595 | #define __INTRINSIC_DEFINED__lrotl
|
---|
| 596 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 597 |
|
---|
| 598 | #if __INTRINSIC_PROLOG(_lrotr)
|
---|
| 599 | unsigned long _lrotr(unsigned long __X, int __C);
|
---|
| 600 | #if !__has_builtin(_lrotr)
|
---|
| 601 | __INTRINSICS_USEINLINE
|
---|
| 602 | unsigned long _lrotr(unsigned long __X, int __C)
|
---|
| 603 | {
|
---|
| 604 | return (__X >> __C) | (__X << ((sizeof(long) * 8) - __C));
|
---|
| 605 | }
|
---|
| 606 | #endif
|
---|
| 607 | #define __INTRINSIC_DEFINED__lrotr
|
---|
| 608 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 609 |
|
---|
| 610 | #if __INTRINSIC_PROLOG(_rotl8)
|
---|
| 611 | unsigned char _rotl8(unsigned char __X, unsigned char __C);
|
---|
| 612 | #if !__has_builtin(_rotl8)
|
---|
| 613 | __INTRINSICS_USEINLINE
|
---|
| 614 | unsigned char _rotl8(unsigned char __X, unsigned char __C)
|
---|
| 615 | {
|
---|
| 616 | return (__X << __C) | (__X >> (8 - __C));
|
---|
| 617 | }
|
---|
| 618 | #endif
|
---|
| 619 | #define __INTRINSIC_DEFINED__rotl8
|
---|
| 620 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 621 |
|
---|
| 622 | #if __INTRINSIC_PROLOG(_rotr8)
|
---|
| 623 | unsigned char _rotr8(unsigned char __X, unsigned char __C);
|
---|
| 624 | #if !__has_builtin(_rotr8)
|
---|
| 625 | __INTRINSICS_USEINLINE
|
---|
| 626 | unsigned char _rotr8(unsigned char __X, unsigned char __C)
|
---|
| 627 | {
|
---|
| 628 | return (__X >> __C) | (__X << (8 - __C));
|
---|
| 629 | }
|
---|
| 630 | #endif
|
---|
| 631 | #define __INTRINSIC_DEFINED__rotr8
|
---|
| 632 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 633 |
|
---|
| 634 | #if __INTRINSIC_PROLOG(_rotl16)
|
---|
| 635 | unsigned short _rotl16(unsigned short __X, unsigned char __C);
|
---|
| 636 | #if !__has_builtin(_rotl16)
|
---|
| 637 | __INTRINSICS_USEINLINE
|
---|
| 638 | unsigned short _rotl16(unsigned short __X, unsigned char __C)
|
---|
| 639 | {
|
---|
| 640 | return (__X << __C) | (__X >> (16 - __C));
|
---|
| 641 | }
|
---|
| 642 | #endif
|
---|
| 643 | #define __INTRINSIC_DEFINED__rotl16
|
---|
| 644 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 645 |
|
---|
| 646 | #if __INTRINSIC_PROLOG(_rotr16)
|
---|
| 647 | unsigned short _rotr16(unsigned short __X, unsigned char __C);
|
---|
| 648 | #if !__has_builtin(_rotr16)
|
---|
| 649 | __INTRINSICS_USEINLINE
|
---|
| 650 | unsigned short _rotr16(unsigned short __X, unsigned char __C)
|
---|
| 651 | {
|
---|
| 652 | return (__X >> __C) | (__X << (16 - __C));
|
---|
| 653 | }
|
---|
| 654 | #endif
|
---|
| 655 | #define __INTRINSIC_DEFINED__rotr16
|
---|
| 656 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 657 |
|
---|
| 658 | #if defined(__x86_64__) || defined(_AMD64_)
|
---|
| 659 |
|
---|
| 660 | #if __INTRINSIC_PROLOG(__faststorefence)
|
---|
| 661 | void __faststorefence(void);
|
---|
| 662 | #if !__has_builtin(__faststorefence)
|
---|
| 663 | __INTRINSICS_USEINLINE
|
---|
| 664 | void __faststorefence(void) {
|
---|
| 665 | /* Turns out this is actually faster than MS's "trick" on newer cpus. Note
|
---|
| 666 | that this builtin performs an implicit ReadWriteBarrier. */
|
---|
| 667 | __builtin_ia32_sfence();
|
---|
| 668 | }
|
---|
| 669 | #endif
|
---|
| 670 | #define __INTRINSIC_DEFINED___faststorefence
|
---|
| 671 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 672 |
|
---|
| 673 | #if __INTRINSIC_PROLOG(__stosq)
|
---|
| 674 | __MINGW_EXTENSION void __stosq(unsigned __int64 *, unsigned __int64, size_t);
|
---|
| 675 | #if !__has_builtin(__stosq)
|
---|
| 676 | __INTRINSICS_USEINLINE
|
---|
| 677 | __buildstos(__stosq, unsigned __int64, "q|q")
|
---|
| 678 | #endif
|
---|
| 679 | #define __INTRINSIC_DEFINED___stosq
|
---|
| 680 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 681 |
|
---|
| 682 | #if __INTRINSIC_PROLOG(_interlockedbittestandset64)
|
---|
| 683 | __MINGW_EXTENSION unsigned char _interlockedbittestandset64(__int64 volatile *a, __int64 b);
|
---|
| 684 | #if !__has_builtin(_interlockedbittestandset64)
|
---|
| 685 | __INTRINSICS_USEINLINE
|
---|
| 686 | __buildbittesti(_interlockedbittestandset64, __int64, "lock bts{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J")
|
---|
| 687 | #endif
|
---|
| 688 | #define __INTRINSIC_DEFINED__interlockedbittestandset64
|
---|
| 689 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 690 |
|
---|
| 691 | #if __INTRINSIC_PROLOG(_interlockedbittestandreset64)
|
---|
| 692 | __MINGW_EXTENSION unsigned char _interlockedbittestandreset64(__int64 volatile *a, __int64 b);
|
---|
| 693 | #if !__has_builtin(_interlockedbittestandreset64)
|
---|
| 694 | __INTRINSICS_USEINLINE
|
---|
| 695 | __buildbittesti(_interlockedbittestandreset64, __int64, "lock btr{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J")
|
---|
| 696 | #endif
|
---|
| 697 | #define __INTRINSIC_DEFINED__interlockedbittestandreset64
|
---|
| 698 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 699 |
|
---|
| 700 | #if __INTRINSIC_PROLOG(_interlockedbittestandcomplement64)
|
---|
| 701 | __MINGW_EXTENSION unsigned char _interlockedbittestandcomplement64(__int64 volatile *a, __int64 b);
|
---|
| 702 | #if !__has_builtin(_interlockedbittestandcomplement64)
|
---|
| 703 | __INTRINSICS_USEINLINE
|
---|
| 704 | __buildbittesti(_interlockedbittestandcomplement64, __int64, "lock btc{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J")
|
---|
| 705 | #endif
|
---|
| 706 | #define __INTRINSIC_DEFINED__interlockedbittestandcomplement64
|
---|
| 707 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 708 |
|
---|
| 709 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndSet64)
|
---|
| 710 | __MINGW_EXTENSION unsigned char InterlockedBitTestAndSet64(volatile __int64 *a, __int64 b);
|
---|
| 711 | #if !__has_builtin(InterlockedBitTestAndSet64)
|
---|
| 712 | __INTRINSICS_USEINLINE
|
---|
| 713 | __buildbittesti(InterlockedBitTestAndSet64, __int64, "lock bts{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J")
|
---|
| 714 | #endif
|
---|
| 715 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndSet64
|
---|
| 716 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 717 |
|
---|
| 718 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndReset64)
|
---|
| 719 | __MINGW_EXTENSION unsigned char InterlockedBitTestAndReset64(volatile __int64 *a, __int64 b);
|
---|
| 720 | #if !__has_builtin(InterlockedBitTestAndReset64)
|
---|
| 721 | __INTRINSICS_USEINLINE
|
---|
| 722 | __buildbittesti(InterlockedBitTestAndReset64, __int64, "lock btr{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J")
|
---|
| 723 | #endif
|
---|
| 724 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndReset64
|
---|
| 725 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 726 |
|
---|
| 727 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement64)
|
---|
| 728 | __MINGW_EXTENSION unsigned char InterlockedBitTestAndComplement64(volatile __int64 *a, __int64 b);
|
---|
| 729 | #if !__has_builtin(InterlockedBitTestAndComplement64)
|
---|
| 730 | __INTRINSICS_USEINLINE
|
---|
| 731 | __buildbittesti(InterlockedBitTestAndComplement64, __int64, "lock btc{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J")
|
---|
| 732 | #endif
|
---|
| 733 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndComplement64
|
---|
| 734 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 735 |
|
---|
| 736 | #if __INTRINSIC_PROLOG(_InterlockedAnd64)
|
---|
| 737 | __MINGW_EXTENSION __int64 _InterlockedAnd64(__int64 volatile *, __int64);
|
---|
| 738 | #if !__has_builtin(_InterlockedAnd64)
|
---|
| 739 | __INTRINSICS_USEINLINE
|
---|
| 740 | __buildlogicali(_InterlockedAnd64, __int64, and)
|
---|
| 741 | #endif
|
---|
| 742 | #define __INTRINSIC_DEFINED__InterlockedAnd64
|
---|
| 743 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 744 |
|
---|
| 745 | #if __INTRINSIC_PROLOG(_InterlockedOr64)
|
---|
| 746 | __MINGW_EXTENSION __int64 _InterlockedOr64(__int64 volatile *, __int64);
|
---|
| 747 | #if !__has_builtin(_InterlockedOr64)
|
---|
| 748 | __INTRINSICS_USEINLINE
|
---|
| 749 | __buildlogicali(_InterlockedOr64, __int64, or)
|
---|
| 750 | #endif
|
---|
| 751 | #define __INTRINSIC_DEFINED__InterlockedOr64
|
---|
| 752 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 753 |
|
---|
| 754 | #if __INTRINSIC_PROLOG(_InterlockedXor64)
|
---|
| 755 | __MINGW_EXTENSION __int64 _InterlockedXor64(__int64 volatile *, __int64);
|
---|
| 756 | #if !__has_builtin(_InterlockedXor64)
|
---|
| 757 | __INTRINSICS_USEINLINE
|
---|
| 758 | __buildlogicali(_InterlockedXor64, __int64, xor)
|
---|
| 759 | #endif
|
---|
| 760 | #define __INTRINSIC_DEFINED__InterlockedXor64
|
---|
| 761 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 762 |
|
---|
| 763 | #if __INTRINSIC_PROLOG(_InterlockedIncrement64)
|
---|
| 764 | __MINGW_EXTENSION __int64 _InterlockedIncrement64(__int64 volatile *Addend);
|
---|
| 765 | #if !__has_builtin(_InterlockedIncrement64)
|
---|
| 766 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 767 | __int64 _InterlockedIncrement64(__int64 volatile *Addend) {
|
---|
| 768 | return __sync_add_and_fetch(Addend, 1);
|
---|
| 769 | }
|
---|
| 770 | #endif
|
---|
| 771 | #define __INTRINSIC_DEFINED__InterlockedIncrement64
|
---|
| 772 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 773 |
|
---|
| 774 | #if __INTRINSIC_PROLOG(_InterlockedDecrement64)
|
---|
| 775 | __MINGW_EXTENSION __int64 _InterlockedDecrement64(__int64 volatile *Addend);
|
---|
| 776 | #if !__has_builtin(_InterlockedDecrement64)
|
---|
| 777 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 778 | __int64 _InterlockedDecrement64(__int64 volatile *Addend) {
|
---|
| 779 | return __sync_sub_and_fetch(Addend, 1);
|
---|
| 780 | }
|
---|
| 781 | #endif
|
---|
| 782 | #define __INTRINSIC_DEFINED__InterlockedDecrement64
|
---|
| 783 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 784 |
|
---|
| 785 | #if __INTRINSIC_PROLOG(_InterlockedExchange64)
|
---|
| 786 | __MINGW_EXTENSION __int64 _InterlockedExchange64(__int64 volatile *Target, __int64 Value);
|
---|
| 787 | #if !__has_builtin(_InterlockedExchange64)
|
---|
| 788 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 789 | __int64 _InterlockedExchange64(__int64 volatile *Target, __int64 Value) {
|
---|
| 790 | return __sync_lock_test_and_set(Target, Value);
|
---|
| 791 | }
|
---|
| 792 | #endif
|
---|
| 793 | #define __INTRINSIC_DEFINED__InterlockedExchange64
|
---|
| 794 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 795 |
|
---|
| 796 | #if __INTRINSIC_PROLOG(_InterlockedExchangeAdd64)
|
---|
| 797 | __MINGW_EXTENSION __int64 _InterlockedExchangeAdd64(__int64 volatile *Addend, __int64 Value);
|
---|
| 798 | #if !__has_builtin(_InterlockedExchangeAdd64)
|
---|
| 799 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 800 | __int64 _InterlockedExchangeAdd64(__int64 volatile *Addend, __int64 Value) {
|
---|
| 801 | return __sync_fetch_and_add(Addend, Value);
|
---|
| 802 | }
|
---|
| 803 | #endif
|
---|
| 804 | #define __INTRINSIC_DEFINED__InterlockedExchangeAdd64
|
---|
| 805 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 806 |
|
---|
| 807 | #if __INTRINSIC_PROLOG(__readgsbyte)
|
---|
| 808 | unsigned char __readgsbyte(unsigned __LONG32 Offset);
|
---|
| 809 | #if !__has_builtin(__readgsbyte)
|
---|
| 810 | __INTRINSICS_USEINLINE
|
---|
| 811 | __buildreadseg(__readgsbyte, unsigned char, "gs", "b")
|
---|
| 812 | #endif
|
---|
| 813 | #define __INTRINSIC_DEFINED___readgsbyte
|
---|
| 814 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 815 |
|
---|
| 816 | #if __INTRINSIC_PROLOG(__readgsword)
|
---|
| 817 | unsigned short __readgsword(unsigned __LONG32 Offset);
|
---|
| 818 | #if !__has_builtin(__readgsword)
|
---|
| 819 | __INTRINSICS_USEINLINE
|
---|
| 820 | __buildreadseg(__readgsword, unsigned short, "gs", "w")
|
---|
| 821 | #endif
|
---|
| 822 | #define __INTRINSIC_DEFINED___readgsword
|
---|
| 823 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 824 |
|
---|
| 825 | #if __INTRINSIC_PROLOG(__readgsdword)
|
---|
| 826 | unsigned __LONG32 __readgsdword(unsigned __LONG32 Offset);
|
---|
| 827 | #if !__has_builtin(__readgsdword)
|
---|
| 828 | __INTRINSICS_USEINLINE
|
---|
| 829 | __buildreadseg(__readgsdword, unsigned __LONG32, "gs", "l")
|
---|
| 830 | #endif
|
---|
| 831 | #define __INTRINSIC_DEFINED___readgsdword
|
---|
| 832 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 833 |
|
---|
| 834 | #if __INTRINSIC_PROLOG(__readgsqword)
|
---|
| 835 | __MINGW_EXTENSION unsigned __int64 __readgsqword(unsigned __LONG32 Offset);
|
---|
| 836 | #if !__has_builtin(__readgsqword)
|
---|
| 837 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
|
---|
| 839 | #endif
|
---|
| 840 | #define __INTRINSIC_DEFINED___readgsqword
|
---|
| 841 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 842 |
|
---|
| 843 | #if __INTRINSIC_PROLOG(__writegsbyte)
|
---|
| 844 | void __writegsbyte(unsigned __LONG32 Offset,unsigned char Data);
|
---|
| 845 | #if !__has_builtin(__writegsbyte)
|
---|
| 846 | __INTRINSICS_USEINLINE
|
---|
| 847 | __buildwriteseg(__writegsbyte, unsigned char, "gs", "b")
|
---|
| 848 | #endif
|
---|
| 849 | #define __INTRINSIC_DEFINED___writegsbyte
|
---|
| 850 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 851 |
|
---|
| 852 | #if __INTRINSIC_PROLOG(__writegsword)
|
---|
| 853 | void __writegsword(unsigned __LONG32 Offset,unsigned short Data);
|
---|
| 854 | #if !__has_builtin(__writegsword)
|
---|
| 855 | __INTRINSICS_USEINLINE
|
---|
| 856 | __buildwriteseg(__writegsword, unsigned short, "gs", "w")
|
---|
| 857 | #endif
|
---|
| 858 | #define __INTRINSIC_DEFINED___writegsword
|
---|
| 859 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 860 |
|
---|
| 861 | #if __INTRINSIC_PROLOG(__writegsdword)
|
---|
| 862 | void __writegsdword(unsigned __LONG32 Offset,unsigned __LONG32 Data);
|
---|
| 863 | #if !__has_builtin(__writegsdword)
|
---|
| 864 | __INTRINSICS_USEINLINE
|
---|
| 865 | __buildwriteseg(__writegsdword, unsigned __LONG32, "gs", "l")
|
---|
| 866 | #endif
|
---|
| 867 | #define __INTRINSIC_DEFINED___writegsdword
|
---|
| 868 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 869 |
|
---|
| 870 | #if __INTRINSIC_PROLOG(__writegsqword)
|
---|
| 871 | __MINGW_EXTENSION void __writegsqword(unsigned __LONG32 Offset,unsigned __int64 Data);
|
---|
| 872 | #if !__has_builtin(__writegsqword)
|
---|
| 873 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 874 | __buildwriteseg(__writegsqword, unsigned __int64, "gs", "q")
|
---|
| 875 | #endif
|
---|
| 876 | #define __INTRINSIC_DEFINED___writegsqword
|
---|
| 877 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 878 |
|
---|
| 879 | #if __INTRINSIC_PROLOG(_BitScanForward64)
|
---|
| 880 | __MINGW_EXTENSION unsigned char _BitScanForward64(unsigned __LONG32 *Index, unsigned __int64 Mask);
|
---|
| 881 | #if !__has_builtin(_BitScanForward64)
|
---|
| 882 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 883 | __buildbitscan(_BitScanForward64, unsigned __int64, "bsf{q %[Mask],%[Index] | %[Index],%[Mask]}")
|
---|
| 884 | #endif
|
---|
| 885 | #define __INTRINSIC_DEFINED__BitScanForward64
|
---|
| 886 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 887 |
|
---|
| 888 | #if __INTRINSIC_PROLOG(_BitScanReverse64)
|
---|
| 889 | __MINGW_EXTENSION unsigned char _BitScanReverse64(unsigned __LONG32 *Index, unsigned __int64 Mask);
|
---|
| 890 | #if !__has_builtin(_BitScanReverse64)
|
---|
| 891 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 892 | __buildbitscan(_BitScanReverse64, unsigned __int64, "bsr{q %[Mask],%[Index] | %[Index],%[Mask]}")
|
---|
| 893 | #endif
|
---|
| 894 | #define __INTRINSIC_DEFINED__BitScanReverse64
|
---|
| 895 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 896 |
|
---|
| 897 | #if __INTRINSIC_PROLOG(_bittest64)
|
---|
| 898 | __MINGW_EXTENSION unsigned char _bittest64(__int64 const *a, __int64 b);
|
---|
| 899 | #if !__has_builtin(_bittest64)
|
---|
| 900 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 901 | __buildbittest(_bittest64, __int64, "q", "J")
|
---|
| 902 | #endif
|
---|
| 903 | #define __INTRINSIC_DEFINED__bittest64
|
---|
| 904 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 905 |
|
---|
| 906 | #if __INTRINSIC_PROLOG(_bittestandset64)
|
---|
| 907 | __MINGW_EXTENSION unsigned char _bittestandset64(__int64 *a, __int64 b);
|
---|
| 908 | #if !__has_builtin(_bittestandset64)
|
---|
| 909 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 910 | __buildbittestand(_bittestandset64, __int64, "bts", "J", "q")
|
---|
| 911 | #endif
|
---|
| 912 | #define __INTRINSIC_DEFINED__bittestandset64
|
---|
| 913 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 914 |
|
---|
| 915 | #if __INTRINSIC_PROLOG(_bittestandreset64)
|
---|
| 916 | __MINGW_EXTENSION unsigned char _bittestandreset64(__int64 *a, __int64 b);
|
---|
| 917 | #if !__has_builtin(_bittestandreset64)
|
---|
| 918 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 919 | __buildbittestand(_bittestandreset64, __int64, "btr", "J", "q")
|
---|
| 920 | #endif
|
---|
| 921 | #define __INTRINSIC_DEFINED__bittestandreset64
|
---|
| 922 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 923 |
|
---|
| 924 | #if __INTRINSIC_PROLOG(_bittestandcomplement64)
|
---|
| 925 | __MINGW_EXTENSION unsigned char _bittestandcomplement64(__int64 *a, __int64 b);
|
---|
| 926 | #if !__has_builtin(_bittestandcomplement64)
|
---|
| 927 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 928 | __buildbittestand(_bittestandcomplement64, __int64, "btc", "J", "q")
|
---|
| 929 | #endif
|
---|
| 930 | #define __INTRINSIC_DEFINED__bittestandcomplement64
|
---|
| 931 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 932 |
|
---|
| 933 | #if __INTRINSIC_PROLOG(__readcr0)
|
---|
| 934 | __MINGW_EXTENSION unsigned __int64 __readcr0(void);
|
---|
| 935 | #if !__has_builtin(__readcr0)
|
---|
| 936 | __INTRINSICS_USEINLINE
|
---|
| 937 | __build_readcr(__readcr0, unsigned __int64, "0")
|
---|
| 938 | #endif
|
---|
| 939 | #define __INTRINSIC_DEFINED___readcr0
|
---|
| 940 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 941 |
|
---|
| 942 | #if __INTRINSIC_PROLOG(__readcr2)
|
---|
| 943 | __MINGW_EXTENSION unsigned __int64 __readcr2(void);
|
---|
| 944 | #if !__has_builtin(__readcr2)
|
---|
| 945 | __INTRINSICS_USEINLINE
|
---|
| 946 | __build_readcr(__readcr2, unsigned __int64, "2")
|
---|
| 947 | #endif
|
---|
| 948 | #define __INTRINSIC_DEFINED___readcr2
|
---|
| 949 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 950 |
|
---|
| 951 | #if __INTRINSIC_PROLOG(__readcr3)
|
---|
| 952 | __MINGW_EXTENSION unsigned __int64 __readcr3(void);
|
---|
| 953 | #if !__has_builtin(__readcr3)
|
---|
| 954 | __INTRINSICS_USEINLINE
|
---|
| 955 | __build_readcr(__readcr3, unsigned __int64, "3")
|
---|
| 956 | #endif
|
---|
| 957 | #define __INTRINSIC_DEFINED___readcr3
|
---|
| 958 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 959 |
|
---|
| 960 | #if __INTRINSIC_PROLOG(__readcr4)
|
---|
| 961 | __MINGW_EXTENSION unsigned __int64 __readcr4(void);
|
---|
| 962 | #if !__has_builtin(__readcr4)
|
---|
| 963 | __INTRINSICS_USEINLINE
|
---|
| 964 | __build_readcr(__readcr4, unsigned __int64, "4")
|
---|
| 965 | #endif
|
---|
| 966 | #define __INTRINSIC_DEFINED___readcr4
|
---|
| 967 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 968 |
|
---|
| 969 | #if __INTRINSIC_PROLOG(__readcr8)
|
---|
| 970 | __MINGW_EXTENSION unsigned __int64 __readcr8(void);
|
---|
| 971 | #if !__has_builtin(__readcr8)
|
---|
| 972 | __INTRINSICS_USEINLINE
|
---|
| 973 | __build_readcr(__readcr8, unsigned __int64, "8")
|
---|
| 974 | #endif
|
---|
| 975 | #define __INTRINSIC_DEFINED___readcr8
|
---|
| 976 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 977 |
|
---|
| 978 | #if __INTRINSIC_PROLOG(__writecr0)
|
---|
| 979 | __MINGW_EXTENSION void __writecr0(unsigned __int64);
|
---|
| 980 | #if !__has_builtin(__writecr0)
|
---|
| 981 | __INTRINSICS_USEINLINE
|
---|
| 982 | __build_writecr(__writecr0, unsigned __int64, "0")
|
---|
| 983 | #endif
|
---|
| 984 | #define __INTRINSIC_DEFINED___writecr0
|
---|
| 985 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 986 |
|
---|
| 987 | #if __INTRINSIC_PROLOG(__writecr3)
|
---|
| 988 | __MINGW_EXTENSION void __writecr3(unsigned __int64);
|
---|
| 989 | #if !__has_builtin(__writecr3)
|
---|
| 990 | __INTRINSICS_USEINLINE
|
---|
| 991 | __build_writecr(__writecr3, unsigned __int64, "3")
|
---|
| 992 | #endif
|
---|
| 993 | #define __INTRINSIC_DEFINED___writecr3
|
---|
| 994 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 995 |
|
---|
| 996 | #if __INTRINSIC_PROLOG(__writecr4)
|
---|
| 997 | __MINGW_EXTENSION void __writecr4(unsigned __int64);
|
---|
| 998 | #if !__has_builtin(__writecr4)
|
---|
| 999 | __INTRINSICS_USEINLINE
|
---|
| 1000 | __build_writecr(__writecr4, unsigned __int64, "4")
|
---|
| 1001 | #endif
|
---|
| 1002 | #define __INTRINSIC_DEFINED___writecr4
|
---|
| 1003 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1004 |
|
---|
| 1005 | #if __INTRINSIC_PROLOG(__writecr8)
|
---|
| 1006 | __MINGW_EXTENSION void __writecr8(unsigned __int64);
|
---|
| 1007 | #if !__has_builtin(__writecr8)
|
---|
| 1008 | __INTRINSICS_USEINLINE
|
---|
| 1009 | __build_writecr(__writecr8, unsigned __int64, "8")
|
---|
| 1010 | #endif
|
---|
| 1011 | #define __INTRINSIC_DEFINED___writecr8
|
---|
| 1012 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1013 |
|
---|
| 1014 | #if __INTRINSIC_PROLOG(__movsq)
|
---|
| 1015 | __MINGW_EXTENSION void __movsq(unsigned __int64 *Dest, unsigned __int64 const *Source, size_t Count);
|
---|
| 1016 | #if !__has_builtin(__movsq)
|
---|
| 1017 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1018 | __buildmov(__movsq, unsigned __int64, "q")
|
---|
| 1019 | #endif
|
---|
| 1020 | #define __INTRINSIC_DEFINED___movsq
|
---|
| 1021 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1022 |
|
---|
| 1023 | #if __INTRINSIC_PROLOG(_umul128)
|
---|
| 1024 | unsigned __int64 _umul128(unsigned __int64, unsigned __int64, unsigned __int64 *);
|
---|
| 1025 | #if !__has_builtin(_umul128)
|
---|
| 1026 | __INTRINSICS_USEINLINE
|
---|
| 1027 | unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b, unsigned __int64 *hi)
|
---|
| 1028 | {
|
---|
| 1029 | __MINGW_EXTENSION union { unsigned __int128 v; unsigned __int64 sv[2]; } var;
|
---|
| 1030 | var.v = a;
|
---|
| 1031 | var.v *= b;
|
---|
| 1032 | if (hi) *hi = var.sv[1];
|
---|
| 1033 | return var.sv[0];
|
---|
| 1034 | }
|
---|
| 1035 | #endif
|
---|
| 1036 | #define __INTRINSIC_DEFINED__umul128
|
---|
| 1037 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1038 |
|
---|
| 1039 | #if __INTRINSIC_PROLOG(_mul128)
|
---|
| 1040 | __int64 _mul128(__int64, __int64, __int64 *);
|
---|
| 1041 | #if !__has_builtin(_mul128)
|
---|
| 1042 | __INTRINSICS_USEINLINE
|
---|
| 1043 | __int64 _mul128(__int64 a, __int64 b, __int64 *hi)
|
---|
| 1044 | {
|
---|
| 1045 | __MINGW_EXTENSION union { __int128 v; __int64 sv[2]; } var;
|
---|
| 1046 | var.v = a;
|
---|
| 1047 | var.v *= b;
|
---|
| 1048 | if (hi) *hi = var.sv[1];
|
---|
| 1049 | return var.sv[0];
|
---|
| 1050 | }
|
---|
| 1051 | #endif
|
---|
| 1052 | #define __INTRINSIC_DEFINED__mul128
|
---|
| 1053 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1054 |
|
---|
| 1055 | #if __INTRINSIC_PROLOG(__shiftleft128)
|
---|
| 1056 | unsigned __int64 __shiftleft128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift);
|
---|
| 1057 | #if !__has_builtin(__shiftleft128)
|
---|
| 1058 | __INTRINSICS_USEINLINE
|
---|
| 1059 | unsigned __int64 __shiftleft128 (unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift)
|
---|
| 1060 | {
|
---|
| 1061 | unsigned __int64 ret;
|
---|
| 1062 |
|
---|
| 1063 | __asm__ ("shld {%[Shift],%[LowPart],%[HighPart]|%[HighPart], %[LowPart], %[Shift]}"
|
---|
| 1064 | : [ret] "=r" (ret)
|
---|
| 1065 | : [LowPart] "r" (LowPart), [HighPart] "0" (HighPart), [Shift] "Jc" (Shift)
|
---|
| 1066 | : "cc");
|
---|
| 1067 |
|
---|
| 1068 | return ret;
|
---|
| 1069 | }
|
---|
| 1070 | #endif
|
---|
| 1071 | #define __INTRINSIC_DEFINED___shiftleft128
|
---|
| 1072 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1073 |
|
---|
| 1074 | #if __INTRINSIC_PROLOG(__shiftright128)
|
---|
| 1075 | unsigned __int64 __shiftright128 (unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift);
|
---|
| 1076 | #if !__has_builtin(__shiftright128)
|
---|
| 1077 | __INTRINSICS_USEINLINE
|
---|
| 1078 | unsigned __int64 __shiftright128 (unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift)
|
---|
| 1079 | {
|
---|
| 1080 | unsigned __int64 ret;
|
---|
| 1081 |
|
---|
| 1082 | __asm__ ("shrd {%[Shift],%[HighPart],%[LowPart]|%[LowPart], %[HighPart], %[Shift]}"
|
---|
| 1083 | : [ret] "=r" (ret)
|
---|
| 1084 | : [LowPart] "0" (LowPart), [HighPart] "r" (HighPart), [Shift] "Jc" (Shift)
|
---|
| 1085 | : "cc");
|
---|
| 1086 |
|
---|
| 1087 | return ret;
|
---|
| 1088 | }
|
---|
| 1089 | #endif
|
---|
| 1090 | #define __INTRINSIC_DEFINED___shiftright128
|
---|
| 1091 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1092 |
|
---|
| 1093 | #endif /* defined(__x86_64__) || defined(_AMD64_) */
|
---|
| 1094 |
|
---|
| 1095 | /* ***************************************************** */
|
---|
| 1096 |
|
---|
| 1097 | #if defined(__arm__) || defined(_ARM_)
|
---|
| 1098 |
|
---|
| 1099 | #if __INTRINSIC_PROLOG(_interlockedbittestandset)
|
---|
| 1100 | unsigned char _interlockedbittestandset(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1101 | #if !__has_builtin(_interlockedbittestandset)
|
---|
| 1102 | __INTRINSICS_USEINLINE
|
---|
| 1103 | __buildbittesti(_interlockedbittestandset, __LONG32, "orr", /* unused param */)
|
---|
| 1104 | #endif
|
---|
| 1105 | #define __INTRINSIC_DEFINED__interlockedbittestandset
|
---|
| 1106 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1107 |
|
---|
| 1108 | #if __INTRINSIC_PROLOG(_interlockedbittestandreset)
|
---|
| 1109 | unsigned char _interlockedbittestandreset(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1110 | __INTRINSICS_USEINLINE
|
---|
| 1111 | #if !__has_builtin(_interlockedbittestandreset)
|
---|
| 1112 | __buildbittesti(_interlockedbittestandreset, __LONG32, "bic", /* unused param */)
|
---|
| 1113 | #endif
|
---|
| 1114 | #define __INTRINSIC_DEFINED__interlockedbittestandreset
|
---|
| 1115 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1116 |
|
---|
| 1117 | #if __INTRINSIC_PROLOG(_interlockedbittestandcomplement)
|
---|
| 1118 | unsigned char _interlockedbittestandcomplement(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1119 | #if !__has_builtin(_interlockedbittestandcomplement)
|
---|
| 1120 | __INTRINSICS_USEINLINE
|
---|
| 1121 | __buildbittesti(_interlockedbittestandcomplement, __LONG32, "eor", /* unused param */)
|
---|
| 1122 | #endif
|
---|
| 1123 | #define __INTRINSIC_DEFINED__interlockedbittestandcomplement
|
---|
| 1124 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1125 |
|
---|
| 1126 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndSet)
|
---|
| 1127 | unsigned char InterlockedBitTestAndSet(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1128 | #if !__has_builtin(InterlockedBitTestAndSet)
|
---|
| 1129 | __INTRINSICS_USEINLINE
|
---|
| 1130 | __buildbittesti(InterlockedBitTestAndSet, __LONG32, "orr", /* unused param */)
|
---|
| 1131 | #endif
|
---|
| 1132 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndSet
|
---|
| 1133 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1134 |
|
---|
| 1135 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndReset)
|
---|
| 1136 | unsigned char InterlockedBitTestAndReset(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1137 | #if !__has_builtin(InterlockedBitTestAndReset)
|
---|
| 1138 | __INTRINSICS_USEINLINE
|
---|
| 1139 | __buildbittesti(InterlockedBitTestAndReset, __LONG32, "bic", /* unused param */)
|
---|
| 1140 | #endif
|
---|
| 1141 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndReset
|
---|
| 1142 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1143 |
|
---|
| 1144 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement)
|
---|
| 1145 | unsigned char InterlockedBitTestAndComplement(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1146 | #if !__has_builtin(InterlockedBitTestAndComplement)
|
---|
| 1147 | __INTRINSICS_USEINLINE
|
---|
| 1148 | __buildbittesti(InterlockedBitTestAndComplement, __LONG32, "eor", /* unused param */)
|
---|
| 1149 | #endif
|
---|
| 1150 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndComplement
|
---|
| 1151 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1152 |
|
---|
| 1153 | #if __INTRINSIC_PROLOG(_BitScanForward)
|
---|
| 1154 | __MINGW_EXTENSION unsigned char _BitScanForward(unsigned __LONG32 *Index, unsigned __LONG32 Mask);
|
---|
| 1155 | #if !__has_builtin(_BitScanForward)
|
---|
| 1156 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1157 | unsigned char _BitScanForward(unsigned __LONG32 *Index, unsigned __LONG32 Mask)
|
---|
| 1158 | {
|
---|
| 1159 | if (Mask == 0)
|
---|
| 1160 | return 0;
|
---|
| 1161 | *Index = __builtin_ctz(Mask);
|
---|
| 1162 | return 1;
|
---|
| 1163 | }
|
---|
| 1164 | #endif
|
---|
| 1165 | #define __INTRINSIC_DEFINED__BitScanForward
|
---|
| 1166 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1167 |
|
---|
| 1168 | #if __INTRINSIC_PROLOG(_BitScanReverse)
|
---|
| 1169 | __MINGW_EXTENSION unsigned char _BitScanReverse(unsigned __LONG32 *Index, unsigned __LONG32 Mask);
|
---|
| 1170 | #if !__has_builtin(_BitScanReverse)
|
---|
| 1171 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1172 | unsigned char _BitScanReverse(unsigned __LONG32 *Index, unsigned __LONG32 Mask)
|
---|
| 1173 | {
|
---|
| 1174 | if (Mask == 0)
|
---|
| 1175 | return 0;
|
---|
| 1176 | *Index = 31 - __builtin_clz(Mask);
|
---|
| 1177 | return 1;
|
---|
| 1178 | }
|
---|
| 1179 | #endif
|
---|
| 1180 | #define __INTRINSIC_DEFINED__BitScanReverse
|
---|
| 1181 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1182 |
|
---|
| 1183 | #endif /* defined(__arm__) || defined(_ARM_) */
|
---|
| 1184 |
|
---|
| 1185 | #if defined(__aarch64__) || defined(_ARM64_)
|
---|
| 1186 |
|
---|
| 1187 | #if __INTRINSIC_PROLOG(_interlockedbittestandset)
|
---|
| 1188 | unsigned char _interlockedbittestandset(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1189 | #if !__has_builtin(_interlockedbittestandset)
|
---|
| 1190 | __INTRINSICS_USEINLINE
|
---|
| 1191 | __buildbittesti(_interlockedbittestandset, __LONG32, "orr", /* unused param */)
|
---|
| 1192 | #endif
|
---|
| 1193 | #define __INTRINSIC_DEFINED__interlockedbittestandset
|
---|
| 1194 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1195 |
|
---|
| 1196 | #if __INTRINSIC_PROLOG(_interlockedbittestandreset)
|
---|
| 1197 | unsigned char _interlockedbittestandreset(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1198 | __INTRINSICS_USEINLINE
|
---|
| 1199 | #if !__has_builtin(_interlockedbittestandreset)
|
---|
| 1200 | __buildbittesti(_interlockedbittestandreset, __LONG32, "bic", /* unused param */)
|
---|
| 1201 | #endif
|
---|
| 1202 | #define __INTRINSIC_DEFINED__interlockedbittestandreset
|
---|
| 1203 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1204 |
|
---|
| 1205 | #if __INTRINSIC_PROLOG(_interlockedbittestandcomplement)
|
---|
| 1206 | unsigned char _interlockedbittestandcomplement(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1207 | #if !__has_builtin(_interlockedbittestandcomplement)
|
---|
| 1208 | __INTRINSICS_USEINLINE
|
---|
| 1209 | __buildbittesti(_interlockedbittestandcomplement, __LONG32, "eor", /* unused param */)
|
---|
| 1210 | #endif
|
---|
| 1211 | #define __INTRINSIC_DEFINED__interlockedbittestandcomplement
|
---|
| 1212 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1213 |
|
---|
| 1214 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndSet)
|
---|
| 1215 | unsigned char InterlockedBitTestAndSet(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1216 | #if !__has_builtin(InterlockedBitTestAndSet)
|
---|
| 1217 | __INTRINSICS_USEINLINE
|
---|
| 1218 | __buildbittesti(InterlockedBitTestAndSet, __LONG32, "orr", /* unused param */)
|
---|
| 1219 | #endif
|
---|
| 1220 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndSet
|
---|
| 1221 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1222 |
|
---|
| 1223 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndReset)
|
---|
| 1224 | unsigned char InterlockedBitTestAndReset(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1225 | #if !__has_builtin(InterlockedBitTestAndReset)
|
---|
| 1226 | __INTRINSICS_USEINLINE
|
---|
| 1227 | __buildbittesti(InterlockedBitTestAndReset, __LONG32, "bic", /* unused param */)
|
---|
| 1228 | #endif
|
---|
| 1229 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndReset
|
---|
| 1230 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1231 |
|
---|
| 1232 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement)
|
---|
| 1233 | unsigned char InterlockedBitTestAndComplement(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1234 | #if !__has_builtin(InterlockedBitTestAndComplement)
|
---|
| 1235 | __INTRINSICS_USEINLINE
|
---|
| 1236 | __buildbittesti(InterlockedBitTestAndComplement, __LONG32, "eor", /* unused param */)
|
---|
| 1237 | #endif
|
---|
| 1238 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndComplement
|
---|
| 1239 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1240 |
|
---|
| 1241 | #if __INTRINSIC_PROLOG(_interlockedbittestandset64)
|
---|
| 1242 | unsigned char _interlockedbittestandset64(__int64 volatile *a, __int64 b);
|
---|
| 1243 | #if !__has_builtin(_interlockedbittestandset64)
|
---|
| 1244 | __INTRINSICS_USEINLINE
|
---|
| 1245 | __buildbittesti64(_interlockedbittestandset64, __int64, "orr", /* unused param */)
|
---|
| 1246 | #endif
|
---|
| 1247 | #define __INTRINSIC_DEFINED__interlockedbittestandset64
|
---|
| 1248 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1249 |
|
---|
| 1250 | #if __INTRINSIC_PROLOG(_interlockedbittestandreset64)
|
---|
| 1251 | unsigned char _interlockedbittestandreset64(__int64 volatile *a, __int64 b);
|
---|
| 1252 | __INTRINSICS_USEINLINE
|
---|
| 1253 | #if !__has_builtin(_interlockedbittestandreset64)
|
---|
| 1254 | __buildbittesti64(_interlockedbittestandreset64, __int64, "bic", /* unused param */)
|
---|
| 1255 | #endif
|
---|
| 1256 | #define __INTRINSIC_DEFINED__interlockedbittestandreset64
|
---|
| 1257 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1258 |
|
---|
| 1259 | #if __INTRINSIC_PROLOG(_interlockedbittestandcomplement64)
|
---|
| 1260 | unsigned char _interlockedbittestandcomplement64(__int64 volatile *a, __int64 b);
|
---|
| 1261 | #if !__has_builtin(_interlockedbittestandcomplement64)
|
---|
| 1262 | __INTRINSICS_USEINLINE
|
---|
| 1263 | __buildbittesti64(_interlockedbittestandcomplement64, __int64, "eor", /* unused param */)
|
---|
| 1264 | #endif
|
---|
| 1265 | #define __INTRINSIC_DEFINED__interlockedbittestandcomplement64
|
---|
| 1266 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1267 |
|
---|
| 1268 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndSet64)
|
---|
| 1269 | unsigned char InterlockedBitTestAndSet64(volatile __int64 *a, __int64 b);
|
---|
| 1270 | #if !__has_builtin(InterlockedBitTestAndSet64)
|
---|
| 1271 | __INTRINSICS_USEINLINE
|
---|
| 1272 | __buildbittesti64(InterlockedBitTestAndSet64, __int64, "orr", /* unused param */)
|
---|
| 1273 | #endif
|
---|
| 1274 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndSet64
|
---|
| 1275 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1276 |
|
---|
| 1277 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndReset64)
|
---|
| 1278 | unsigned char InterlockedBitTestAndReset64(volatile __int64 *a, __int64 b);
|
---|
| 1279 | #if !__has_builtin(InterlockedBitTestAndReset64)
|
---|
| 1280 | __INTRINSICS_USEINLINE
|
---|
| 1281 | __buildbittesti64(InterlockedBitTestAndReset64, __int64, "bic", /* unused param */)
|
---|
| 1282 | #endif
|
---|
| 1283 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndReset64
|
---|
| 1284 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1285 |
|
---|
| 1286 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement64)
|
---|
| 1287 | unsigned char InterlockedBitTestAndComplement64(volatile __int64 *a, __int64 b);
|
---|
| 1288 | #if !__has_builtin(InterlockedBitTestAndComplement64)
|
---|
| 1289 | __INTRINSICS_USEINLINE
|
---|
| 1290 | __buildbittesti64(InterlockedBitTestAndComplement64, __int64, "eor", /* unused param */)
|
---|
| 1291 | #endif
|
---|
| 1292 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndComplement64
|
---|
| 1293 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1294 |
|
---|
| 1295 | #if __INTRINSIC_PROLOG(_InterlockedAnd64)
|
---|
| 1296 | __MINGW_EXTENSION __int64 _InterlockedAnd64(__int64 volatile *, __int64);
|
---|
| 1297 | #if !__has_builtin(_InterlockedAnd64)
|
---|
| 1298 | __INTRINSICS_USEINLINE
|
---|
| 1299 | __buildlogicali(_InterlockedAnd64, __int64, and)
|
---|
| 1300 | #endif
|
---|
| 1301 | #define __INTRINSIC_DEFINED__InterlockedAnd64
|
---|
| 1302 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1303 |
|
---|
| 1304 | #if __INTRINSIC_PROLOG(_InterlockedOr64)
|
---|
| 1305 | __MINGW_EXTENSION __int64 _InterlockedOr64(__int64 volatile *, __int64);
|
---|
| 1306 | #if !__has_builtin(_InterlockedOr64)
|
---|
| 1307 | __INTRINSICS_USEINLINE
|
---|
| 1308 | __buildlogicali(_InterlockedOr64, __int64, or)
|
---|
| 1309 | #endif
|
---|
| 1310 | #define __INTRINSIC_DEFINED__InterlockedOr64
|
---|
| 1311 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1312 |
|
---|
| 1313 | #if __INTRINSIC_PROLOG(_InterlockedXor64)
|
---|
| 1314 | __MINGW_EXTENSION __int64 _InterlockedXor64(__int64 volatile *, __int64);
|
---|
| 1315 | #if !__has_builtin(_InterlockedXor64)
|
---|
| 1316 | __INTRINSICS_USEINLINE
|
---|
| 1317 | __buildlogicali(_InterlockedXor64, __int64, xor)
|
---|
| 1318 | #endif
|
---|
| 1319 | #define __INTRINSIC_DEFINED__InterlockedXor64
|
---|
| 1320 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1321 |
|
---|
| 1322 | #if __INTRINSIC_PROLOG(_InterlockedIncrement64)
|
---|
| 1323 | __MINGW_EXTENSION __int64 _InterlockedIncrement64(__int64 volatile *Addend);
|
---|
| 1324 | #if !__has_builtin(_InterlockedIncrement64)
|
---|
| 1325 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1326 | __int64 _InterlockedIncrement64(__int64 volatile *Addend) {
|
---|
| 1327 | return __sync_add_and_fetch(Addend, 1);
|
---|
| 1328 | }
|
---|
| 1329 | #endif
|
---|
| 1330 | #define __INTRINSIC_DEFINED__InterlockedIncrement64
|
---|
| 1331 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1332 |
|
---|
| 1333 | #if __INTRINSIC_PROLOG(_InterlockedDecrement64)
|
---|
| 1334 | __MINGW_EXTENSION __int64 _InterlockedDecrement64(__int64 volatile *Addend);
|
---|
| 1335 | #if !__has_builtin(_InterlockedDecrement64)
|
---|
| 1336 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1337 | __int64 _InterlockedDecrement64(__int64 volatile *Addend) {
|
---|
| 1338 | return __sync_sub_and_fetch(Addend, 1);
|
---|
| 1339 | }
|
---|
| 1340 | #endif
|
---|
| 1341 | #define __INTRINSIC_DEFINED__InterlockedDecrement64
|
---|
| 1342 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1343 |
|
---|
| 1344 | #if __INTRINSIC_PROLOG(_InterlockedExchange64)
|
---|
| 1345 | __MINGW_EXTENSION __int64 _InterlockedExchange64(__int64 volatile *Target, __int64 Value);
|
---|
| 1346 | #if !__has_builtin(_InterlockedExchange64)
|
---|
| 1347 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1348 | __int64 _InterlockedExchange64(__int64 volatile *Target, __int64 Value) {
|
---|
| 1349 | return __sync_lock_test_and_set(Target, Value);
|
---|
| 1350 | }
|
---|
| 1351 | #endif
|
---|
| 1352 | #define __INTRINSIC_DEFINED__InterlockedExchange64
|
---|
| 1353 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1354 |
|
---|
| 1355 | #if __INTRINSIC_PROLOG(_InterlockedExchangeAdd64)
|
---|
| 1356 | __MINGW_EXTENSION __int64 _InterlockedExchangeAdd64(__int64 volatile *Addend, __int64 Value);
|
---|
| 1357 | #if !__has_builtin(_InterlockedExchangeAdd64)
|
---|
| 1358 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1359 | __int64 _InterlockedExchangeAdd64(__int64 volatile *Addend, __int64 Value) {
|
---|
| 1360 | return __sync_fetch_and_add(Addend, Value);
|
---|
| 1361 | }
|
---|
| 1362 | #endif
|
---|
| 1363 | #define __INTRINSIC_DEFINED__InterlockedExchangeAdd64
|
---|
| 1364 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1365 |
|
---|
| 1366 | #if __INTRINSIC_PROLOG(_BitScanForward)
|
---|
| 1367 | __MINGW_EXTENSION unsigned char _BitScanForward(unsigned __LONG32 *Index, unsigned __LONG32 Mask);
|
---|
| 1368 | #if !__has_builtin(_BitScanForward)
|
---|
| 1369 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1370 | unsigned char _BitScanForward(unsigned __LONG32 *Index, unsigned __LONG32 Mask)
|
---|
| 1371 | {
|
---|
| 1372 | if (Mask == 0)
|
---|
| 1373 | return 0;
|
---|
| 1374 | *Index = __builtin_ctz(Mask);
|
---|
| 1375 | return 1;
|
---|
| 1376 | }
|
---|
| 1377 | #endif
|
---|
| 1378 | #define __INTRINSIC_DEFINED__BitScanForward
|
---|
| 1379 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1380 |
|
---|
| 1381 | #if __INTRINSIC_PROLOG(_BitScanReverse)
|
---|
| 1382 | __MINGW_EXTENSION unsigned char _BitScanReverse(unsigned __LONG32 *Index, unsigned __LONG32 Mask);
|
---|
| 1383 | #if !__has_builtin(_BitScanReverse)
|
---|
| 1384 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1385 | unsigned char _BitScanReverse(unsigned __LONG32 *Index, unsigned __LONG32 Mask)
|
---|
| 1386 | {
|
---|
| 1387 | if (Mask == 0)
|
---|
| 1388 | return 0;
|
---|
| 1389 | *Index = 31 - __builtin_clz(Mask);
|
---|
| 1390 | return 1;
|
---|
| 1391 | }
|
---|
| 1392 | #endif
|
---|
| 1393 | #define __INTRINSIC_DEFINED__BitScanReverse
|
---|
| 1394 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1395 |
|
---|
| 1396 | #if __INTRINSIC_PROLOG(_BitScanForward64)
|
---|
| 1397 | __MINGW_EXTENSION unsigned char _BitScanForward64(unsigned __LONG32 *Index, unsigned __int64 Mask);
|
---|
| 1398 | #if !__has_builtin(_BitScanForward64)
|
---|
| 1399 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1400 | unsigned char _BitScanForward64(unsigned __LONG32 *Index, unsigned __int64 Mask)
|
---|
| 1401 | {
|
---|
| 1402 | if (Mask == 0)
|
---|
| 1403 | return 0;
|
---|
| 1404 | *Index = __builtin_ctzll(Mask);
|
---|
| 1405 | return 1;
|
---|
| 1406 | }
|
---|
| 1407 | #endif
|
---|
| 1408 | #define __INTRINSIC_DEFINED__BitScanForward64
|
---|
| 1409 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1410 |
|
---|
| 1411 | #if __INTRINSIC_PROLOG(_BitScanReverse64)
|
---|
| 1412 | __MINGW_EXTENSION unsigned char _BitScanReverse64(unsigned __LONG32 *Index, unsigned __int64 Mask);
|
---|
| 1413 | #if !__has_builtin(_BitScanReverse64)
|
---|
| 1414 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1415 | unsigned char _BitScanReverse64(unsigned __LONG32 *Index, unsigned __int64 Mask)
|
---|
| 1416 | {
|
---|
| 1417 | if (Mask == 0)
|
---|
| 1418 | return 0;
|
---|
| 1419 | *Index = 63 - __builtin_clzll(Mask);
|
---|
| 1420 | return 1;
|
---|
| 1421 | }
|
---|
| 1422 | #endif
|
---|
| 1423 | #define __INTRINSIC_DEFINED__BitScanReverse64
|
---|
| 1424 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1425 |
|
---|
| 1426 | #endif /* defined(__aarch64__) || define(_ARM64_) */
|
---|
| 1427 |
|
---|
| 1428 | #if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
|
---|
| 1429 |
|
---|
| 1430 | #if __INTRINSIC_PROLOG(_bittest)
|
---|
| 1431 | unsigned char _bittest(const __LONG32 *__a, __LONG32 __b);
|
---|
| 1432 | #if !__has_builtin(_bittest)
|
---|
| 1433 | __INTRINSICS_USEINLINE
|
---|
| 1434 | unsigned char _bittest(const __LONG32 *__a, __LONG32 __b)
|
---|
| 1435 | {
|
---|
| 1436 | return (*__a >> __b) & 1;
|
---|
| 1437 | }
|
---|
| 1438 | #endif
|
---|
| 1439 | #define __INTRINSIC_DEFINED__bittest
|
---|
| 1440 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1441 |
|
---|
| 1442 | #if __INTRINSIC_PROLOG(_bittestandset)
|
---|
| 1443 | unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b);
|
---|
| 1444 | #if !__has_builtin(_bittestandset)
|
---|
| 1445 | __INTRINSICS_USEINLINE
|
---|
| 1446 | unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b)
|
---|
| 1447 | {
|
---|
| 1448 | unsigned char __v = (*__a >> __b) & 1;
|
---|
| 1449 | *__a |= 1UL << __b;
|
---|
| 1450 | return __v;
|
---|
| 1451 | }
|
---|
| 1452 | #endif
|
---|
| 1453 | #define __INTRINSIC_DEFINED__bittestandset
|
---|
| 1454 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1455 |
|
---|
| 1456 | #if __INTRINSIC_PROLOG(_bittestandreset)
|
---|
| 1457 | unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b);
|
---|
| 1458 | #if !__has_builtin(_bittestandreset)
|
---|
| 1459 | __INTRINSICS_USEINLINE
|
---|
| 1460 | unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b)
|
---|
| 1461 | {
|
---|
| 1462 | unsigned char __v = (*__a >> __b) & 1;
|
---|
| 1463 | *__a &= ~(1UL << __b);
|
---|
| 1464 | return __v;
|
---|
| 1465 | }
|
---|
| 1466 | #endif
|
---|
| 1467 | #define __INTRINSIC_DEFINED__bittestandreset
|
---|
| 1468 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1469 |
|
---|
| 1470 | #if __INTRINSIC_PROLOG(_bittestandcomplement)
|
---|
| 1471 | unsigned char _bittestandcomplement(__LONG32 *a, __LONG32 b);
|
---|
| 1472 | #if !__has_builtin(_bittestandcomplement)
|
---|
| 1473 | __INTRINSICS_USEINLINE
|
---|
| 1474 | unsigned char _bittestandcomplement(__LONG32 *__a, __LONG32 __b)
|
---|
| 1475 | {
|
---|
| 1476 | unsigned char __v = (*__a >> __b) & 1;
|
---|
| 1477 | *__a ^= 1UL << __b;
|
---|
| 1478 | return __v;
|
---|
| 1479 | }
|
---|
| 1480 | #endif
|
---|
| 1481 | #define __INTRINSIC_DEFINED__bittestandcomplement
|
---|
| 1482 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1483 |
|
---|
| 1484 | #endif /* defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */
|
---|
| 1485 |
|
---|
| 1486 | #if defined(__aarch64__) || defined(_ARM64_)
|
---|
| 1487 |
|
---|
| 1488 | #if __INTRINSIC_PROLOG(_bittest64)
|
---|
| 1489 | unsigned char _bittest64(const __int64 *__a, __int64 __b);
|
---|
| 1490 | #if !__has_builtin(_bittest64)
|
---|
| 1491 | __INTRINSICS_USEINLINE
|
---|
| 1492 | unsigned char _bittest64(const __int64 *__a, __int64 __b)
|
---|
| 1493 | {
|
---|
| 1494 | return (*__a >> __b) & 1;
|
---|
| 1495 | }
|
---|
| 1496 | #endif
|
---|
| 1497 | #define __INTRINSIC_DEFINED__bittest64
|
---|
| 1498 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1499 |
|
---|
| 1500 | #if __INTRINSIC_PROLOG(_bittestandset64)
|
---|
| 1501 | unsigned char _bittestandset64(__int64 *__a, __int64 __b);
|
---|
| 1502 | #if !__has_builtin(_bittestandset64)
|
---|
| 1503 | __INTRINSICS_USEINLINE
|
---|
| 1504 | unsigned char _bittestandset64(__int64 *__a, __int64 __b)
|
---|
| 1505 | {
|
---|
| 1506 | unsigned char __v = (*__a >> __b) & 1;
|
---|
| 1507 | *__a |= 1ULL << __b;
|
---|
| 1508 | return __v;
|
---|
| 1509 | }
|
---|
| 1510 | #endif
|
---|
| 1511 | #define __INTRINSIC_DEFINED__bittestandset64
|
---|
| 1512 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1513 |
|
---|
| 1514 | #if __INTRINSIC_PROLOG(_bittestandreset64)
|
---|
| 1515 | unsigned char _bittestandreset64(__int64 *__a, __int64 __b);
|
---|
| 1516 | #if !__has_builtin(_bittestandreset64)
|
---|
| 1517 | __INTRINSICS_USEINLINE
|
---|
| 1518 | unsigned char _bittestandreset64(__int64 *__a, __int64 __b)
|
---|
| 1519 | {
|
---|
| 1520 | unsigned char __v = (*__a >> __b) & 1;
|
---|
| 1521 | *__a &= ~(1ULL << __b);
|
---|
| 1522 | return __v;
|
---|
| 1523 | }
|
---|
| 1524 | #endif
|
---|
| 1525 | #define __INTRINSIC_DEFINED__bittestandreset64
|
---|
| 1526 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1527 |
|
---|
| 1528 | #if __INTRINSIC_PROLOG(_bittestandcomplement64)
|
---|
| 1529 | unsigned char _bittestandcomplement64(__int64 *a, __int64 b);
|
---|
| 1530 | #if !__has_builtin(_bittestandcomplement64)
|
---|
| 1531 | __INTRINSICS_USEINLINE
|
---|
| 1532 | unsigned char _bittestandcomplement64(__int64 *__a, __int64 __b)
|
---|
| 1533 | {
|
---|
| 1534 | unsigned char __v = (*__a >> __b) & 1;
|
---|
| 1535 | *__a ^= 1ULL << __b;
|
---|
| 1536 | return __v;
|
---|
| 1537 | }
|
---|
| 1538 | #endif
|
---|
| 1539 | #define __INTRINSIC_DEFINED__bittestandcomplement64
|
---|
| 1540 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1541 |
|
---|
| 1542 | #endif /* defined(__aarch64__) || define(_ARM64_) */
|
---|
| 1543 |
|
---|
| 1544 | /* ***************************************************** */
|
---|
| 1545 |
|
---|
| 1546 | #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
|
---|
| 1547 |
|
---|
| 1548 | #if __INTRINSIC_PROLOG(__popcnt16)
|
---|
| 1549 | unsigned short __popcnt16(unsigned short);
|
---|
| 1550 | #if !__has_builtin(__popcnt16)
|
---|
| 1551 | __INTRINSICS_USEINLINE
|
---|
| 1552 | unsigned short __popcnt16(unsigned short value)
|
---|
| 1553 | {
|
---|
| 1554 | return __builtin_popcount(value);
|
---|
| 1555 | }
|
---|
| 1556 | #endif
|
---|
| 1557 | #define __INTRINSIC_DEFINED___popcnt16
|
---|
| 1558 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1559 |
|
---|
| 1560 | #if __INTRINSIC_PROLOG(__popcnt)
|
---|
| 1561 | unsigned int __popcnt(unsigned int);
|
---|
| 1562 | #if !__has_builtin(__popcnt)
|
---|
| 1563 | __INTRINSICS_USEINLINE
|
---|
| 1564 | unsigned int __popcnt(unsigned int value)
|
---|
| 1565 | {
|
---|
| 1566 | return __builtin_popcount(value);
|
---|
| 1567 | }
|
---|
| 1568 | #endif
|
---|
| 1569 | #define __INTRINSIC_DEFINED___popcnt
|
---|
| 1570 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1571 |
|
---|
| 1572 | #if __INTRINSIC_PROLOG(__popcnt64)
|
---|
| 1573 | unsigned __int64 __popcnt64(unsigned __int64);
|
---|
| 1574 | #if !__has_builtin(__popcnt64)
|
---|
| 1575 | __INTRINSICS_USEINLINE
|
---|
| 1576 | unsigned __int64 __popcnt64(unsigned __int64 value)
|
---|
| 1577 | {
|
---|
| 1578 | return __builtin_popcountll(value);
|
---|
| 1579 | }
|
---|
| 1580 | #endif
|
---|
| 1581 | #define __INTRINSIC_DEFINED___popcnt64
|
---|
| 1582 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1583 |
|
---|
| 1584 | #if __INTRINSIC_PROLOG(_InterlockedAnd)
|
---|
| 1585 | __LONG32 _InterlockedAnd(__LONG32 volatile *, __LONG32);
|
---|
| 1586 | #if !__has_builtin(_InterlockedAnd)
|
---|
| 1587 | __INTRINSICS_USEINLINE
|
---|
| 1588 | __buildlogicali(_InterlockedAnd, __LONG32, and)
|
---|
| 1589 | #endif
|
---|
| 1590 | #define __INTRINSIC_DEFINED__InterlockedAnd
|
---|
| 1591 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1592 |
|
---|
| 1593 | #if __INTRINSIC_PROLOG(_InterlockedOr)
|
---|
| 1594 | __LONG32 _InterlockedOr(__LONG32 volatile *, __LONG32);
|
---|
| 1595 | #if !__has_builtin(_InterlockedOr)
|
---|
| 1596 | __INTRINSICS_USEINLINE
|
---|
| 1597 | __buildlogicali(_InterlockedOr, __LONG32, or)
|
---|
| 1598 | #endif
|
---|
| 1599 | #define __INTRINSIC_DEFINED__InterlockedOr
|
---|
| 1600 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1601 |
|
---|
| 1602 | #if __INTRINSIC_PROLOG(_InterlockedXor)
|
---|
| 1603 | __LONG32 _InterlockedXor(__LONG32 volatile *, __LONG32);
|
---|
| 1604 | #if !__has_builtin(_InterlockedXor)
|
---|
| 1605 | __INTRINSICS_USEINLINE
|
---|
| 1606 | __buildlogicali(_InterlockedXor, __LONG32, xor)
|
---|
| 1607 | #endif
|
---|
| 1608 | #define __INTRINSIC_DEFINED__InterlockedXor
|
---|
| 1609 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1610 |
|
---|
| 1611 | #if __INTRINSIC_PROLOG(_InterlockedIncrement16)
|
---|
| 1612 | short _InterlockedIncrement16(short volatile *Addend);
|
---|
| 1613 | #if !__has_builtin(_InterlockedIncrement16)
|
---|
| 1614 | __INTRINSICS_USEINLINE
|
---|
| 1615 | short _InterlockedIncrement16(short volatile *Addend) {
|
---|
| 1616 | return __sync_add_and_fetch(Addend, 1);
|
---|
| 1617 | }
|
---|
| 1618 | #endif
|
---|
| 1619 | #define __INTRINSIC_DEFINED__InterlockedIncrement16
|
---|
| 1620 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1621 |
|
---|
| 1622 | #if __INTRINSIC_PROLOG(_InterlockedDecrement16)
|
---|
| 1623 | short _InterlockedDecrement16(short volatile *Addend);
|
---|
| 1624 | #if !__has_builtin(_InterlockedDecrement16)
|
---|
| 1625 | __INTRINSICS_USEINLINE
|
---|
| 1626 | short _InterlockedDecrement16(short volatile *Addend) {
|
---|
| 1627 | return __sync_sub_and_fetch(Addend, 1);
|
---|
| 1628 | }
|
---|
| 1629 | #endif
|
---|
| 1630 | #define __INTRINSIC_DEFINED__InterlockedDecrement16
|
---|
| 1631 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1632 |
|
---|
| 1633 | #if __INTRINSIC_PROLOG(_InterlockedCompareExchange16)
|
---|
| 1634 | short _InterlockedCompareExchange16(short volatile *Destination, short ExChange, short Comperand);
|
---|
| 1635 | #if !__has_builtin(_InterlockedCompareExchange16)
|
---|
| 1636 | __INTRINSICS_USEINLINE
|
---|
| 1637 | short _InterlockedCompareExchange16(short volatile *Destination, short ExChange, short Comperand) {
|
---|
| 1638 | return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
|
---|
| 1639 | }
|
---|
| 1640 | #endif
|
---|
| 1641 | #define __INTRINSIC_DEFINED__InterlockedCompareExchange16
|
---|
| 1642 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1643 |
|
---|
| 1644 | #if __INTRINSIC_PROLOG(_InterlockedExchangeAdd)
|
---|
| 1645 | __LONG32 _InterlockedExchangeAdd(__LONG32 volatile *Addend, __LONG32 Value);
|
---|
| 1646 | #if !__has_builtin(_InterlockedExchangeAdd)
|
---|
| 1647 | __INTRINSICS_USEINLINE
|
---|
| 1648 | __LONG32 _InterlockedExchangeAdd(__LONG32 volatile *Addend, __LONG32 Value) {
|
---|
| 1649 | return __sync_fetch_and_add(Addend, Value);
|
---|
| 1650 | }
|
---|
| 1651 | #endif
|
---|
| 1652 | #define __INTRINSIC_DEFINED__InterlockedExchangeAdd
|
---|
| 1653 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1654 |
|
---|
| 1655 | #if __INTRINSIC_PROLOG(_InterlockedCompareExchange)
|
---|
| 1656 | __LONG32 _InterlockedCompareExchange(__LONG32 volatile *Destination, __LONG32 ExChange, __LONG32 Comperand);
|
---|
| 1657 | #if !__has_builtin(_InterlockedCompareExchange)
|
---|
| 1658 | __INTRINSICS_USEINLINE
|
---|
| 1659 | __LONG32 _InterlockedCompareExchange(__LONG32 volatile *Destination, __LONG32 ExChange, __LONG32 Comperand) {
|
---|
| 1660 | return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
|
---|
| 1661 | }
|
---|
| 1662 | #endif
|
---|
| 1663 | #define __INTRINSIC_DEFINED__InterlockedCompareExchange
|
---|
| 1664 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1665 |
|
---|
| 1666 | #if __INTRINSIC_PROLOG(_InterlockedIncrement)
|
---|
| 1667 | __LONG32 _InterlockedIncrement(__LONG32 volatile *Addend);
|
---|
| 1668 | #if !__has_builtin(_InterlockedIncrement)
|
---|
| 1669 | __INTRINSICS_USEINLINE
|
---|
| 1670 | __LONG32 _InterlockedIncrement(__LONG32 volatile *Addend) {
|
---|
| 1671 | return __sync_add_and_fetch(Addend, 1);
|
---|
| 1672 | }
|
---|
| 1673 | #endif
|
---|
| 1674 | #define __INTRINSIC_DEFINED__InterlockedIncrement
|
---|
| 1675 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1676 |
|
---|
| 1677 | #if __INTRINSIC_PROLOG(_InterlockedDecrement)
|
---|
| 1678 | __LONG32 _InterlockedDecrement(__LONG32 volatile *Addend);
|
---|
| 1679 | #if !__has_builtin(_InterlockedDecrement)
|
---|
| 1680 | __INTRINSICS_USEINLINE
|
---|
| 1681 | __LONG32 _InterlockedDecrement(__LONG32 volatile *Addend) {
|
---|
| 1682 | return __sync_sub_and_fetch(Addend, 1);
|
---|
| 1683 | }
|
---|
| 1684 | #endif
|
---|
| 1685 | #define __INTRINSIC_DEFINED__InterlockedDecrement
|
---|
| 1686 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1687 |
|
---|
| 1688 | #if __INTRINSIC_PROLOG(_InterlockedAdd)
|
---|
| 1689 | __LONG32 _InterlockedAdd(__LONG32 volatile *Addend, __LONG32 Value);
|
---|
| 1690 | #if !__has_builtin(_InterlockedAdd)
|
---|
| 1691 | __INTRINSICS_USEINLINE
|
---|
| 1692 | __LONG32 _InterlockedAdd(__LONG32 volatile *Addend, __LONG32 Value) {
|
---|
| 1693 | return __sync_add_and_fetch(Addend, Value);
|
---|
| 1694 | }
|
---|
| 1695 | #endif
|
---|
| 1696 | #define __INTRINSIC_DEFINED__InterlockedAdd
|
---|
| 1697 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1698 |
|
---|
| 1699 | #if __INTRINSIC_PROLOG(_InterlockedAdd64)
|
---|
| 1700 | __MINGW_EXTENSION __int64 _InterlockedAdd64(__int64 volatile *Addend, __int64 Value);
|
---|
| 1701 | #if !__has_builtin(_InterlockedAdd64)
|
---|
| 1702 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1703 | __int64 _InterlockedAdd64(__int64 volatile *Addend, __int64 Value) {
|
---|
| 1704 | return __sync_add_and_fetch(Addend, Value);
|
---|
| 1705 | }
|
---|
| 1706 | #endif
|
---|
| 1707 | #define __INTRINSIC_DEFINED__InterlockedAdd64
|
---|
| 1708 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1709 |
|
---|
| 1710 | #if __INTRINSIC_PROLOG(_InterlockedExchange)
|
---|
| 1711 | __LONG32 _InterlockedExchange(__LONG32 volatile *Target, __LONG32 Value);
|
---|
| 1712 | #if !__has_builtin(_InterlockedExchange)
|
---|
| 1713 | __INTRINSICS_USEINLINE
|
---|
| 1714 | __LONG32 _InterlockedExchange(__LONG32 volatile *Target, __LONG32 Value) {
|
---|
| 1715 | return __sync_lock_test_and_set(Target, Value);
|
---|
| 1716 | }
|
---|
| 1717 | #endif
|
---|
| 1718 | #define __INTRINSIC_DEFINED__InterlockedExchange
|
---|
| 1719 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1720 |
|
---|
| 1721 | #if __INTRINSIC_PROLOG(_InterlockedCompareExchange64)
|
---|
| 1722 | __MINGW_EXTENSION __int64 _InterlockedCompareExchange64(__int64 volatile *Destination, __int64 ExChange, __int64 Comperand);
|
---|
| 1723 | #if !__has_builtin(_InterlockedCompareExchange64)
|
---|
| 1724 | __MINGW_EXTENSION __INTRINSICS_USEINLINE
|
---|
| 1725 | __int64 _InterlockedCompareExchange64(__int64 volatile *Destination, __int64 ExChange, __int64 Comperand) {
|
---|
| 1726 | return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
|
---|
| 1727 | }
|
---|
| 1728 | #endif
|
---|
| 1729 | #define __INTRINSIC_DEFINED__InterlockedCompareExchange64
|
---|
| 1730 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1731 |
|
---|
| 1732 | #if __INTRINSIC_PROLOG(_InterlockedCompareExchangePointer)
|
---|
| 1733 | void *_InterlockedCompareExchangePointer(void * volatile *Destination, void *ExChange, void *Comperand);
|
---|
| 1734 | #if !__has_builtin(_InterlockedCompareExchangePointer)
|
---|
| 1735 | __INTRINSICS_USEINLINE
|
---|
| 1736 | void *_InterlockedCompareExchangePointer(void *volatile *Destination, void *ExChange, void *Comperand) {
|
---|
| 1737 | return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
|
---|
| 1738 | }
|
---|
| 1739 | #endif
|
---|
| 1740 | #define __INTRINSIC_DEFINED__InterlockedCompareExchangePointer
|
---|
| 1741 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1742 |
|
---|
| 1743 | #if __INTRINSIC_PROLOG(_InterlockedExchangePointer)
|
---|
| 1744 | void *_InterlockedExchangePointer(void *volatile *Target,void *Value);
|
---|
| 1745 | #if !__has_builtin(_InterlockedExchangePointer)
|
---|
| 1746 | __INTRINSICS_USEINLINE
|
---|
| 1747 | void *_InterlockedExchangePointer(void *volatile *Target,void *Value) {
|
---|
| 1748 | return __sync_lock_test_and_set(Target, Value);
|
---|
| 1749 | }
|
---|
| 1750 | #endif
|
---|
| 1751 | #define __INTRINSIC_DEFINED__InterlockedExchangePointer
|
---|
| 1752 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1753 |
|
---|
| 1754 | #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */
|
---|
| 1755 |
|
---|
| 1756 | #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_)
|
---|
| 1757 |
|
---|
| 1758 | #if __INTRINSIC_PROLOG(__int2c)
|
---|
| 1759 | void __int2c(void);
|
---|
| 1760 | #if !__has_builtin(__int2c)
|
---|
| 1761 | __INTRINSICS_USEINLINE
|
---|
| 1762 | void __int2c(void) {
|
---|
| 1763 | __buildint(0x2c);
|
---|
| 1764 | }
|
---|
| 1765 | #endif
|
---|
| 1766 | #define __INTRINSIC_DEFINED___int2c
|
---|
| 1767 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1768 |
|
---|
| 1769 | #if __INTRINSIC_PROLOG(__stosb)
|
---|
| 1770 | void __stosb(unsigned char *, unsigned char, size_t);
|
---|
| 1771 | #if !__has_builtin(__stosb)
|
---|
| 1772 | __INTRINSICS_USEINLINE
|
---|
| 1773 | __buildstos(__stosb, unsigned char, "b|b")
|
---|
| 1774 | #endif
|
---|
| 1775 | #define __INTRINSIC_DEFINED___stosb
|
---|
| 1776 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1777 |
|
---|
| 1778 | #if __INTRINSIC_PROLOG(__stosw)
|
---|
| 1779 | void __stosw(unsigned short *, unsigned short, size_t);
|
---|
| 1780 | #if !__has_builtin(__stosw)
|
---|
| 1781 | __INTRINSICS_USEINLINE
|
---|
| 1782 | __buildstos(__stosw, unsigned short, "w|w")
|
---|
| 1783 | #endif
|
---|
| 1784 | #define __INTRINSIC_DEFINED___stosw
|
---|
| 1785 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1786 |
|
---|
| 1787 | #if __INTRINSIC_PROLOG(__stosd)
|
---|
| 1788 | void __stosd(unsigned __LONG32 *, unsigned __LONG32, size_t);
|
---|
| 1789 | #if !__has_builtin(__stosd)
|
---|
| 1790 | __INTRINSICS_USEINLINE
|
---|
| 1791 | __buildstos(__stosd, unsigned __LONG32, "l|d")
|
---|
| 1792 | #endif
|
---|
| 1793 | #define __INTRINSIC_DEFINED___stosd
|
---|
| 1794 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1795 |
|
---|
| 1796 | #if __INTRINSIC_PROLOG(_interlockedbittestandset)
|
---|
| 1797 | unsigned char _interlockedbittestandset(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1798 | #if !__has_builtin(_interlockedbittestandset)
|
---|
| 1799 | __INTRINSICS_USEINLINE
|
---|
| 1800 | __buildbittesti(_interlockedbittestandset, __LONG32, "lock bts{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
|
---|
| 1801 | #endif
|
---|
| 1802 | #define __INTRINSIC_DEFINED__interlockedbittestandset
|
---|
| 1803 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1804 |
|
---|
| 1805 | #if __INTRINSIC_PROLOG(_interlockedbittestandreset)
|
---|
| 1806 | unsigned char _interlockedbittestandreset(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1807 | #if !__has_builtin(_interlockedbittestandreset)
|
---|
| 1808 | __INTRINSICS_USEINLINE
|
---|
| 1809 | __buildbittesti(_interlockedbittestandreset, __LONG32, "lock btr{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
|
---|
| 1810 | #endif
|
---|
| 1811 | #define __INTRINSIC_DEFINED__interlockedbittestandreset
|
---|
| 1812 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1813 |
|
---|
| 1814 | #if __INTRINSIC_PROLOG(_interlockedbittestandcomplement)
|
---|
| 1815 | unsigned char _interlockedbittestandcomplement(__LONG32 volatile *a, __LONG32 b);
|
---|
| 1816 | #if !__has_builtin(_interlockedbittestandcomplement)
|
---|
| 1817 | __INTRINSICS_USEINLINE
|
---|
| 1818 | __buildbittesti(_interlockedbittestandcomplement, __LONG32, "lock btc{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
|
---|
| 1819 | #endif
|
---|
| 1820 | #define __INTRINSIC_DEFINED__interlockedbittestandcomplement
|
---|
| 1821 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1822 |
|
---|
| 1823 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndSet)
|
---|
| 1824 | unsigned char InterlockedBitTestAndSet(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1825 | #if !__has_builtin(InterlockedBitTestAndSet)
|
---|
| 1826 | __INTRINSICS_USEINLINE
|
---|
| 1827 | __buildbittesti(InterlockedBitTestAndSet, __LONG32, "lock bts{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
|
---|
| 1828 | #endif
|
---|
| 1829 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndSet
|
---|
| 1830 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1831 |
|
---|
| 1832 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndReset)
|
---|
| 1833 | unsigned char InterlockedBitTestAndReset(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1834 | #if !__has_builtin(InterlockedBitTestAndReset)
|
---|
| 1835 | __INTRINSICS_USEINLINE
|
---|
| 1836 | __buildbittesti(InterlockedBitTestAndReset, __LONG32, "lock btr{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
|
---|
| 1837 | #endif
|
---|
| 1838 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndReset
|
---|
| 1839 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1840 |
|
---|
| 1841 | #if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement)
|
---|
| 1842 | unsigned char InterlockedBitTestAndComplement(volatile __LONG32 *a, __LONG32 b);
|
---|
| 1843 | #if !__has_builtin(InterlockedBitTestAndComplement)
|
---|
| 1844 | __INTRINSICS_USEINLINE
|
---|
| 1845 | __buildbittesti(InterlockedBitTestAndComplement, __LONG32, "lock btc{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
|
---|
| 1846 | #endif
|
---|
| 1847 | #define __INTRINSIC_DEFINED_InterlockedBitTestAndComplement
|
---|
| 1848 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1849 |
|
---|
| 1850 | #if __INTRINSIC_PROLOG(_BitScanForward)
|
---|
| 1851 | unsigned char _BitScanForward(unsigned __LONG32 *Index, unsigned __LONG32 Mask);
|
---|
| 1852 | #if !__has_builtin(_BitScanForward)
|
---|
| 1853 | __INTRINSICS_USEINLINE
|
---|
| 1854 | __buildbitscan(_BitScanForward, unsigned __LONG32, "bsf{l %[Mask],%[Index] | %[Index],%[Mask]}")
|
---|
| 1855 | #endif
|
---|
| 1856 | #define __INTRINSIC_DEFINED__BitScanForward
|
---|
| 1857 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1858 |
|
---|
| 1859 | #if __INTRINSIC_PROLOG(_BitScanReverse)
|
---|
| 1860 | unsigned char _BitScanReverse(unsigned __LONG32 *Index, unsigned __LONG32 Mask);
|
---|
| 1861 | #if !__has_builtin(_BitScanReverse)
|
---|
| 1862 | __INTRINSICS_USEINLINE
|
---|
| 1863 | __buildbitscan(_BitScanReverse, unsigned __LONG32, "bsr{l %[Mask],%[Index] | %[Index],%[Mask]}")
|
---|
| 1864 | #endif
|
---|
| 1865 | #define __INTRINSIC_DEFINED__BitScanReverse
|
---|
| 1866 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1867 |
|
---|
| 1868 | #if __INTRINSIC_PROLOG(_bittest)
|
---|
| 1869 | unsigned char _bittest(__LONG32 const *a, __LONG32 b);
|
---|
| 1870 | #if !__has_builtin(_bittest)
|
---|
| 1871 | __INTRINSICS_USEINLINE
|
---|
| 1872 | __buildbittest(_bittest, __LONG32, "l", "I")
|
---|
| 1873 | #endif
|
---|
| 1874 | #define __INTRINSIC_DEFINED__bittest
|
---|
| 1875 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1876 |
|
---|
| 1877 | #if __INTRINSIC_PROLOG(_bittestandset)
|
---|
| 1878 | unsigned char _bittestandset(__LONG32 *a, __LONG32 b);
|
---|
| 1879 | #if !__has_builtin(_bittestandset)
|
---|
| 1880 | __INTRINSICS_USEINLINE
|
---|
| 1881 | __buildbittestand(_bittestandset, __LONG32, "bts", "I", "l")
|
---|
| 1882 | #endif
|
---|
| 1883 | #define __INTRINSIC_DEFINED__bittestandset
|
---|
| 1884 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1885 |
|
---|
| 1886 | #if __INTRINSIC_PROLOG(_bittestandreset)
|
---|
| 1887 | unsigned char _bittestandreset(__LONG32 *a, __LONG32 b);
|
---|
| 1888 | #if !__has_builtin(_bittestandreset)
|
---|
| 1889 | __INTRINSICS_USEINLINE
|
---|
| 1890 | __buildbittestand(_bittestandreset, __LONG32, "btr", "I", "l")
|
---|
| 1891 | #endif
|
---|
| 1892 | #define __INTRINSIC_DEFINED__bittestandreset
|
---|
| 1893 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1894 |
|
---|
| 1895 | #if __INTRINSIC_PROLOG(_bittestandcomplement)
|
---|
| 1896 | unsigned char _bittestandcomplement(__LONG32 *a, __LONG32 b);
|
---|
| 1897 | #if !__has_builtin(_bittestandcomplement)
|
---|
| 1898 | __INTRINSICS_USEINLINE
|
---|
| 1899 | __buildbittestand(_bittestandcomplement, __LONG32, "btc", "I", "l")
|
---|
| 1900 | #endif
|
---|
| 1901 | #define __INTRINSIC_DEFINED__bittestandcomplement
|
---|
| 1902 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1903 |
|
---|
| 1904 | #if __INTRINSIC_PROLOG(__inbyte)
|
---|
| 1905 | unsigned char __inbyte(unsigned short Port);
|
---|
| 1906 | #if !__has_builtin(__inbyte)
|
---|
| 1907 | __INTRINSICS_USEINLINE
|
---|
| 1908 | __build_inport(__inbyte, unsigned char, "b")
|
---|
| 1909 | #endif
|
---|
| 1910 | #define __INTRINSIC_DEFINED___inbyte
|
---|
| 1911 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1912 |
|
---|
| 1913 | #if __INTRINSIC_PROLOG(__inword)
|
---|
| 1914 | unsigned short __inword(unsigned short Port);
|
---|
| 1915 | #if !__has_builtin(__inword)
|
---|
| 1916 | __INTRINSICS_USEINLINE
|
---|
| 1917 | __build_inport(__inword, unsigned short, "w")
|
---|
| 1918 | #endif
|
---|
| 1919 | #define __INTRINSIC_DEFINED___inword
|
---|
| 1920 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1921 |
|
---|
| 1922 | #if __INTRINSIC_PROLOG(__indword)
|
---|
| 1923 | unsigned __LONG32 __indword(unsigned short Port);
|
---|
| 1924 | #if !__has_builtin(__indword)
|
---|
| 1925 | __INTRINSICS_USEINLINE
|
---|
| 1926 | __build_inport(__indword, unsigned __LONG32, "l")
|
---|
| 1927 | #endif
|
---|
| 1928 | #define __INTRINSIC_DEFINED___indword
|
---|
| 1929 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1930 |
|
---|
| 1931 | #if __INTRINSIC_PROLOG(__outbyte)
|
---|
| 1932 | void __outbyte(unsigned short Port, unsigned char Data);
|
---|
| 1933 | #if !__has_builtin(__outbyte)
|
---|
| 1934 | __INTRINSICS_USEINLINE
|
---|
| 1935 | __build_outport(__outbyte, unsigned char, "b")
|
---|
| 1936 | #endif
|
---|
| 1937 | #define __INTRINSIC_DEFINED___outbyte
|
---|
| 1938 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1939 |
|
---|
| 1940 | #if __INTRINSIC_PROLOG(__outword)
|
---|
| 1941 | void __outword(unsigned short Port, unsigned short Data);
|
---|
| 1942 | #if !__has_builtin(__outword)
|
---|
| 1943 | __INTRINSICS_USEINLINE
|
---|
| 1944 | __build_outport(__outword, unsigned short, "w")
|
---|
| 1945 | #endif
|
---|
| 1946 | #define __INTRINSIC_DEFINED___outword
|
---|
| 1947 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1948 |
|
---|
| 1949 | #if __INTRINSIC_PROLOG(__outdword)
|
---|
| 1950 | void __outdword(unsigned short Port, unsigned __LONG32 Data);
|
---|
| 1951 | #if !__has_builtin(__outdword)
|
---|
| 1952 | __INTRINSICS_USEINLINE
|
---|
| 1953 | __build_outport(__outdword, unsigned __LONG32, "l")
|
---|
| 1954 | #endif
|
---|
| 1955 | #define __INTRINSIC_DEFINED___outdword
|
---|
| 1956 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1957 |
|
---|
| 1958 | #if __INTRINSIC_PROLOG(__inbytestring)
|
---|
| 1959 | void __inbytestring(unsigned short Port, unsigned char *Buffer, unsigned __LONG32 Count);
|
---|
| 1960 | #if !__has_builtin(__inbytestring)
|
---|
| 1961 | __INTRINSICS_USEINLINE
|
---|
| 1962 | __build_inportstring(__inbytestring, unsigned char, "b", "b")
|
---|
| 1963 | #endif
|
---|
| 1964 | #define __INTRINSIC_DEFINED___inbytestring
|
---|
| 1965 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1966 |
|
---|
| 1967 | #if __INTRINSIC_PROLOG(__inwordstring)
|
---|
| 1968 | void __inwordstring(unsigned short Port, unsigned short *Buffer, unsigned __LONG32 Count);
|
---|
| 1969 | #if !__has_builtin(__inwordstring)
|
---|
| 1970 | __INTRINSICS_USEINLINE
|
---|
| 1971 | __build_inportstring(__inwordstring, unsigned short, "w", "w")
|
---|
| 1972 | #endif
|
---|
| 1973 | #define __INTRINSIC_DEFINED___inwordstring
|
---|
| 1974 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1975 |
|
---|
| 1976 | #if __INTRINSIC_PROLOG(__indwordstring)
|
---|
| 1977 | void __indwordstring(unsigned short Port, unsigned __LONG32 *Buffer, unsigned __LONG32 Count);
|
---|
| 1978 | #if !__has_builtin(__indwordstring)
|
---|
| 1979 | __INTRINSICS_USEINLINE
|
---|
| 1980 | __build_inportstring(__indwordstring, unsigned __LONG32, "l", "d")
|
---|
| 1981 | #endif
|
---|
| 1982 | #define __INTRINSIC_DEFINED___indwordstring
|
---|
| 1983 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1984 |
|
---|
| 1985 | #if __INTRINSIC_PROLOG(__outbytestring)
|
---|
| 1986 | void __outbytestring(unsigned short Port, unsigned char *Buffer, unsigned __LONG32 Count);
|
---|
| 1987 | #if !__has_builtin(__outbytestring)
|
---|
| 1988 | __INTRINSICS_USEINLINE
|
---|
| 1989 | __build_outportstring(__outbytestring, unsigned char, "b", "b")
|
---|
| 1990 | #endif
|
---|
| 1991 | #define __INTRINSIC_DEFINED___outbytestring
|
---|
| 1992 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 1993 |
|
---|
| 1994 | #if __INTRINSIC_PROLOG(__outwordstring)
|
---|
| 1995 | void __outwordstring(unsigned short Port, unsigned short *Buffer, unsigned __LONG32 Count);
|
---|
| 1996 | #if !__has_builtin(__outwordstring)
|
---|
| 1997 | __INTRINSICS_USEINLINE
|
---|
| 1998 | __build_outportstring(__outwordstring, unsigned short, "w", "w")
|
---|
| 1999 | #endif
|
---|
| 2000 | #define __INTRINSIC_DEFINED___outwordstring
|
---|
| 2001 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2002 |
|
---|
| 2003 | #if __INTRINSIC_PROLOG(__outdwordstring)
|
---|
| 2004 | void __outdwordstring(unsigned short Port, unsigned __LONG32 *Buffer, unsigned __LONG32 Count);
|
---|
| 2005 | #if !__has_builtin(__outdwordstring)
|
---|
| 2006 | __INTRINSICS_USEINLINE
|
---|
| 2007 | __build_outportstring(__outdwordstring, unsigned __LONG32, "l", "d")
|
---|
| 2008 | #endif
|
---|
| 2009 | #define __INTRINSIC_DEFINED___outdwordstring
|
---|
| 2010 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2011 |
|
---|
| 2012 | #if __INTRINSIC_PROLOG(__cpuid)
|
---|
| 2013 | void __cpuid(int CPUInfo[4], int InfoType);
|
---|
| 2014 | #if !__has_builtin(__cpuid)
|
---|
| 2015 | __INTRINSICS_USEINLINE
|
---|
| 2016 | void __cpuid(int CPUInfo[4], int InfoType) {
|
---|
| 2017 | __asm__ __volatile__ (
|
---|
| 2018 | "cpuid"
|
---|
| 2019 | : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3])
|
---|
| 2020 | : "a" (InfoType));
|
---|
| 2021 | }
|
---|
| 2022 | #endif
|
---|
| 2023 | #define __INTRINSIC_DEFINED___cpuid
|
---|
| 2024 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2025 |
|
---|
| 2026 | #if (!defined(__GNUC__) || __GNUC__ < 11)
|
---|
| 2027 | #if __INTRINSIC_PROLOG(__cpuidex)
|
---|
| 2028 | void __cpuidex(int CPUInfo[4], int, int);
|
---|
| 2029 | #if !__has_builtin(__cpuidex)
|
---|
| 2030 | __INTRINSICS_USEINLINE
|
---|
| 2031 | void __cpuidex(int CPUInfo[4], int function_id, int subfunction_id) {
|
---|
| 2032 | __asm__ __volatile__ (
|
---|
| 2033 | "cpuid"
|
---|
| 2034 | : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3])
|
---|
| 2035 | : "a" (function_id), "c" (subfunction_id));
|
---|
| 2036 | }
|
---|
| 2037 | #endif
|
---|
| 2038 | #define __INTRINSIC_DEFINED___cpuidex
|
---|
| 2039 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2040 | #endif /* __GNUC__ < 11 */
|
---|
| 2041 |
|
---|
| 2042 | #if __INTRINSIC_PROLOG(__readmsr)
|
---|
| 2043 | __MINGW_EXTENSION unsigned __int64 __readmsr(unsigned __LONG32);
|
---|
| 2044 | #if !__has_builtin(__readmsr)
|
---|
| 2045 | __INTRINSICS_USEINLINE
|
---|
| 2046 | unsigned __int64 __readmsr(unsigned __LONG32 msr)
|
---|
| 2047 | {
|
---|
| 2048 | #if defined(__x86_64__) || defined(_AMD64_)
|
---|
| 2049 | unsigned __int64 val1, val2;
|
---|
| 2050 | #else
|
---|
| 2051 | unsigned __LONG32 val1, val2;
|
---|
| 2052 | #endif /* defined(__x86_64__) || defined(_AMD64_) */
|
---|
| 2053 |
|
---|
| 2054 | __asm__ __volatile__(
|
---|
| 2055 | "rdmsr"
|
---|
| 2056 | : "=a" (val1), "=d" (val2)
|
---|
| 2057 | : "c" (msr));
|
---|
| 2058 |
|
---|
| 2059 | return ((unsigned __int64) val1) | (((unsigned __int64)val2) << 32);
|
---|
| 2060 | }
|
---|
| 2061 | #endif
|
---|
| 2062 | #define __INTRINSIC_DEFINED___readmsr
|
---|
| 2063 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2064 |
|
---|
| 2065 | #if __INTRINSIC_PROLOG(__writemsr)
|
---|
| 2066 | __MINGW_EXTENSION void __writemsr(unsigned __LONG32, unsigned __int64);
|
---|
| 2067 | #if !__has_builtin(__writemsr)
|
---|
| 2068 | __INTRINSICS_USEINLINE
|
---|
| 2069 | void __writemsr(unsigned __LONG32 msr, unsigned __int64 Value)
|
---|
| 2070 | {
|
---|
| 2071 | unsigned __LONG32 val1 = Value, val2 = Value >> 32;
|
---|
| 2072 | __asm__ __volatile__ (
|
---|
| 2073 | "wrmsr"
|
---|
| 2074 | :
|
---|
| 2075 | : "c" (msr), "a" (val1), "d" (val2));
|
---|
| 2076 | }
|
---|
| 2077 | #endif
|
---|
| 2078 | #define __INTRINSIC_DEFINED___writemsr
|
---|
| 2079 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2080 |
|
---|
| 2081 | #if __INTRINSIC_PROLOG(__movsb)
|
---|
| 2082 | void __movsb(unsigned char *Destination, unsigned char const *Source, size_t Count);
|
---|
| 2083 | #if !__has_builtin(__movsb)
|
---|
| 2084 | __INTRINSICS_USEINLINE
|
---|
| 2085 | __buildmov(__movsb, unsigned char, "b")
|
---|
| 2086 | #endif
|
---|
| 2087 | #define __INTRINSIC_DEFINED___movsb
|
---|
| 2088 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2089 |
|
---|
| 2090 | #if __INTRINSIC_PROLOG(__movsw)
|
---|
| 2091 | void __movsw(unsigned short *Dest, unsigned short const *Source, size_t Count);
|
---|
| 2092 | #if !__has_builtin(__movsw)
|
---|
| 2093 | __INTRINSICS_USEINLINE
|
---|
| 2094 | __buildmov(__movsw, unsigned short, "w")
|
---|
| 2095 | #endif
|
---|
| 2096 | #define __INTRINSIC_DEFINED___movsw
|
---|
| 2097 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2098 |
|
---|
| 2099 | #if __INTRINSIC_PROLOG(__movsd)
|
---|
| 2100 | void __movsd(unsigned __LONG32 *Dest, unsigned __LONG32 const *Source, size_t Count);
|
---|
| 2101 | #if !__has_builtin(__movsd)
|
---|
| 2102 | __INTRINSICS_USEINLINE
|
---|
| 2103 | __buildmov(__movsd, unsigned __LONG32, "d")
|
---|
| 2104 | #endif
|
---|
| 2105 | #define __INTRINSIC_DEFINED___movsd
|
---|
| 2106 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2107 |
|
---|
| 2108 | /* GCC 8 has already defined _xgetbv, Clang 9 has _xgetbv defined as a macro
|
---|
| 2109 | * redirecting to the __builtin_ia32_xgetbv builtin. */
|
---|
| 2110 | #if (!defined(__GNUC__) || __GNUC__ < 8) && !defined(_xgetbv)
|
---|
| 2111 | /* NOTE: This should be in immintrin.h */
|
---|
| 2112 | #if __INTRINSIC_PROLOG(_xgetbv)
|
---|
| 2113 | unsigned __int64 _xgetbv(unsigned int);
|
---|
| 2114 | #if !__has_builtin(_xgetbv)
|
---|
| 2115 | __INTRINSICS_USEINLINE
|
---|
| 2116 | unsigned __int64 _xgetbv(unsigned int index)
|
---|
| 2117 | {
|
---|
| 2118 | #if defined(__x86_64__) || defined(_AMD64_)
|
---|
| 2119 | unsigned __int64 val1, val2;
|
---|
| 2120 | #else
|
---|
| 2121 | unsigned __LONG32 val1, val2;
|
---|
| 2122 | #endif /* defined(__x86_64__) || defined(_AMD64_) */
|
---|
| 2123 |
|
---|
| 2124 | __asm__ __volatile__(
|
---|
| 2125 | "xgetbv"
|
---|
| 2126 | : "=a" (val1), "=d" (val2)
|
---|
| 2127 | : "c" (index));
|
---|
| 2128 |
|
---|
| 2129 | return (((unsigned __int64)val2) << 32) | val1;
|
---|
| 2130 | }
|
---|
| 2131 | #endif
|
---|
| 2132 | #define __INTRINSIC_DEFINED__xgetbv
|
---|
| 2133 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2134 | #endif /* __GNUC__ < 8 */
|
---|
| 2135 |
|
---|
| 2136 | #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) */
|
---|
| 2137 |
|
---|
| 2138 | /* ***************************************************** */
|
---|
| 2139 |
|
---|
| 2140 | #if defined(__i386__) || defined(_X86_)
|
---|
| 2141 |
|
---|
| 2142 | #if __INTRINSIC_PROLOG(__readfsbyte)
|
---|
| 2143 | unsigned char __readfsbyte(unsigned __LONG32 Offset);
|
---|
| 2144 | #if !__has_builtin(__readfsbyte)
|
---|
| 2145 | __INTRINSICS_USEINLINE
|
---|
| 2146 | __buildreadseg(__readfsbyte, unsigned char, "fs", "b")
|
---|
| 2147 | #endif
|
---|
| 2148 | #define __INTRINSIC_DEFINED___readfsbyte
|
---|
| 2149 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2150 |
|
---|
| 2151 | #if __INTRINSIC_PROLOG(__readfsword)
|
---|
| 2152 | unsigned short __readfsword(unsigned __LONG32 Offset);
|
---|
| 2153 | #if !__has_builtin(__readfsword)
|
---|
| 2154 | __INTRINSICS_USEINLINE
|
---|
| 2155 | __buildreadseg(__readfsword, unsigned short, "fs", "w")
|
---|
| 2156 | #endif
|
---|
| 2157 | #define __INTRINSIC_DEFINED___readfsword
|
---|
| 2158 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2159 |
|
---|
| 2160 | #if __INTRINSIC_PROLOG(__readfsdword)
|
---|
| 2161 | unsigned __LONG32 __readfsdword(unsigned __LONG32 Offset);
|
---|
| 2162 | #if !__has_builtin(__readfsdword)
|
---|
| 2163 | __INTRINSICS_USEINLINE
|
---|
| 2164 | __buildreadseg(__readfsdword, unsigned __LONG32, "fs", "l")
|
---|
| 2165 | #endif
|
---|
| 2166 | #define __INTRINSIC_DEFINED___readfsdword
|
---|
| 2167 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2168 |
|
---|
| 2169 | #if __INTRINSIC_PROLOG(__writefsbyte)
|
---|
| 2170 | void __writefsbyte(unsigned __LONG32 Offset,unsigned char Data);
|
---|
| 2171 | #if !__has_builtin(__writefsbyte)
|
---|
| 2172 | __INTRINSICS_USEINLINE
|
---|
| 2173 | __buildwriteseg(__writefsbyte, unsigned char, "fs", "b")
|
---|
| 2174 | #endif
|
---|
| 2175 | #define __INTRINSIC_DEFINED___writefsbyte
|
---|
| 2176 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2177 |
|
---|
| 2178 | #if __INTRINSIC_PROLOG(__writefsword)
|
---|
| 2179 | void __writefsword(unsigned __LONG32 Offset,unsigned short Data);
|
---|
| 2180 | #if !__has_builtin(__writefsword)
|
---|
| 2181 | __INTRINSICS_USEINLINE
|
---|
| 2182 | __buildwriteseg(__writefsword, unsigned short, "fs", "w")
|
---|
| 2183 | #endif
|
---|
| 2184 | #define __INTRINSIC_DEFINED___writefsword
|
---|
| 2185 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2186 |
|
---|
| 2187 | #if __INTRINSIC_PROLOG(__writefsdword)
|
---|
| 2188 | void __writefsdword(unsigned __LONG32 Offset,unsigned __LONG32 Data);
|
---|
| 2189 | #if !__has_builtin(__writefsdword)
|
---|
| 2190 | __INTRINSICS_USEINLINE
|
---|
| 2191 | __buildwriteseg(__writefsdword, unsigned __LONG32, "fs", "l")
|
---|
| 2192 | #endif
|
---|
| 2193 | #define __INTRINSIC_DEFINED___writefsdword
|
---|
| 2194 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2195 |
|
---|
| 2196 | #if __INTRINSIC_PROLOG(__readcr0)
|
---|
| 2197 | unsigned __LONG32 __readcr0(void);
|
---|
| 2198 | #if !__has_builtin(__readcr0)
|
---|
| 2199 | __INTRINSICS_USEINLINE
|
---|
| 2200 | __build_readcr(__readcr0, unsigned __LONG32, "0")
|
---|
| 2201 | #endif
|
---|
| 2202 | #define __INTRINSIC_DEFINED___readcr0
|
---|
| 2203 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2204 |
|
---|
| 2205 | #if __INTRINSIC_PROLOG(__readcr2)
|
---|
| 2206 | unsigned __LONG32 __readcr2(void);
|
---|
| 2207 | #if !__has_builtin(__readcr2)
|
---|
| 2208 | __INTRINSICS_USEINLINE
|
---|
| 2209 | __build_readcr(__readcr2, unsigned __LONG32, "2")
|
---|
| 2210 | #endif
|
---|
| 2211 | #define __INTRINSIC_DEFINED___readcr2
|
---|
| 2212 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2213 |
|
---|
| 2214 | #if __INTRINSIC_PROLOG(__readcr3)
|
---|
| 2215 | unsigned __LONG32 __readcr3(void);
|
---|
| 2216 | #if !__has_builtin(__readcr3)
|
---|
| 2217 | __INTRINSICS_USEINLINE
|
---|
| 2218 | __build_readcr(__readcr3, unsigned __LONG32, "3")
|
---|
| 2219 | #endif
|
---|
| 2220 | #define __INTRINSIC_DEFINED___readcr3
|
---|
| 2221 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2222 |
|
---|
| 2223 | #if __INTRINSIC_PROLOG(__readcr4)
|
---|
| 2224 | unsigned __LONG32 __readcr4(void);
|
---|
| 2225 | #if !__has_builtin(__readcr4)
|
---|
| 2226 | __INTRINSICS_USEINLINE
|
---|
| 2227 | __build_readcr(__readcr4, unsigned __LONG32, "4")
|
---|
| 2228 | #endif
|
---|
| 2229 | #define __INTRINSIC_DEFINED___readcr4
|
---|
| 2230 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2231 |
|
---|
| 2232 | #if __INTRINSIC_PROLOG(__readcr8)
|
---|
| 2233 | unsigned __LONG32 __readcr8(void);
|
---|
| 2234 | #if !__has_builtin(__readcr8)
|
---|
| 2235 | __INTRINSICS_USEINLINE
|
---|
| 2236 | __build_readcr(__readcr8, unsigned __LONG32, "8")
|
---|
| 2237 | #endif
|
---|
| 2238 | #define __INTRINSIC_DEFINED___readcr8
|
---|
| 2239 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2240 |
|
---|
| 2241 | #if __INTRINSIC_PROLOG(__writecr0)
|
---|
| 2242 | void __writecr0(unsigned __LONG32);
|
---|
| 2243 | #if !__has_builtin(__writecr0)
|
---|
| 2244 | __INTRINSICS_USEINLINE
|
---|
| 2245 | __build_writecr(__writecr0, unsigned __LONG32, "0")
|
---|
| 2246 | #endif
|
---|
| 2247 | #define __INTRINSIC_DEFINED___writecr0
|
---|
| 2248 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2249 |
|
---|
| 2250 | #if __INTRINSIC_PROLOG(__writecr3)
|
---|
| 2251 | void __writecr3(unsigned __LONG32);
|
---|
| 2252 | #if !__has_builtin(__writecr3)
|
---|
| 2253 | __INTRINSICS_USEINLINE
|
---|
| 2254 | __build_writecr(__writecr3, unsigned __LONG32, "3")
|
---|
| 2255 | #endif
|
---|
| 2256 | #define __INTRINSIC_DEFINED___writecr3
|
---|
| 2257 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2258 |
|
---|
| 2259 | #if __INTRINSIC_PROLOG(__writecr4)
|
---|
| 2260 | void __writecr4(unsigned __LONG32);
|
---|
| 2261 | #if !__has_builtin(__writecr4)
|
---|
| 2262 | __INTRINSICS_USEINLINE
|
---|
| 2263 | __build_writecr(__writecr4, unsigned __LONG32, "4")
|
---|
| 2264 | #endif
|
---|
| 2265 | #define __INTRINSIC_DEFINED___writecr4
|
---|
| 2266 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2267 |
|
---|
| 2268 | #if __INTRINSIC_PROLOG(__writecr8)
|
---|
| 2269 | void __writecr8(unsigned __LONG32);
|
---|
| 2270 | #if !__has_builtin(__writecr8)
|
---|
| 2271 | __INTRINSICS_USEINLINE
|
---|
| 2272 | __build_writecr(__writecr8, unsigned __LONG32, "8")
|
---|
| 2273 | #endif
|
---|
| 2274 | #define __INTRINSIC_DEFINED___writecr8
|
---|
| 2275 | #endif /* __INTRINSIC_PROLOG */
|
---|
| 2276 |
|
---|
| 2277 | #endif /* defined(__i386__) || defined(_X86_) */
|
---|
| 2278 |
|
---|
| 2279 | #ifdef __cplusplus
|
---|
| 2280 | }
|
---|
| 2281 | #endif
|
---|
| 2282 |
|
---|
| 2283 | #undef __INTRINSIC_ONLYSPECIAL
|
---|
| 2284 | #undef __INTRINSIC_PROLOG
|
---|
| 2285 | #undef __INTRINSIC_EPILOG
|
---|
| 2286 | #undef __INTRINSICS_USEINLINE
|
---|
| 2287 | #undef __FLAGCONSTRAINT
|
---|
| 2288 | #undef __FLAGSET
|
---|
| 2289 | #undef __FLAGCLOBBER1
|
---|
| 2290 | #undef __FLAGCLOBBER2
|
---|
| 2291 |
|
---|
| 2292 | #pragma pop_macro("__has_builtin")
|
---|
| 2293 |
|
---|
| 2294 | #endif /* __MINGW_INTRIN_INLINE */
|
---|