xref: /freebsd/contrib/llvm-project/clang/lib/Headers/enqcmdintrin.h (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1 /*===------------------ enqcmdintrin.h - enqcmd 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 __IMMINTRIN_H
11 #error "Never use <enqcmdintrin.h> directly; include <immintrin.h> instead."
12 #endif
13 
14 #ifndef __ENQCMDINTRIN_H
15 #define __ENQCMDINTRIN_H
16 
17 /* Define the default attributes for the functions in this file */
18 #define _DEFAULT_FN_ATTRS \
19   __attribute__((__always_inline__, __nodebug__, __target__("enqcmd")))
20 
21 /// Reads 64-byte command pointed by \a __src, formats 64-byte enqueue store
22 ///    data, and performs 64-byte enqueue store to memory pointed by \a __dst.
23 ///    This intrinsics may only be used in User mode.
24 ///
25 /// \headerfile <x86intrin.h>
26 ///
27 /// This intrinsics corresponds to the <c> ENQCMD </c> instruction.
28 ///
29 /// \param __dst
30 ///    Pointer to the destination of the enqueue store.
31 /// \param __src
32 ///    Pointer to 64-byte command data.
33 /// \returns If the command data is successfully written to \a __dst then 0 is
34 ///    returned. Otherwise 1 is returned.
35 static __inline__ int _DEFAULT_FN_ATTRS
36 _enqcmd (void *__dst, const void *__src)
37 {
38   return __builtin_ia32_enqcmd(__dst, __src);
39 }
40 
41 /// Reads 64-byte command pointed by \a __src, formats 64-byte enqueue store
42 ///    data, and performs 64-byte enqueue store to memory pointed by \a __dst
43 ///    This intrinsic may only be used in Privileged mode.
44 ///
45 /// \headerfile <x86intrin.h>
46 ///
47 /// This intrinsics corresponds to the <c> ENQCMDS </c> instruction.
48 ///
49 /// \param __dst
50 ///    Pointer to the destination of the enqueue store.
51 /// \param __src
52 ///    Pointer to 64-byte command data.
53 /// \returns If the command data is successfully written to \a __dst then 0 is
54 ///    returned. Otherwise 1 is returned.
55 static __inline__ int _DEFAULT_FN_ATTRS
56 _enqcmds (void *__dst, const void *__src)
57 {
58   return __builtin_ia32_enqcmds(__dst, __src);
59 }
60 
61 #undef _DEFAULT_FN_ATTRS
62 
63 #endif /* __ENQCMDINTRIN_H */
64