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