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