1351280Sdim/*===------------------ enqcmdintrin.h - enqcmd intrinsics -----------------===
2351280Sdim *
3351280Sdim * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4351280Sdim * See https://llvm.org/LICENSE.txt for license information.
5351280Sdim * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6351280Sdim *
7351280Sdim *===-----------------------------------------------------------------------===
8351280Sdim */
9351280Sdim
10351280Sdim#ifndef __IMMINTRIN_H
11351280Sdim#error "Never use <enqcmdintrin.h> directly; include <immintrin.h> instead."
12351280Sdim#endif
13351280Sdim
14351280Sdim#ifndef __ENQCMDINTRIN_H
15351280Sdim#define __ENQCMDINTRIN_H
16351280Sdim
17351280Sdim/* Define the default attributes for the functions in this file */
18351280Sdim#define _DEFAULT_FN_ATTRS \
19351280Sdim  __attribute__((__always_inline__, __nodebug__, __target__("enqcmd")))
20351280Sdim
21351280Sdim/// Reads 64-byte command pointed by \a __src, formats 64-byte enqueue store
22351280Sdim///    data, and performs 64-byte enqueue store to memory pointed by \a __dst.
23351280Sdim///    This intrinsics may only be used in User mode.
24351280Sdim///
25351280Sdim/// \headerfile <x86intrin.h>
26351280Sdim///
27351280Sdim/// This intrinsics corresponds to the <c> ENQCMD </c> instruction.
28351280Sdim///
29351280Sdim/// \param __dst
30351280Sdim///    Pointer to the destination of the enqueue store.
31351280Sdim/// \param __src
32351280Sdim///    Pointer to 64-byte command data.
33351280Sdim/// \returns If the command data is successfully written to \a __dst then 0 is
34351280Sdim///    returned. Otherwise 1 is returned.
35351280Sdimstatic __inline__ int _DEFAULT_FN_ATTRS
36351280Sdim_enqcmd (void *__dst, const void *__src)
37351280Sdim{
38351280Sdim  return __builtin_ia32_enqcmd(__dst, __src);
39351280Sdim}
40351280Sdim
41351280Sdim/// Reads 64-byte command pointed by \a __src, formats 64-byte enqueue store
42351280Sdim///    data, and performs 64-byte enqueue store to memory pointed by \a __dst
43351280Sdim///    This intrinsic may only be used in Privileged mode.
44351280Sdim///
45351280Sdim/// \headerfile <x86intrin.h>
46351280Sdim///
47351280Sdim/// This intrinsics corresponds to the <c> ENQCMDS </c> instruction.
48351280Sdim///
49351280Sdim/// \param __dst
50351280Sdim///    Pointer to the destination of the enqueue store.
51351280Sdim/// \param __src
52351280Sdim///    Pointer to 64-byte command data.
53351280Sdim/// \returns If the command data is successfully written to \a __dst then 0 is
54351280Sdim///    returned. Otherwise 1 is returned.
55351280Sdimstatic __inline__ int _DEFAULT_FN_ATTRS
56351280Sdim_enqcmds (void *__dst, const void *__src)
57351280Sdim{
58351280Sdim  return __builtin_ia32_enqcmds(__dst, __src);
59351280Sdim}
60351280Sdim
61351280Sdim#undef _DEFAULT_FN_ATTRS
62351280Sdim
63351280Sdim#endif /* __ENQCMDINTRIN_H */
64