xref: /freebsd/contrib/llvm-project/clang/lib/Headers/movdirintrin.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric /*===------------------------- movdirintrin.h ------------------------------===
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 #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
10*0b57cec5SDimitry Andric #error "Never use <movdirintrin.h> directly; include <x86intrin.h> instead."
11*0b57cec5SDimitry Andric #endif
12*0b57cec5SDimitry Andric 
13*0b57cec5SDimitry Andric #ifndef _MOVDIRINTRIN_H
14*0b57cec5SDimitry Andric #define _MOVDIRINTRIN_H
15*0b57cec5SDimitry Andric 
16*0b57cec5SDimitry Andric /* Move doubleword as direct store */
17*0b57cec5SDimitry Andric static __inline__ void
18*0b57cec5SDimitry Andric __attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
_directstoreu_u32(void * __dst,unsigned int __value)19*0b57cec5SDimitry Andric _directstoreu_u32 (void *__dst, unsigned int  __value)
20*0b57cec5SDimitry Andric {
21*0b57cec5SDimitry Andric   __builtin_ia32_directstore_u32((unsigned int *)__dst, (unsigned int)__value);
22*0b57cec5SDimitry Andric }
23*0b57cec5SDimitry Andric 
24*0b57cec5SDimitry Andric #ifdef __x86_64__
25*0b57cec5SDimitry Andric 
26*0b57cec5SDimitry Andric /* Move quadword as direct store */
27*0b57cec5SDimitry Andric static __inline__ void
28*0b57cec5SDimitry Andric __attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
_directstoreu_u64(void * __dst,unsigned long __value)29*0b57cec5SDimitry Andric _directstoreu_u64 (void *__dst, unsigned long __value)
30*0b57cec5SDimitry Andric {
31*0b57cec5SDimitry Andric   __builtin_ia32_directstore_u64((unsigned long *)__dst, __value);
32*0b57cec5SDimitry Andric }
33*0b57cec5SDimitry Andric 
34*0b57cec5SDimitry Andric #endif /* __x86_64__ */
35*0b57cec5SDimitry Andric 
36*0b57cec5SDimitry Andric /*
37*0b57cec5SDimitry Andric  * movdir64b - Move 64 bytes as direct store.
38*0b57cec5SDimitry Andric  * The destination must be 64 byte aligned, and the store is atomic.
39*0b57cec5SDimitry Andric  * The source address has no alignment requirement, and the load from
40*0b57cec5SDimitry Andric  * the source address is not atomic.
41*0b57cec5SDimitry Andric  */
42*0b57cec5SDimitry Andric static __inline__ void
43*0b57cec5SDimitry Andric __attribute__((__always_inline__, __nodebug__,  __target__("movdir64b")))
_movdir64b(void * __dst,const void * __src)44*0b57cec5SDimitry Andric _movdir64b (void *__dst __attribute__((align_value(64))), const void *__src)
45*0b57cec5SDimitry Andric {
46*0b57cec5SDimitry Andric   __builtin_ia32_movdir64b(__dst, __src);
47*0b57cec5SDimitry Andric }
48*0b57cec5SDimitry Andric 
49*0b57cec5SDimitry Andric #endif /* _MOVDIRINTRIN_H */
50