xref: /aosp_15_r20/prebuilts/clang-tools/linux-x86/clang-headers/movdirintrin.h (revision bed243d3d9cd544cfb038bfa7be843dedc6e6bf7)
1*bed243d3SAndroid Build Coastguard Worker /*===------------------------- movdirintrin.h ------------------------------===
2*bed243d3SAndroid Build Coastguard Worker  *
3*bed243d3SAndroid Build Coastguard Worker  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*bed243d3SAndroid Build Coastguard Worker  * See https://llvm.org/LICENSE.txt for license information.
5*bed243d3SAndroid Build Coastguard Worker  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*bed243d3SAndroid Build Coastguard Worker  *
7*bed243d3SAndroid Build Coastguard Worker  *===-----------------------------------------------------------------------===
8*bed243d3SAndroid Build Coastguard Worker  */
9*bed243d3SAndroid Build Coastguard Worker #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
10*bed243d3SAndroid Build Coastguard Worker #error "Never use <movdirintrin.h> directly; include <x86intrin.h> instead."
11*bed243d3SAndroid Build Coastguard Worker #endif
12*bed243d3SAndroid Build Coastguard Worker 
13*bed243d3SAndroid Build Coastguard Worker #ifndef _MOVDIRINTRIN_H
14*bed243d3SAndroid Build Coastguard Worker #define _MOVDIRINTRIN_H
15*bed243d3SAndroid Build Coastguard Worker 
16*bed243d3SAndroid Build Coastguard Worker /* Move doubleword as direct store */
17*bed243d3SAndroid Build Coastguard Worker static __inline__ void
18*bed243d3SAndroid Build Coastguard Worker __attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
_directstoreu_u32(void * __dst,unsigned int __value)19*bed243d3SAndroid Build Coastguard Worker _directstoreu_u32 (void *__dst, unsigned int  __value)
20*bed243d3SAndroid Build Coastguard Worker {
21*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_directstore_u32((unsigned int *)__dst, (unsigned int)__value);
22*bed243d3SAndroid Build Coastguard Worker }
23*bed243d3SAndroid Build Coastguard Worker 
24*bed243d3SAndroid Build Coastguard Worker #ifdef __x86_64__
25*bed243d3SAndroid Build Coastguard Worker 
26*bed243d3SAndroid Build Coastguard Worker /* Move quadword as direct store */
27*bed243d3SAndroid Build Coastguard Worker static __inline__ void
28*bed243d3SAndroid Build Coastguard Worker __attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
_directstoreu_u64(void * __dst,unsigned long __value)29*bed243d3SAndroid Build Coastguard Worker _directstoreu_u64 (void *__dst, unsigned long __value)
30*bed243d3SAndroid Build Coastguard Worker {
31*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_directstore_u64((unsigned long *)__dst, __value);
32*bed243d3SAndroid Build Coastguard Worker }
33*bed243d3SAndroid Build Coastguard Worker 
34*bed243d3SAndroid Build Coastguard Worker #endif /* __x86_64__ */
35*bed243d3SAndroid Build Coastguard Worker 
36*bed243d3SAndroid Build Coastguard Worker /*
37*bed243d3SAndroid Build Coastguard Worker  * movdir64b - Move 64 bytes as direct store.
38*bed243d3SAndroid Build Coastguard Worker  * The destination must be 64 byte aligned, and the store is atomic.
39*bed243d3SAndroid Build Coastguard Worker  * The source address has no alignment requirement, and the load from
40*bed243d3SAndroid Build Coastguard Worker  * the source address is not atomic.
41*bed243d3SAndroid Build Coastguard Worker  */
42*bed243d3SAndroid Build Coastguard Worker static __inline__ void
43*bed243d3SAndroid Build Coastguard Worker __attribute__((__always_inline__, __nodebug__,  __target__("movdir64b")))
_movdir64b(void * __dst,const void * __src)44*bed243d3SAndroid Build Coastguard Worker _movdir64b (void *__dst __attribute__((align_value(64))), const void *__src)
45*bed243d3SAndroid Build Coastguard Worker {
46*bed243d3SAndroid Build Coastguard Worker   __builtin_ia32_movdir64b(__dst, __src);
47*bed243d3SAndroid Build Coastguard Worker }
48*bed243d3SAndroid Build Coastguard Worker 
49*bed243d3SAndroid Build Coastguard Worker #endif /* _MOVDIRINTRIN_H */
50