1a9ac8606Spatrick /*===--------------- x86gprintrin.h - X86 GPR intrinsics ------------------=== 2a9ac8606Spatrick * 3a9ac8606Spatrick * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4a9ac8606Spatrick * See https://llvm.org/LICENSE.txt for license information. 5a9ac8606Spatrick * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6a9ac8606Spatrick * 7a9ac8606Spatrick *===-----------------------------------------------------------------------=== 8a9ac8606Spatrick */ 9a9ac8606Spatrick 10a9ac8606Spatrick #ifndef __X86GPRINTRIN_H 11a9ac8606Spatrick #define __X86GPRINTRIN_H 12a9ac8606Spatrick 13a9ac8606Spatrick #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ 14a9ac8606Spatrick defined(__HRESET__) 15a9ac8606Spatrick #include <hresetintrin.h> 16a9ac8606Spatrick #endif 17a9ac8606Spatrick 18a9ac8606Spatrick #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ 19a9ac8606Spatrick defined(__UINTR__) 20a9ac8606Spatrick #include <uintrintrin.h> 21a9ac8606Spatrick #endif 22a9ac8606Spatrick 23*12c85518Srobert #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ 24*12c85518Srobert defined(__CRC32__) 25*12c85518Srobert #include <crc32intrin.h> 26*12c85518Srobert #endif 27*12c85518Srobert 28*12c85518Srobert #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ 29*12c85518Srobert defined(__PRFCHI__) 30*12c85518Srobert #include <prfchiintrin.h> 31*12c85518Srobert #endif 32*12c85518Srobert 33*12c85518Srobert #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ 34*12c85518Srobert defined(__RAOINT__) 35*12c85518Srobert #include <raointintrin.h> 36*12c85518Srobert #endif 37*12c85518Srobert 38*12c85518Srobert #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ 39*12c85518Srobert defined(__CMPCCXADD__) 40*12c85518Srobert #include <cmpccxaddintrin.h> 41*12c85518Srobert #endif 42*12c85518Srobert 43*12c85518Srobert #if defined(__i386__) 44*12c85518Srobert #define __SAVE_GPRBX "mov {%%ebx, %%eax |eax, ebx};" 45*12c85518Srobert #define __RESTORE_GPRBX "mov {%%eax, %%ebx |ebx, eax};" 46*12c85518Srobert #define __TMPGPR "eax" 47*12c85518Srobert #else 48*12c85518Srobert // When in 64-bit target, the 32-bit operands generate a 32-bit result, 49*12c85518Srobert // zero-extended to a 64-bit result in the destination general-purpose, 50*12c85518Srobert // It means "mov x %ebx" will clobber the higher 32 bits of rbx, so we 51*12c85518Srobert // should preserve the 64-bit register rbx. 52*12c85518Srobert #define __SAVE_GPRBX "mov {%%rbx, %%rax |rax, rbx};" 53*12c85518Srobert #define __RESTORE_GPRBX "mov {%%rax, %%rbx |rbx, rax};" 54*12c85518Srobert #define __TMPGPR "rax" 55*12c85518Srobert #endif 56*12c85518Srobert 57*12c85518Srobert #define __SSC_MARK(__Tag) \ 58*12c85518Srobert __asm__ __volatile__( __SAVE_GPRBX \ 59*12c85518Srobert "mov {%0, %%ebx|ebx, %0}; " \ 60*12c85518Srobert ".byte 0x64, 0x67, 0x90; " \ 61*12c85518Srobert __RESTORE_GPRBX \ 62*12c85518Srobert ::"i"(__Tag) \ 63*12c85518Srobert : __TMPGPR ); 64*12c85518Srobert 65a9ac8606Spatrick #endif /* __X86GPRINTRIN_H */ 66