xref: /freebsd/contrib/llvm-project/clang/lib/Headers/pconfigintrin.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1 /*===---- pconfigintrin.h - X86 platform configuration ---------------------===
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 #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
11 #error "Never use <pconfigintrin.h> directly; include <x86intrin.h> instead."
12 #endif
13 
14 #ifndef __PCONFIGINTRIN_H
15 #define __PCONFIGINTRIN_H
16 
17 #define __PCONFIG_KEY_PROGRAM 0x00000001
18 
19 #if __has_extension(gnu_asm)
20 
21 /* Define the default attributes for the functions in this file. */
22 #define __DEFAULT_FN_ATTRS \
23   __attribute__((__always_inline__, __nodebug__,  __target__("pconfig")))
24 
25 static __inline unsigned int __DEFAULT_FN_ATTRS
_pconfig_u32(unsigned int __leaf,__SIZE_TYPE__ __d[])26 _pconfig_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
27 {
28   unsigned int __result;
29   __asm__ ("pconfig"
30            : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
31            : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
32            : "cc");
33   return __result;
34 }
35 
36 #undef __DEFAULT_FN_ATTRS
37 
38 #endif /* __has_extension(gnu_asm) */
39 
40 #endif
41