1 /*===----------------------- raointintrin.h - RAOINT ------------------------===
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===-----------------------------------------------------------------------===
10 #ifndef __X86GPRINTRIN_H
11 #error "Never use <raointintrin.h> directly; include <x86gprintrin.h> instead."
12 #endif // __X86GPRINTRIN_H
14 #ifndef __RAOINTINTRIN_H
15 #define __RAOINTINTRIN_H
17 #define __DEFAULT_FN_ATTRS \
18 __attribute__((__always_inline__, __nodebug__, __target__("raoint")))
20 /// Atomically add a 32-bit value at memory operand \a __A and a 32-bit \a __B,
21 /// and store the result to the same memory location.
23 /// This intrinsic should be used for contention or weak ordering. It may
24 /// result in bad performance for hot data used by single thread only.
26 /// \headerfile <x86intrin.h>
28 /// This intrinsic corresponds to the \c AADD instruction.
31 /// A pointer to a 32-bit memory location.
33 /// A 32-bit integer value.
36 /// MEM[__A+31:__A] := MEM[__A+31:__A] + __B[31:0]
38 static __inline__
void __DEFAULT_FN_ATTRS
_aadd_i32(int *__A
, int __B
) {
39 __builtin_ia32_aadd32((int *)__A
, __B
);
42 /// Atomically and a 32-bit value at memory operand \a __A and a 32-bit \a __B,
43 /// and store the result to the same memory location.
45 /// This intrinsic should be used for contention or weak ordering. It may
46 /// result in bad performance for hot data used by single thread only.
48 /// \headerfile <x86intrin.h>
50 /// This intrinsic corresponds to the \c AAND instruction.
53 /// A pointer to a 32-bit memory location.
55 /// A 32-bit integer value.
58 /// MEM[__A+31:__A] := MEM[__A+31:__A] AND __B[31:0]
60 static __inline__
void __DEFAULT_FN_ATTRS
_aand_i32(int *__A
, int __B
) {
61 __builtin_ia32_aand32((int *)__A
, __B
);
64 /// Atomically or a 32-bit value at memory operand \a __A and a 32-bit \a __B,
65 /// and store the result to the same memory location.
67 /// This intrinsic should be used for contention or weak ordering. It may
68 /// result in bad performance for hot data used by single thread only.
70 /// \headerfile <x86intrin.h>
72 /// This intrinsic corresponds to the \c AOR instruction.
75 /// A pointer to a 32-bit memory location.
77 /// A 32-bit integer value.
80 /// MEM[__A+31:__A] := MEM[__A+31:__A] OR __B[31:0]
82 static __inline__
void __DEFAULT_FN_ATTRS
_aor_i32(int *__A
, int __B
) {
83 __builtin_ia32_aor32((int *)__A
, __B
);
86 /// Atomically xor a 32-bit value at memory operand \a __A and a 32-bit \a __B,
87 /// and store the result to the same memory location.
89 /// This intrinsic should be used for contention or weak ordering. It may
90 /// result in bad performance for hot data used by single thread only.
92 /// \headerfile <x86intrin.h>
94 /// This intrinsic corresponds to the \c AXOR instruction.
97 /// A pointer to a 32-bit memory location.
99 /// A 32-bit integer value.
101 /// \code{.operation}
102 /// MEM[__A+31:__A] := MEM[__A+31:__A] XOR __B[31:0]
104 static __inline__
void __DEFAULT_FN_ATTRS
_axor_i32(int *__A
, int __B
) {
105 __builtin_ia32_axor32((int *)__A
, __B
);
109 /// Atomically add a 64-bit value at memory operand \a __A and a 64-bit \a __B,
110 /// and store the result to the same memory location.
112 /// This intrinsic should be used for contention or weak ordering. It may
113 /// result in bad performance for hot data used by single thread only.
115 /// \headerfile <x86intrin.h>
117 /// This intrinsic corresponds to the \c AADD instruction.
120 /// A pointer to a 64-bit memory location.
122 /// A 64-bit integer value.
124 /// \code{.operation}
125 /// MEM[__A+63:__A] := MEM[__A+63:__A] + __B[63:0]
127 static __inline__
void __DEFAULT_FN_ATTRS
_aadd_i64(long long *__A
,
129 __builtin_ia32_aadd64((long long *)__A
, __B
);
132 /// Atomically and a 64-bit value at memory operand \a __A and a 64-bit \a __B,
133 /// and store the result to the same memory location.
135 /// This intrinsic should be used for contention or weak ordering. It may
136 /// result in bad performance for hot data used by single thread only.
138 /// \headerfile <x86intrin.h>
140 /// This intrinsic corresponds to the \c AAND instruction.
143 /// A pointer to a 64-bit memory location.
145 /// A 64-bit integer value.
147 /// \code{.operation}
148 /// MEM[__A+63:__A] := MEM[__A+63:__A] AND __B[63:0]
150 static __inline__
void __DEFAULT_FN_ATTRS
_aand_i64(long long *__A
,
152 __builtin_ia32_aand64((long long *)__A
, __B
);
155 /// Atomically or a 64-bit value at memory operand \a __A and a 64-bit \a __B,
156 /// and store the result to the same memory location.
158 /// This intrinsic should be used for contention or weak ordering. It may
159 /// result in bad performance for hot data used by single thread only.
161 /// \headerfile <x86intrin.h>
163 /// This intrinsic corresponds to the \c AOR instruction.
166 /// A pointer to a 64-bit memory location.
168 /// A 64-bit integer value.
170 /// \code{.operation}
171 /// MEM[__A+63:__A] := MEM[__A+63:__A] OR __B[63:0]
173 static __inline__
void __DEFAULT_FN_ATTRS
_aor_i64(long long *__A
,
175 __builtin_ia32_aor64((long long *)__A
, __B
);
178 /// Atomically xor a 64-bit value at memory operand \a __A and a 64-bit \a __B,
179 /// and store the result to the same memory location.
181 /// This intrinsic should be used for contention or weak ordering. It may
182 /// result in bad performance for hot data used by single thread only.
184 /// \headerfile <x86intrin.h>
186 /// This intrinsic corresponds to the \c AXOR instruction.
189 /// A pointer to a 64-bit memory location.
191 /// A 64-bit integer value.
193 /// \code{.operation}
194 /// MEM[__A+63:__A] := MEM[__A+63:__A] XOR __B[63:0]
196 static __inline__
void __DEFAULT_FN_ATTRS
_axor_i64(long long *__A
,
198 __builtin_ia32_axor64((long long *)__A
, __B
);
202 #undef __DEFAULT_FN_ATTRS
203 #endif // __RAOINTINTRIN_H