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