movdirintrin.h revision 353358
1178825Sdfr/*===------------------------- movdirintrin.h ------------------------------===
2233294Sstas *
3233294Sstas * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4233294Sstas * See https://llvm.org/LICENSE.txt for license information.
5178825Sdfr * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6233294Sstas *
7233294Sstas *===-----------------------------------------------------------------------===
8233294Sstas */
9178825Sdfr#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
10233294Sstas#error "Never use <movdirintrin.h> directly; include <x86intrin.h> instead."
11233294Sstas#endif
12178825Sdfr
13233294Sstas#ifndef _MOVDIRINTRIN_H
14233294Sstas#define _MOVDIRINTRIN_H
15233294Sstas
16178825Sdfr/* Move doubleword as direct store */
17233294Sstasstatic __inline__ void
18233294Sstas__attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
19233294Sstas_directstoreu_u32 (void *__dst, unsigned int  __value)
20178825Sdfr{
21233294Sstas  __builtin_ia32_directstore_u32((unsigned int *)__dst, (unsigned int)__value);
22233294Sstas}
23233294Sstas
24233294Sstas#ifdef __x86_64__
25233294Sstas
26233294Sstas/* Move quadword as direct store */
27233294Sstasstatic __inline__ void
28233294Sstas__attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
29233294Sstas_directstoreu_u64 (void *__dst, unsigned long __value)
30233294Sstas{
31233294Sstas  __builtin_ia32_directstore_u64((unsigned long *)__dst, __value);
32178825Sdfr}
33178825Sdfr
34178825Sdfr#endif /* __x86_64__ */
35178825Sdfr
36178825Sdfr/*
37178825Sdfr * movdir64b - Move 64 bytes as direct store.
38178825Sdfr * The destination must be 64 byte aligned, and the store is atomic.
39178825Sdfr * The source address has no alignment requirement, and the load from
40178825Sdfr * the source address is not atomic.
41178825Sdfr */
42178825Sdfrstatic __inline__ void
43178825Sdfr__attribute__((__always_inline__, __nodebug__,  __target__("movdir64b")))
44178825Sdfr_movdir64b (void *__dst __attribute__((align_value(64))), const void *__src)
45178825Sdfr{
46178825Sdfr  __builtin_ia32_movdir64b(__dst, __src);
47178825Sdfr}
48178825Sdfr
49178825Sdfr#endif /* _MOVDIRINTRIN_H */
50178825Sdfr