LLVM OpenMP* Runtime Library
kmp_atomic.h
1/*
2 * kmp_atomic.h - ATOMIC header file
3 */
4
5//===----------------------------------------------------------------------===//
6//
7// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8// See https://llvm.org/LICENSE.txt for license information.
9// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef KMP_ATOMIC_H
14#define KMP_ATOMIC_H
15
16#include "kmp_lock.h"
17#include "kmp_os.h"
18
19#if OMPT_SUPPORT
20#include "ompt-specific.h"
21#endif
22
23// C++ build port.
24// Intel compiler does not support _Complex datatype on win.
25// Intel compiler supports _Complex datatype on lin and mac.
26// On the other side, there is a problem of stack alignment on lin_32 and mac_32
27// if the rhs is cmplx80 or cmplx128 typedef'ed datatype.
28// The decision is: to use compiler supported _Complex type on lin and mac,
29// to use typedef'ed types on win.
30// Condition for WIN64 was modified in anticipation of 10.1 build compiler.
31
32#if defined(__cplusplus) && (KMP_OS_WINDOWS)
33// create shortcuts for c99 complex types
34
35// Visual Studio cannot have function parameters that have the
36// align __declspec attribute, so we must remove it. (Compiler Error C2719)
37#if KMP_COMPILER_MSVC
38#undef KMP_DO_ALIGN
39#define KMP_DO_ALIGN(alignment) /* Nothing */
40#endif
41
42#if defined(_MSC_VER) && (_MSC_VER < 1600) && defined(_DEBUG)
43// Workaround for the problem of _DebugHeapTag unresolved external.
44// This problem prevented to use our static debug library for C tests
45// compiled with /MDd option (the library itself built with /MTd),
46#undef _DEBUG
47#define _DEBUG_TEMPORARILY_UNSET_
48#endif
49
50#include <complex>
51
52template <typename type_lhs, typename type_rhs>
53std::complex<type_lhs> __kmp_lhs_div_rhs(const std::complex<type_lhs> &lhs,
54 const std::complex<type_rhs> &rhs) {
55 type_lhs a = lhs.real();
56 type_lhs b = lhs.imag();
57 type_rhs c = rhs.real();
58 type_rhs d = rhs.imag();
59 type_rhs den = c * c + d * d;
60 type_rhs r = (a * c + b * d);
61 type_rhs i = (b * c - a * d);
62 std::complex<type_lhs> ret(r / den, i / den);
63 return ret;
64}
65
66// complex8
67struct __kmp_cmplx64_t : std::complex<double> {
68
69 __kmp_cmplx64_t() : std::complex<double>() {}
70
71 __kmp_cmplx64_t(const std::complex<double> &cd) : std::complex<double>(cd) {}
72
73 void operator/=(const __kmp_cmplx64_t &rhs) {
74 std::complex<double> lhs = *this;
75 *this = __kmp_lhs_div_rhs(lhs, rhs);
76 }
77
78 __kmp_cmplx64_t operator/(const __kmp_cmplx64_t &rhs) {
79 std::complex<double> lhs = *this;
80 return __kmp_lhs_div_rhs(lhs, rhs);
81 }
82};
83typedef struct __kmp_cmplx64_t kmp_cmplx64;
84
85// complex4
86struct __kmp_cmplx32_t : std::complex<float> {
87
88 __kmp_cmplx32_t() : std::complex<float>() {}
89
90 __kmp_cmplx32_t(const std::complex<float> &cf) : std::complex<float>(cf) {}
91
92 __kmp_cmplx32_t operator+(const __kmp_cmplx32_t &b) {
93 std::complex<float> lhs = *this;
94 std::complex<float> rhs = b;
95 return (lhs + rhs);
96 }
97 __kmp_cmplx32_t operator-(const __kmp_cmplx32_t &b) {
98 std::complex<float> lhs = *this;
99 std::complex<float> rhs = b;
100 return (lhs - rhs);
101 }
102 __kmp_cmplx32_t operator*(const __kmp_cmplx32_t &b) {
103 std::complex<float> lhs = *this;
104 std::complex<float> rhs = b;
105 return (lhs * rhs);
106 }
107
108 __kmp_cmplx32_t operator+(const kmp_cmplx64 &b) {
109 kmp_cmplx64 t = kmp_cmplx64(*this) + b;
110 std::complex<double> d(t);
111 std::complex<float> f(d);
112 __kmp_cmplx32_t r(f);
113 return r;
114 }
115 __kmp_cmplx32_t operator-(const kmp_cmplx64 &b) {
116 kmp_cmplx64 t = kmp_cmplx64(*this) - b;
117 std::complex<double> d(t);
118 std::complex<float> f(d);
119 __kmp_cmplx32_t r(f);
120 return r;
121 }
122 __kmp_cmplx32_t operator*(const kmp_cmplx64 &b) {
123 kmp_cmplx64 t = kmp_cmplx64(*this) * b;
124 std::complex<double> d(t);
125 std::complex<float> f(d);
126 __kmp_cmplx32_t r(f);
127 return r;
128 }
129
130 void operator/=(const __kmp_cmplx32_t &rhs) {
131 std::complex<float> lhs = *this;
132 *this = __kmp_lhs_div_rhs(lhs, rhs);
133 }
134
135 __kmp_cmplx32_t operator/(const __kmp_cmplx32_t &rhs) {
136 std::complex<float> lhs = *this;
137 return __kmp_lhs_div_rhs(lhs, rhs);
138 }
139
140 void operator/=(const kmp_cmplx64 &rhs) {
141 std::complex<float> lhs = *this;
142 *this = __kmp_lhs_div_rhs(lhs, rhs);
143 }
144
145 __kmp_cmplx32_t operator/(const kmp_cmplx64 &rhs) {
146 std::complex<float> lhs = *this;
147 return __kmp_lhs_div_rhs(lhs, rhs);
148 }
149};
150typedef struct __kmp_cmplx32_t kmp_cmplx32;
151
152// complex10
153struct KMP_DO_ALIGN(16) __kmp_cmplx80_t : std::complex<long double> {
154
155 __kmp_cmplx80_t() : std::complex<long double>() {}
156
157 __kmp_cmplx80_t(const std::complex<long double> &cld)
158 : std::complex<long double>(cld) {}
159
160 void operator/=(const __kmp_cmplx80_t &rhs) {
161 std::complex<long double> lhs = *this;
162 *this = __kmp_lhs_div_rhs(lhs, rhs);
163 }
164
165 __kmp_cmplx80_t operator/(const __kmp_cmplx80_t &rhs) {
166 std::complex<long double> lhs = *this;
167 return __kmp_lhs_div_rhs(lhs, rhs);
168 }
169};
170typedef KMP_DO_ALIGN(16) struct __kmp_cmplx80_t kmp_cmplx80;
171
172// complex16
173#if KMP_HAVE_QUAD
174struct __kmp_cmplx128_t : std::complex<_Quad> {
175
176 __kmp_cmplx128_t() : std::complex<_Quad>() {}
177
178 __kmp_cmplx128_t(const std::complex<_Quad> &cq) : std::complex<_Quad>(cq) {}
179
180 void operator/=(const __kmp_cmplx128_t &rhs) {
181 std::complex<_Quad> lhs = *this;
182 *this = __kmp_lhs_div_rhs(lhs, rhs);
183 }
184
185 __kmp_cmplx128_t operator/(const __kmp_cmplx128_t &rhs) {
186 std::complex<_Quad> lhs = *this;
187 return __kmp_lhs_div_rhs(lhs, rhs);
188 }
189};
190typedef struct __kmp_cmplx128_t kmp_cmplx128;
191#endif /* KMP_HAVE_QUAD */
192
193#ifdef _DEBUG_TEMPORARILY_UNSET_
194#undef _DEBUG_TEMPORARILY_UNSET_
195// Set it back now
196#define _DEBUG 1
197#endif
198
199#else
200// create shortcuts for c99 complex types
201typedef float _Complex kmp_cmplx32;
202typedef double _Complex kmp_cmplx64;
203typedef long double _Complex kmp_cmplx80;
204#if KMP_HAVE_QUAD
205typedef _Quad _Complex kmp_cmplx128;
206#endif
207#endif
208
209// Compiler 12.0 changed alignment of 16 and 32-byte arguments (like _Quad
210// and kmp_cmplx128) on IA-32 architecture. The following aligned structures
211// are implemented to support the old alignment in 10.1, 11.0, 11.1 and
212// introduce the new alignment in 12.0. See CQ88405.
213#if KMP_ARCH_X86 && KMP_HAVE_QUAD
214
215// 4-byte aligned structures for backward compatibility.
216
217#pragma pack(push, 4)
218
219struct KMP_DO_ALIGN(4) Quad_a4_t {
220 _Quad q;
221
222 Quad_a4_t() : q() {}
223 Quad_a4_t(const _Quad &cq) : q(cq) {}
224
225 Quad_a4_t operator+(const Quad_a4_t &b) {
226 _Quad lhs = (*this).q;
227 _Quad rhs = b.q;
228 return (Quad_a4_t)(lhs + rhs);
229 }
230
231 Quad_a4_t operator-(const Quad_a4_t &b) {
232 _Quad lhs = (*this).q;
233 _Quad rhs = b.q;
234 return (Quad_a4_t)(lhs - rhs);
235 }
236 Quad_a4_t operator*(const Quad_a4_t &b) {
237 _Quad lhs = (*this).q;
238 _Quad rhs = b.q;
239 return (Quad_a4_t)(lhs * rhs);
240 }
241
242 Quad_a4_t operator/(const Quad_a4_t &b) {
243 _Quad lhs = (*this).q;
244 _Quad rhs = b.q;
245 return (Quad_a4_t)(lhs / rhs);
246 }
247};
248
249struct KMP_DO_ALIGN(4) kmp_cmplx128_a4_t {
250 kmp_cmplx128 q;
251
252 kmp_cmplx128_a4_t() : q() {}
253
254 kmp_cmplx128_a4_t(const kmp_cmplx128 &c128) : q(c128) {}
255
256 kmp_cmplx128_a4_t operator+(const kmp_cmplx128_a4_t &b) {
257 kmp_cmplx128 lhs = (*this).q;
258 kmp_cmplx128 rhs = b.q;
259 return (kmp_cmplx128_a4_t)(lhs + rhs);
260 }
261 kmp_cmplx128_a4_t operator-(const kmp_cmplx128_a4_t &b) {
262 kmp_cmplx128 lhs = (*this).q;
263 kmp_cmplx128 rhs = b.q;
264 return (kmp_cmplx128_a4_t)(lhs - rhs);
265 }
266 kmp_cmplx128_a4_t operator*(const kmp_cmplx128_a4_t &b) {
267 kmp_cmplx128 lhs = (*this).q;
268 kmp_cmplx128 rhs = b.q;
269 return (kmp_cmplx128_a4_t)(lhs * rhs);
270 }
271
272 kmp_cmplx128_a4_t operator/(const kmp_cmplx128_a4_t &b) {
273 kmp_cmplx128 lhs = (*this).q;
274 kmp_cmplx128 rhs = b.q;
275 return (kmp_cmplx128_a4_t)(lhs / rhs);
276 }
277};
278
279#pragma pack(pop)
280
281// New 16-byte aligned structures for 12.0 compiler.
282struct KMP_DO_ALIGN(16) Quad_a16_t {
283 _Quad q;
284
285 Quad_a16_t() : q() {}
286 Quad_a16_t(const _Quad &cq) : q(cq) {}
287
288 Quad_a16_t operator+(const Quad_a16_t &b) {
289 _Quad lhs = (*this).q;
290 _Quad rhs = b.q;
291 return (Quad_a16_t)(lhs + rhs);
292 }
293
294 Quad_a16_t operator-(const Quad_a16_t &b) {
295 _Quad lhs = (*this).q;
296 _Quad rhs = b.q;
297 return (Quad_a16_t)(lhs - rhs);
298 }
299 Quad_a16_t operator*(const Quad_a16_t &b) {
300 _Quad lhs = (*this).q;
301 _Quad rhs = b.q;
302 return (Quad_a16_t)(lhs * rhs);
303 }
304
305 Quad_a16_t operator/(const Quad_a16_t &b) {
306 _Quad lhs = (*this).q;
307 _Quad rhs = b.q;
308 return (Quad_a16_t)(lhs / rhs);
309 }
310};
311
312struct KMP_DO_ALIGN(16) kmp_cmplx128_a16_t {
313 kmp_cmplx128 q;
314
315 kmp_cmplx128_a16_t() : q() {}
316
317 kmp_cmplx128_a16_t(const kmp_cmplx128 &c128) : q(c128) {}
318
319 kmp_cmplx128_a16_t operator+(const kmp_cmplx128_a16_t &b) {
320 kmp_cmplx128 lhs = (*this).q;
321 kmp_cmplx128 rhs = b.q;
322 return (kmp_cmplx128_a16_t)(lhs + rhs);
323 }
324 kmp_cmplx128_a16_t operator-(const kmp_cmplx128_a16_t &b) {
325 kmp_cmplx128 lhs = (*this).q;
326 kmp_cmplx128 rhs = b.q;
327 return (kmp_cmplx128_a16_t)(lhs - rhs);
328 }
329 kmp_cmplx128_a16_t operator*(const kmp_cmplx128_a16_t &b) {
330 kmp_cmplx128 lhs = (*this).q;
331 kmp_cmplx128 rhs = b.q;
332 return (kmp_cmplx128_a16_t)(lhs * rhs);
333 }
334
335 kmp_cmplx128_a16_t operator/(const kmp_cmplx128_a16_t &b) {
336 kmp_cmplx128 lhs = (*this).q;
337 kmp_cmplx128 rhs = b.q;
338 return (kmp_cmplx128_a16_t)(lhs / rhs);
339 }
340};
341
342#endif
343
344#if (KMP_ARCH_X86)
345#define QUAD_LEGACY Quad_a4_t
346#define CPLX128_LEG kmp_cmplx128_a4_t
347#else
348#define QUAD_LEGACY _Quad
349#define CPLX128_LEG kmp_cmplx128
350#endif
351
352#ifdef __cplusplus
353extern "C" {
354#endif
355
356extern int __kmp_atomic_mode;
357
358// Atomic locks can easily become contended, so we use queuing locks for them.
359typedef kmp_queuing_lock_t kmp_atomic_lock_t;
360
361static inline void __kmp_acquire_atomic_lock(kmp_atomic_lock_t *lck,
362 kmp_int32 gtid) {
363#if OMPT_SUPPORT && OMPT_OPTIONAL
364 if (ompt_enabled.ompt_callback_mutex_acquire) {
365 ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
366 ompt_mutex_atomic, 0, kmp_mutex_impl_queuing,
367 (ompt_wait_id_t)(uintptr_t)lck, OMPT_GET_RETURN_ADDRESS(0));
368 }
369#endif
370
371 __kmp_acquire_queuing_lock(lck, gtid);
372
373#if OMPT_SUPPORT && OMPT_OPTIONAL
374 if (ompt_enabled.ompt_callback_mutex_acquired) {
375 ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
376 ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck,
377 OMPT_GET_RETURN_ADDRESS(0));
378 }
379#endif
380}
381
382static inline int __kmp_test_atomic_lock(kmp_atomic_lock_t *lck,
383 kmp_int32 gtid) {
384 return __kmp_test_queuing_lock(lck, gtid);
385}
386
387static inline void __kmp_release_atomic_lock(kmp_atomic_lock_t *lck,
388 kmp_int32 gtid) {
389 __kmp_release_queuing_lock(lck, gtid);
390#if OMPT_SUPPORT && OMPT_OPTIONAL
391 if (ompt_enabled.ompt_callback_mutex_released) {
392 ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
393 ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck,
394 OMPT_GET_RETURN_ADDRESS(0));
395 }
396#endif
397}
398
399static inline void __kmp_init_atomic_lock(kmp_atomic_lock_t *lck) {
400 __kmp_init_queuing_lock(lck);
401}
402
403static inline void __kmp_destroy_atomic_lock(kmp_atomic_lock_t *lck) {
404 __kmp_destroy_queuing_lock(lck);
405}
406
407// Global Locks
408extern kmp_atomic_lock_t __kmp_atomic_lock; /* Control access to all user coded
409 atomics in Gnu compat mode */
410extern kmp_atomic_lock_t __kmp_atomic_lock_1i; /* Control access to all user
411 coded atomics for 1-byte fixed
412 data types */
413extern kmp_atomic_lock_t __kmp_atomic_lock_2i; /* Control access to all user
414 coded atomics for 2-byte fixed
415 data types */
416extern kmp_atomic_lock_t __kmp_atomic_lock_4i; /* Control access to all user
417 coded atomics for 4-byte fixed
418 data types */
419extern kmp_atomic_lock_t __kmp_atomic_lock_4r; /* Control access to all user
420 coded atomics for kmp_real32
421 data type */
422extern kmp_atomic_lock_t __kmp_atomic_lock_8i; /* Control access to all user
423 coded atomics for 8-byte fixed
424 data types */
425extern kmp_atomic_lock_t __kmp_atomic_lock_8r; /* Control access to all user
426 coded atomics for kmp_real64
427 data type */
428extern kmp_atomic_lock_t
429 __kmp_atomic_lock_8c; /* Control access to all user coded atomics for
430 complex byte data type */
431extern kmp_atomic_lock_t
432 __kmp_atomic_lock_10r; /* Control access to all user coded atomics for long
433 double data type */
434extern kmp_atomic_lock_t __kmp_atomic_lock_16r; /* Control access to all user
435 coded atomics for _Quad data
436 type */
437extern kmp_atomic_lock_t __kmp_atomic_lock_16c; /* Control access to all user
438 coded atomics for double
439 complex data type*/
440extern kmp_atomic_lock_t
441 __kmp_atomic_lock_20c; /* Control access to all user coded atomics for long
442 double complex type*/
443extern kmp_atomic_lock_t __kmp_atomic_lock_32c; /* Control access to all user
444 coded atomics for _Quad
445 complex data type */
446
447// Below routines for atomic UPDATE are listed
448
449// 1-byte
450void __kmpc_atomic_fixed1_add(ident_t *id_ref, int gtid, char *lhs, char rhs);
451void __kmpc_atomic_fixed1_andb(ident_t *id_ref, int gtid, char *lhs, char rhs);
452void __kmpc_atomic_fixed1_div(ident_t *id_ref, int gtid, char *lhs, char rhs);
453void __kmpc_atomic_fixed1u_div(ident_t *id_ref, int gtid, unsigned char *lhs,
454 unsigned char rhs);
455void __kmpc_atomic_fixed1_mul(ident_t *id_ref, int gtid, char *lhs, char rhs);
456void __kmpc_atomic_fixed1_orb(ident_t *id_ref, int gtid, char *lhs, char rhs);
457void __kmpc_atomic_fixed1_shl(ident_t *id_ref, int gtid, char *lhs, char rhs);
458void __kmpc_atomic_fixed1_shr(ident_t *id_ref, int gtid, char *lhs, char rhs);
459void __kmpc_atomic_fixed1u_shr(ident_t *id_ref, int gtid, unsigned char *lhs,
460 unsigned char rhs);
461void __kmpc_atomic_fixed1_sub(ident_t *id_ref, int gtid, char *lhs, char rhs);
462void __kmpc_atomic_fixed1_xor(ident_t *id_ref, int gtid, char *lhs, char rhs);
463// 2-byte
464void __kmpc_atomic_fixed2_add(ident_t *id_ref, int gtid, short *lhs, short rhs);
465void __kmpc_atomic_fixed2_andb(ident_t *id_ref, int gtid, short *lhs,
466 short rhs);
467void __kmpc_atomic_fixed2_div(ident_t *id_ref, int gtid, short *lhs, short rhs);
468void __kmpc_atomic_fixed2u_div(ident_t *id_ref, int gtid, unsigned short *lhs,
469 unsigned short rhs);
470void __kmpc_atomic_fixed2_mul(ident_t *id_ref, int gtid, short *lhs, short rhs);
471void __kmpc_atomic_fixed2_orb(ident_t *id_ref, int gtid, short *lhs, short rhs);
472void __kmpc_atomic_fixed2_shl(ident_t *id_ref, int gtid, short *lhs, short rhs);
473void __kmpc_atomic_fixed2_shr(ident_t *id_ref, int gtid, short *lhs, short rhs);
474void __kmpc_atomic_fixed2u_shr(ident_t *id_ref, int gtid, unsigned short *lhs,
475 unsigned short rhs);
476void __kmpc_atomic_fixed2_sub(ident_t *id_ref, int gtid, short *lhs, short rhs);
477void __kmpc_atomic_fixed2_xor(ident_t *id_ref, int gtid, short *lhs, short rhs);
478// 4-byte add / sub fixed
479void __kmpc_atomic_fixed4_add(ident_t *id_ref, int gtid, kmp_int32 *lhs,
480 kmp_int32 rhs);
481void __kmpc_atomic_fixed4_sub(ident_t *id_ref, int gtid, kmp_int32 *lhs,
482 kmp_int32 rhs);
483// 4-byte add / sub float
484void __kmpc_atomic_float4_add(ident_t *id_ref, int gtid, kmp_real32 *lhs,
485 kmp_real32 rhs);
486void __kmpc_atomic_float4_sub(ident_t *id_ref, int gtid, kmp_real32 *lhs,
487 kmp_real32 rhs);
488// 8-byte add / sub fixed
489void __kmpc_atomic_fixed8_add(ident_t *id_ref, int gtid, kmp_int64 *lhs,
490 kmp_int64 rhs);
491void __kmpc_atomic_fixed8_sub(ident_t *id_ref, int gtid, kmp_int64 *lhs,
492 kmp_int64 rhs);
493// 8-byte add / sub float
494void __kmpc_atomic_float8_add(ident_t *id_ref, int gtid, kmp_real64 *lhs,
495 kmp_real64 rhs);
496void __kmpc_atomic_float8_sub(ident_t *id_ref, int gtid, kmp_real64 *lhs,
497 kmp_real64 rhs);
498// 4-byte fixed
499void __kmpc_atomic_fixed4_andb(ident_t *id_ref, int gtid, kmp_int32 *lhs,
500 kmp_int32 rhs);
501void __kmpc_atomic_fixed4_div(ident_t *id_ref, int gtid, kmp_int32 *lhs,
502 kmp_int32 rhs);
503void __kmpc_atomic_fixed4u_div(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
504 kmp_uint32 rhs);
505void __kmpc_atomic_fixed4_mul(ident_t *id_ref, int gtid, kmp_int32 *lhs,
506 kmp_int32 rhs);
507void __kmpc_atomic_fixed4_orb(ident_t *id_ref, int gtid, kmp_int32 *lhs,
508 kmp_int32 rhs);
509void __kmpc_atomic_fixed4_shl(ident_t *id_ref, int gtid, kmp_int32 *lhs,
510 kmp_int32 rhs);
511void __kmpc_atomic_fixed4_shr(ident_t *id_ref, int gtid, kmp_int32 *lhs,
512 kmp_int32 rhs);
513void __kmpc_atomic_fixed4u_shr(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
514 kmp_uint32 rhs);
515void __kmpc_atomic_fixed4_xor(ident_t *id_ref, int gtid, kmp_int32 *lhs,
516 kmp_int32 rhs);
517// 8-byte fixed
518void __kmpc_atomic_fixed8_andb(ident_t *id_ref, int gtid, kmp_int64 *lhs,
519 kmp_int64 rhs);
520void __kmpc_atomic_fixed8_div(ident_t *id_ref, int gtid, kmp_int64 *lhs,
521 kmp_int64 rhs);
522void __kmpc_atomic_fixed8u_div(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
523 kmp_uint64 rhs);
524void __kmpc_atomic_fixed8_mul(ident_t *id_ref, int gtid, kmp_int64 *lhs,
525 kmp_int64 rhs);
526void __kmpc_atomic_fixed8_orb(ident_t *id_ref, int gtid, kmp_int64 *lhs,
527 kmp_int64 rhs);
528void __kmpc_atomic_fixed8_shl(ident_t *id_ref, int gtid, kmp_int64 *lhs,
529 kmp_int64 rhs);
530void __kmpc_atomic_fixed8_shr(ident_t *id_ref, int gtid, kmp_int64 *lhs,
531 kmp_int64 rhs);
532void __kmpc_atomic_fixed8u_shr(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
533 kmp_uint64 rhs);
534void __kmpc_atomic_fixed8_xor(ident_t *id_ref, int gtid, kmp_int64 *lhs,
535 kmp_int64 rhs);
536// 4-byte float
537void __kmpc_atomic_float4_div(ident_t *id_ref, int gtid, kmp_real32 *lhs,
538 kmp_real32 rhs);
539void __kmpc_atomic_float4_mul(ident_t *id_ref, int gtid, kmp_real32 *lhs,
540 kmp_real32 rhs);
541// 8-byte float
542void __kmpc_atomic_float8_div(ident_t *id_ref, int gtid, kmp_real64 *lhs,
543 kmp_real64 rhs);
544void __kmpc_atomic_float8_mul(ident_t *id_ref, int gtid, kmp_real64 *lhs,
545 kmp_real64 rhs);
546// 1-, 2-, 4-, 8-byte logical (&&, ||)
547void __kmpc_atomic_fixed1_andl(ident_t *id_ref, int gtid, char *lhs, char rhs);
548void __kmpc_atomic_fixed1_orl(ident_t *id_ref, int gtid, char *lhs, char rhs);
549void __kmpc_atomic_fixed2_andl(ident_t *id_ref, int gtid, short *lhs,
550 short rhs);
551void __kmpc_atomic_fixed2_orl(ident_t *id_ref, int gtid, short *lhs, short rhs);
552void __kmpc_atomic_fixed4_andl(ident_t *id_ref, int gtid, kmp_int32 *lhs,
553 kmp_int32 rhs);
554void __kmpc_atomic_fixed4_orl(ident_t *id_ref, int gtid, kmp_int32 *lhs,
555 kmp_int32 rhs);
556void __kmpc_atomic_fixed8_andl(ident_t *id_ref, int gtid, kmp_int64 *lhs,
557 kmp_int64 rhs);
558void __kmpc_atomic_fixed8_orl(ident_t *id_ref, int gtid, kmp_int64 *lhs,
559 kmp_int64 rhs);
560// MIN / MAX
561void __kmpc_atomic_fixed1_max(ident_t *id_ref, int gtid, char *lhs, char rhs);
562void __kmpc_atomic_fixed1_min(ident_t *id_ref, int gtid, char *lhs, char rhs);
563void __kmpc_atomic_fixed2_max(ident_t *id_ref, int gtid, short *lhs, short rhs);
564void __kmpc_atomic_fixed2_min(ident_t *id_ref, int gtid, short *lhs, short rhs);
565void __kmpc_atomic_fixed4_max(ident_t *id_ref, int gtid, kmp_int32 *lhs,
566 kmp_int32 rhs);
567void __kmpc_atomic_fixed4_min(ident_t *id_ref, int gtid, kmp_int32 *lhs,
568 kmp_int32 rhs);
569void __kmpc_atomic_fixed8_max(ident_t *id_ref, int gtid, kmp_int64 *lhs,
570 kmp_int64 rhs);
571void __kmpc_atomic_fixed8_min(ident_t *id_ref, int gtid, kmp_int64 *lhs,
572 kmp_int64 rhs);
573void __kmpc_atomic_float4_max(ident_t *id_ref, int gtid, kmp_real32 *lhs,
574 kmp_real32 rhs);
575void __kmpc_atomic_float4_min(ident_t *id_ref, int gtid, kmp_real32 *lhs,
576 kmp_real32 rhs);
577void __kmpc_atomic_float8_max(ident_t *id_ref, int gtid, kmp_real64 *lhs,
578 kmp_real64 rhs);
579void __kmpc_atomic_float8_min(ident_t *id_ref, int gtid, kmp_real64 *lhs,
580 kmp_real64 rhs);
581void __kmpc_atomic_float10_max(ident_t *id_ref, int gtid, long double *lhs,
582 long double rhs);
583void __kmpc_atomic_float10_min(ident_t *id_ref, int gtid, long double *lhs,
584 long double rhs);
585#if KMP_HAVE_QUAD
586void __kmpc_atomic_float16_max(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
587 QUAD_LEGACY rhs);
588void __kmpc_atomic_float16_min(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
589 QUAD_LEGACY rhs);
590#if (KMP_ARCH_X86)
591// Routines with 16-byte arguments aligned to 16-byte boundary; IA-32
592// architecture only
593void __kmpc_atomic_float16_max_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
594 Quad_a16_t rhs);
595void __kmpc_atomic_float16_min_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
596 Quad_a16_t rhs);
597#endif
598#endif
599// .NEQV. (same as xor)
600void __kmpc_atomic_fixed1_neqv(ident_t *id_ref, int gtid, char *lhs, char rhs);
601void __kmpc_atomic_fixed2_neqv(ident_t *id_ref, int gtid, short *lhs,
602 short rhs);
603void __kmpc_atomic_fixed4_neqv(ident_t *id_ref, int gtid, kmp_int32 *lhs,
604 kmp_int32 rhs);
605void __kmpc_atomic_fixed8_neqv(ident_t *id_ref, int gtid, kmp_int64 *lhs,
606 kmp_int64 rhs);
607// .EQV. (same as ~xor)
608void __kmpc_atomic_fixed1_eqv(ident_t *id_ref, int gtid, char *lhs, char rhs);
609void __kmpc_atomic_fixed2_eqv(ident_t *id_ref, int gtid, short *lhs, short rhs);
610void __kmpc_atomic_fixed4_eqv(ident_t *id_ref, int gtid, kmp_int32 *lhs,
611 kmp_int32 rhs);
612void __kmpc_atomic_fixed8_eqv(ident_t *id_ref, int gtid, kmp_int64 *lhs,
613 kmp_int64 rhs);
614// long double type
615void __kmpc_atomic_float10_add(ident_t *id_ref, int gtid, long double *lhs,
616 long double rhs);
617void __kmpc_atomic_float10_sub(ident_t *id_ref, int gtid, long double *lhs,
618 long double rhs);
619void __kmpc_atomic_float10_mul(ident_t *id_ref, int gtid, long double *lhs,
620 long double rhs);
621void __kmpc_atomic_float10_div(ident_t *id_ref, int gtid, long double *lhs,
622 long double rhs);
623// _Quad type
624#if KMP_HAVE_QUAD
625void __kmpc_atomic_float16_add(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
626 QUAD_LEGACY rhs);
627void __kmpc_atomic_float16_sub(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
628 QUAD_LEGACY rhs);
629void __kmpc_atomic_float16_mul(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
630 QUAD_LEGACY rhs);
631void __kmpc_atomic_float16_div(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
632 QUAD_LEGACY rhs);
633#if (KMP_ARCH_X86)
634// Routines with 16-byte arguments aligned to 16-byte boundary
635void __kmpc_atomic_float16_add_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
636 Quad_a16_t rhs);
637void __kmpc_atomic_float16_sub_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
638 Quad_a16_t rhs);
639void __kmpc_atomic_float16_mul_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
640 Quad_a16_t rhs);
641void __kmpc_atomic_float16_div_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
642 Quad_a16_t rhs);
643#endif
644#endif
645// routines for complex types
646void __kmpc_atomic_cmplx4_add(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
647 kmp_cmplx32 rhs);
648void __kmpc_atomic_cmplx4_sub(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
649 kmp_cmplx32 rhs);
650void __kmpc_atomic_cmplx4_mul(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
651 kmp_cmplx32 rhs);
652void __kmpc_atomic_cmplx4_div(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
653 kmp_cmplx32 rhs);
654void __kmpc_atomic_cmplx8_add(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
655 kmp_cmplx64 rhs);
656void __kmpc_atomic_cmplx8_sub(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
657 kmp_cmplx64 rhs);
658void __kmpc_atomic_cmplx8_mul(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
659 kmp_cmplx64 rhs);
660void __kmpc_atomic_cmplx8_div(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
661 kmp_cmplx64 rhs);
662void __kmpc_atomic_cmplx10_add(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
663 kmp_cmplx80 rhs);
664void __kmpc_atomic_cmplx10_sub(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
665 kmp_cmplx80 rhs);
666void __kmpc_atomic_cmplx10_mul(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
667 kmp_cmplx80 rhs);
668void __kmpc_atomic_cmplx10_div(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
669 kmp_cmplx80 rhs);
670#if KMP_HAVE_QUAD
671void __kmpc_atomic_cmplx16_add(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
672 CPLX128_LEG rhs);
673void __kmpc_atomic_cmplx16_sub(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
674 CPLX128_LEG rhs);
675void __kmpc_atomic_cmplx16_mul(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
676 CPLX128_LEG rhs);
677void __kmpc_atomic_cmplx16_div(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
678 CPLX128_LEG rhs);
679#if (KMP_ARCH_X86)
680// Routines with 16-byte arguments aligned to 16-byte boundary
681void __kmpc_atomic_cmplx16_add_a16(ident_t *id_ref, int gtid,
682 kmp_cmplx128_a16_t *lhs,
683 kmp_cmplx128_a16_t rhs);
684void __kmpc_atomic_cmplx16_sub_a16(ident_t *id_ref, int gtid,
685 kmp_cmplx128_a16_t *lhs,
686 kmp_cmplx128_a16_t rhs);
687void __kmpc_atomic_cmplx16_mul_a16(ident_t *id_ref, int gtid,
688 kmp_cmplx128_a16_t *lhs,
689 kmp_cmplx128_a16_t rhs);
690void __kmpc_atomic_cmplx16_div_a16(ident_t *id_ref, int gtid,
691 kmp_cmplx128_a16_t *lhs,
692 kmp_cmplx128_a16_t rhs);
693#endif
694#endif
695
696// OpenMP 4.0: x = expr binop x for non-commutative operations.
697// Supported only on IA-32 architecture and Intel(R) 64
698#if KMP_ARCH_X86 || KMP_ARCH_X86_64
699
700void __kmpc_atomic_fixed1_sub_rev(ident_t *id_ref, int gtid, char *lhs,
701 char rhs);
702void __kmpc_atomic_fixed1_div_rev(ident_t *id_ref, int gtid, char *lhs,
703 char rhs);
704void __kmpc_atomic_fixed1u_div_rev(ident_t *id_ref, int gtid,
705 unsigned char *lhs, unsigned char rhs);
706void __kmpc_atomic_fixed1_shl_rev(ident_t *id_ref, int gtid, char *lhs,
707 char rhs);
708void __kmpc_atomic_fixed1_shr_rev(ident_t *id_ref, int gtid, char *lhs,
709 char rhs);
710void __kmpc_atomic_fixed1u_shr_rev(ident_t *id_ref, int gtid,
711 unsigned char *lhs, unsigned char rhs);
712void __kmpc_atomic_fixed2_sub_rev(ident_t *id_ref, int gtid, short *lhs,
713 short rhs);
714void __kmpc_atomic_fixed2_div_rev(ident_t *id_ref, int gtid, short *lhs,
715 short rhs);
716void __kmpc_atomic_fixed2u_div_rev(ident_t *id_ref, int gtid,
717 unsigned short *lhs, unsigned short rhs);
718void __kmpc_atomic_fixed2_shl_rev(ident_t *id_ref, int gtid, short *lhs,
719 short rhs);
720void __kmpc_atomic_fixed2_shr_rev(ident_t *id_ref, int gtid, short *lhs,
721 short rhs);
722void __kmpc_atomic_fixed2u_shr_rev(ident_t *id_ref, int gtid,
723 unsigned short *lhs, unsigned short rhs);
724void __kmpc_atomic_fixed4_sub_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
725 kmp_int32 rhs);
726void __kmpc_atomic_fixed4_div_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
727 kmp_int32 rhs);
728void __kmpc_atomic_fixed4u_div_rev(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
729 kmp_uint32 rhs);
730void __kmpc_atomic_fixed4_shl_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
731 kmp_int32 rhs);
732void __kmpc_atomic_fixed4_shr_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
733 kmp_int32 rhs);
734void __kmpc_atomic_fixed4u_shr_rev(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
735 kmp_uint32 rhs);
736void __kmpc_atomic_fixed8_sub_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
737 kmp_int64 rhs);
738void __kmpc_atomic_fixed8_div_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
739 kmp_int64 rhs);
740void __kmpc_atomic_fixed8u_div_rev(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
741 kmp_uint64 rhs);
742void __kmpc_atomic_fixed8_shl_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
743 kmp_int64 rhs);
744void __kmpc_atomic_fixed8_shr_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
745 kmp_int64 rhs);
746void __kmpc_atomic_fixed8u_shr_rev(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
747 kmp_uint64 rhs);
748void __kmpc_atomic_float4_sub_rev(ident_t *id_ref, int gtid, float *lhs,
749 float rhs);
750void __kmpc_atomic_float4_div_rev(ident_t *id_ref, int gtid, float *lhs,
751 float rhs);
752void __kmpc_atomic_float8_sub_rev(ident_t *id_ref, int gtid, double *lhs,
753 double rhs);
754void __kmpc_atomic_float8_div_rev(ident_t *id_ref, int gtid, double *lhs,
755 double rhs);
756void __kmpc_atomic_float10_sub_rev(ident_t *id_ref, int gtid, long double *lhs,
757 long double rhs);
758void __kmpc_atomic_float10_div_rev(ident_t *id_ref, int gtid, long double *lhs,
759 long double rhs);
760#if KMP_HAVE_QUAD
761void __kmpc_atomic_float16_sub_rev(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
762 QUAD_LEGACY rhs);
763void __kmpc_atomic_float16_div_rev(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
764 QUAD_LEGACY rhs);
765#endif
766void __kmpc_atomic_cmplx4_sub_rev(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
767 kmp_cmplx32 rhs);
768void __kmpc_atomic_cmplx4_div_rev(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
769 kmp_cmplx32 rhs);
770void __kmpc_atomic_cmplx8_sub_rev(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
771 kmp_cmplx64 rhs);
772void __kmpc_atomic_cmplx8_div_rev(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
773 kmp_cmplx64 rhs);
774void __kmpc_atomic_cmplx10_sub_rev(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
775 kmp_cmplx80 rhs);
776void __kmpc_atomic_cmplx10_div_rev(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
777 kmp_cmplx80 rhs);
778#if KMP_HAVE_QUAD
779void __kmpc_atomic_cmplx16_sub_rev(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
780 CPLX128_LEG rhs);
781void __kmpc_atomic_cmplx16_div_rev(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
782 CPLX128_LEG rhs);
783#if (KMP_ARCH_X86)
784// Routines with 16-byte arguments aligned to 16-byte boundary
785void __kmpc_atomic_float16_sub_a16_rev(ident_t *id_ref, int gtid,
786 Quad_a16_t *lhs, Quad_a16_t rhs);
787void __kmpc_atomic_float16_div_a16_rev(ident_t *id_ref, int gtid,
788 Quad_a16_t *lhs, Quad_a16_t rhs);
789void __kmpc_atomic_cmplx16_sub_a16_rev(ident_t *id_ref, int gtid,
790 kmp_cmplx128_a16_t *lhs,
791 kmp_cmplx128_a16_t rhs);
792void __kmpc_atomic_cmplx16_div_a16_rev(ident_t *id_ref, int gtid,
793 kmp_cmplx128_a16_t *lhs,
794 kmp_cmplx128_a16_t rhs);
795#endif
796#endif // KMP_HAVE_QUAD
797
798#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
799
800// routines for mixed types
801
802// RHS=float8
803void __kmpc_atomic_fixed1_mul_float8(ident_t *id_ref, int gtid, char *lhs,
804 kmp_real64 rhs);
805void __kmpc_atomic_fixed1_div_float8(ident_t *id_ref, int gtid, char *lhs,
806 kmp_real64 rhs);
807void __kmpc_atomic_fixed2_mul_float8(ident_t *id_ref, int gtid, short *lhs,
808 kmp_real64 rhs);
809void __kmpc_atomic_fixed2_div_float8(ident_t *id_ref, int gtid, short *lhs,
810 kmp_real64 rhs);
811void __kmpc_atomic_fixed4_mul_float8(ident_t *id_ref, int gtid, kmp_int32 *lhs,
812 kmp_real64 rhs);
813void __kmpc_atomic_fixed4_div_float8(ident_t *id_ref, int gtid, kmp_int32 *lhs,
814 kmp_real64 rhs);
815void __kmpc_atomic_fixed8_mul_float8(ident_t *id_ref, int gtid, kmp_int64 *lhs,
816 kmp_real64 rhs);
817void __kmpc_atomic_fixed8_div_float8(ident_t *id_ref, int gtid, kmp_int64 *lhs,
818 kmp_real64 rhs);
819void __kmpc_atomic_float4_add_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
820 kmp_real64 rhs);
821void __kmpc_atomic_float4_sub_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
822 kmp_real64 rhs);
823void __kmpc_atomic_float4_mul_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
824 kmp_real64 rhs);
825void __kmpc_atomic_float4_div_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
826 kmp_real64 rhs);
827
828// RHS=float16 (deprecated, to be removed when we are sure the compiler does not
829// use them)
830#if KMP_HAVE_QUAD
831void __kmpc_atomic_fixed1_add_fp(ident_t *id_ref, int gtid, char *lhs,
832 _Quad rhs);
833void __kmpc_atomic_fixed1u_add_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
834 _Quad rhs);
835void __kmpc_atomic_fixed1_sub_fp(ident_t *id_ref, int gtid, char *lhs,
836 _Quad rhs);
837void __kmpc_atomic_fixed1u_sub_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
838 _Quad rhs);
839void __kmpc_atomic_fixed1_mul_fp(ident_t *id_ref, int gtid, char *lhs,
840 _Quad rhs);
841void __kmpc_atomic_fixed1u_mul_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
842 _Quad rhs);
843void __kmpc_atomic_fixed1_div_fp(ident_t *id_ref, int gtid, char *lhs,
844 _Quad rhs);
845void __kmpc_atomic_fixed1u_div_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
846 _Quad rhs);
847
848void __kmpc_atomic_fixed2_add_fp(ident_t *id_ref, int gtid, short *lhs,
849 _Quad rhs);
850void __kmpc_atomic_fixed2u_add_fp(ident_t *id_ref, int gtid,
851 unsigned short *lhs, _Quad rhs);
852void __kmpc_atomic_fixed2_sub_fp(ident_t *id_ref, int gtid, short *lhs,
853 _Quad rhs);
854void __kmpc_atomic_fixed2u_sub_fp(ident_t *id_ref, int gtid,
855 unsigned short *lhs, _Quad rhs);
856void __kmpc_atomic_fixed2_mul_fp(ident_t *id_ref, int gtid, short *lhs,
857 _Quad rhs);
858void __kmpc_atomic_fixed2u_mul_fp(ident_t *id_ref, int gtid,
859 unsigned short *lhs, _Quad rhs);
860void __kmpc_atomic_fixed2_div_fp(ident_t *id_ref, int gtid, short *lhs,
861 _Quad rhs);
862void __kmpc_atomic_fixed2u_div_fp(ident_t *id_ref, int gtid,
863 unsigned short *lhs, _Quad rhs);
864
865void __kmpc_atomic_fixed4_add_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
866 _Quad rhs);
867void __kmpc_atomic_fixed4u_add_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
868 _Quad rhs);
869void __kmpc_atomic_fixed4_sub_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
870 _Quad rhs);
871void __kmpc_atomic_fixed4u_sub_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
872 _Quad rhs);
873void __kmpc_atomic_fixed4_mul_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
874 _Quad rhs);
875void __kmpc_atomic_fixed4u_mul_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
876 _Quad rhs);
877void __kmpc_atomic_fixed4_div_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
878 _Quad rhs);
879void __kmpc_atomic_fixed4u_div_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
880 _Quad rhs);
881
882void __kmpc_atomic_fixed8_add_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
883 _Quad rhs);
884void __kmpc_atomic_fixed8u_add_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
885 _Quad rhs);
886void __kmpc_atomic_fixed8_sub_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
887 _Quad rhs);
888void __kmpc_atomic_fixed8u_sub_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
889 _Quad rhs);
890void __kmpc_atomic_fixed8_mul_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
891 _Quad rhs);
892void __kmpc_atomic_fixed8u_mul_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
893 _Quad rhs);
894void __kmpc_atomic_fixed8_div_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
895 _Quad rhs);
896void __kmpc_atomic_fixed8u_div_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
897 _Quad rhs);
898
899void __kmpc_atomic_float4_add_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
900 _Quad rhs);
901void __kmpc_atomic_float4_sub_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
902 _Quad rhs);
903void __kmpc_atomic_float4_mul_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
904 _Quad rhs);
905void __kmpc_atomic_float4_div_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
906 _Quad rhs);
907
908void __kmpc_atomic_float8_add_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
909 _Quad rhs);
910void __kmpc_atomic_float8_sub_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
911 _Quad rhs);
912void __kmpc_atomic_float8_mul_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
913 _Quad rhs);
914void __kmpc_atomic_float8_div_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
915 _Quad rhs);
916
917void __kmpc_atomic_float10_add_fp(ident_t *id_ref, int gtid, long double *lhs,
918 _Quad rhs);
919void __kmpc_atomic_float10_sub_fp(ident_t *id_ref, int gtid, long double *lhs,
920 _Quad rhs);
921void __kmpc_atomic_float10_mul_fp(ident_t *id_ref, int gtid, long double *lhs,
922 _Quad rhs);
923void __kmpc_atomic_float10_div_fp(ident_t *id_ref, int gtid, long double *lhs,
924 _Quad rhs);
925
926// Reverse operations
927void __kmpc_atomic_fixed1_sub_rev_fp(ident_t *id_ref, int gtid, char *lhs,
928 _Quad rhs);
929void __kmpc_atomic_fixed1u_sub_rev_fp(ident_t *id_ref, int gtid,
930 unsigned char *lhs, _Quad rhs);
931void __kmpc_atomic_fixed1_div_rev_fp(ident_t *id_ref, int gtid, char *lhs,
932 _Quad rhs);
933void __kmpc_atomic_fixed1u_div_rev_fp(ident_t *id_ref, int gtid,
934 unsigned char *lhs, _Quad rhs);
935void __kmpc_atomic_fixed2_sub_rev_fp(ident_t *id_ref, int gtid, short *lhs,
936 _Quad rhs);
937void __kmpc_atomic_fixed2u_sub_rev_fp(ident_t *id_ref, int gtid,
938 unsigned short *lhs, _Quad rhs);
939void __kmpc_atomic_fixed2_div_rev_fp(ident_t *id_ref, int gtid, short *lhs,
940 _Quad rhs);
941void __kmpc_atomic_fixed2u_div_rev_fp(ident_t *id_ref, int gtid,
942 unsigned short *lhs, _Quad rhs);
943void __kmpc_atomic_fixed4_sub_rev_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
944 _Quad rhs);
945void __kmpc_atomic_fixed4u_sub_rev_fp(ident_t *id_ref, int gtid,
946 kmp_uint32 *lhs, _Quad rhs);
947void __kmpc_atomic_fixed4_div_rev_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
948 _Quad rhs);
949void __kmpc_atomic_fixed4u_div_rev_fp(ident_t *id_ref, int gtid,
950 kmp_uint32 *lhs, _Quad rhs);
951void __kmpc_atomic_fixed8_sub_rev_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
952 _Quad rhs);
953void __kmpc_atomic_fixed8u_sub_rev_fp(ident_t *id_ref, int gtid,
954 kmp_uint64 *lhs, _Quad rhs);
955void __kmpc_atomic_fixed8_div_rev_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
956 _Quad rhs);
957void __kmpc_atomic_fixed8u_div_rev_fp(ident_t *id_ref, int gtid,
958 kmp_uint64 *lhs, _Quad rhs);
959void __kmpc_atomic_float4_sub_rev_fp(ident_t *id_ref, int gtid, float *lhs,
960 _Quad rhs);
961void __kmpc_atomic_float4_div_rev_fp(ident_t *id_ref, int gtid, float *lhs,
962 _Quad rhs);
963void __kmpc_atomic_float8_sub_rev_fp(ident_t *id_ref, int gtid, double *lhs,
964 _Quad rhs);
965void __kmpc_atomic_float8_div_rev_fp(ident_t *id_ref, int gtid, double *lhs,
966 _Quad rhs);
967void __kmpc_atomic_float10_sub_rev_fp(ident_t *id_ref, int gtid,
968 long double *lhs, _Quad rhs);
969void __kmpc_atomic_float10_div_rev_fp(ident_t *id_ref, int gtid,
970 long double *lhs, _Quad rhs);
971
972#endif // KMP_HAVE_QUAD
973
974// RHS=cmplx8
975void __kmpc_atomic_cmplx4_add_cmplx8(ident_t *id_ref, int gtid,
976 kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
977void __kmpc_atomic_cmplx4_sub_cmplx8(ident_t *id_ref, int gtid,
978 kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
979void __kmpc_atomic_cmplx4_mul_cmplx8(ident_t *id_ref, int gtid,
980 kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
981void __kmpc_atomic_cmplx4_div_cmplx8(ident_t *id_ref, int gtid,
982 kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
983
984// generic atomic routines
985void __kmpc_atomic_1(ident_t *id_ref, int gtid, void *lhs, void *rhs,
986 void (*f)(void *, void *, void *));
987void __kmpc_atomic_2(ident_t *id_ref, int gtid, void *lhs, void *rhs,
988 void (*f)(void *, void *, void *));
989void __kmpc_atomic_4(ident_t *id_ref, int gtid, void *lhs, void *rhs,
990 void (*f)(void *, void *, void *));
991void __kmpc_atomic_8(ident_t *id_ref, int gtid, void *lhs, void *rhs,
992 void (*f)(void *, void *, void *));
993void __kmpc_atomic_10(ident_t *id_ref, int gtid, void *lhs, void *rhs,
994 void (*f)(void *, void *, void *));
995void __kmpc_atomic_16(ident_t *id_ref, int gtid, void *lhs, void *rhs,
996 void (*f)(void *, void *, void *));
997void __kmpc_atomic_20(ident_t *id_ref, int gtid, void *lhs, void *rhs,
998 void (*f)(void *, void *, void *));
999void __kmpc_atomic_32(ident_t *id_ref, int gtid, void *lhs, void *rhs,
1000 void (*f)(void *, void *, void *));
1001
1002// READ, WRITE, CAPTURE are supported only on IA-32 architecture and Intel(R) 64
1003#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1004
1005// Below routines for atomic READ are listed
1006char __kmpc_atomic_fixed1_rd(ident_t *id_ref, int gtid, char *loc);
1007short __kmpc_atomic_fixed2_rd(ident_t *id_ref, int gtid, short *loc);
1008kmp_int32 __kmpc_atomic_fixed4_rd(ident_t *id_ref, int gtid, kmp_int32 *loc);
1009kmp_int64 __kmpc_atomic_fixed8_rd(ident_t *id_ref, int gtid, kmp_int64 *loc);
1010kmp_real32 __kmpc_atomic_float4_rd(ident_t *id_ref, int gtid, kmp_real32 *loc);
1011kmp_real64 __kmpc_atomic_float8_rd(ident_t *id_ref, int gtid, kmp_real64 *loc);
1012long double __kmpc_atomic_float10_rd(ident_t *id_ref, int gtid,
1013 long double *loc);
1014#if KMP_HAVE_QUAD
1015QUAD_LEGACY __kmpc_atomic_float16_rd(ident_t *id_ref, int gtid,
1016 QUAD_LEGACY *loc);
1017#endif
1018// Fix for CQ220361: cmplx4 READ will return void on Windows* OS; read value
1019// will be returned through an additional parameter
1020#if (KMP_OS_WINDOWS)
1021void __kmpc_atomic_cmplx4_rd(kmp_cmplx32 *out, ident_t *id_ref, int gtid,
1022 kmp_cmplx32 *loc);
1023#else
1024kmp_cmplx32 __kmpc_atomic_cmplx4_rd(ident_t *id_ref, int gtid,
1025 kmp_cmplx32 *loc);
1026#endif
1027kmp_cmplx64 __kmpc_atomic_cmplx8_rd(ident_t *id_ref, int gtid,
1028 kmp_cmplx64 *loc);
1029kmp_cmplx80 __kmpc_atomic_cmplx10_rd(ident_t *id_ref, int gtid,
1030 kmp_cmplx80 *loc);
1031#if KMP_HAVE_QUAD
1032CPLX128_LEG __kmpc_atomic_cmplx16_rd(ident_t *id_ref, int gtid,
1033 CPLX128_LEG *loc);
1034#if (KMP_ARCH_X86)
1035// Routines with 16-byte arguments aligned to 16-byte boundary
1036Quad_a16_t __kmpc_atomic_float16_a16_rd(ident_t *id_ref, int gtid,
1037 Quad_a16_t *loc);
1038kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_rd(ident_t *id_ref, int gtid,
1039 kmp_cmplx128_a16_t *loc);
1040#endif
1041#endif
1042
1043// Below routines for atomic WRITE are listed
1044void __kmpc_atomic_fixed1_wr(ident_t *id_ref, int gtid, char *lhs, char rhs);
1045void __kmpc_atomic_fixed2_wr(ident_t *id_ref, int gtid, short *lhs, short rhs);
1046void __kmpc_atomic_fixed4_wr(ident_t *id_ref, int gtid, kmp_int32 *lhs,
1047 kmp_int32 rhs);
1048void __kmpc_atomic_fixed8_wr(ident_t *id_ref, int gtid, kmp_int64 *lhs,
1049 kmp_int64 rhs);
1050void __kmpc_atomic_float4_wr(ident_t *id_ref, int gtid, kmp_real32 *lhs,
1051 kmp_real32 rhs);
1052void __kmpc_atomic_float8_wr(ident_t *id_ref, int gtid, kmp_real64 *lhs,
1053 kmp_real64 rhs);
1054void __kmpc_atomic_float10_wr(ident_t *id_ref, int gtid, long double *lhs,
1055 long double rhs);
1056#if KMP_HAVE_QUAD
1057void __kmpc_atomic_float16_wr(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
1058 QUAD_LEGACY rhs);
1059#endif
1060void __kmpc_atomic_cmplx4_wr(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
1061 kmp_cmplx32 rhs);
1062void __kmpc_atomic_cmplx8_wr(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
1063 kmp_cmplx64 rhs);
1064void __kmpc_atomic_cmplx10_wr(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
1065 kmp_cmplx80 rhs);
1066#if KMP_HAVE_QUAD
1067void __kmpc_atomic_cmplx16_wr(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
1068 CPLX128_LEG rhs);
1069#if (KMP_ARCH_X86)
1070// Routines with 16-byte arguments aligned to 16-byte boundary
1071void __kmpc_atomic_float16_a16_wr(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
1072 Quad_a16_t rhs);
1073void __kmpc_atomic_cmplx16_a16_wr(ident_t *id_ref, int gtid,
1074 kmp_cmplx128_a16_t *lhs,
1075 kmp_cmplx128_a16_t rhs);
1076#endif
1077#endif
1078
1079// Below routines for atomic CAPTURE are listed
1080
1081// 1-byte
1082char __kmpc_atomic_fixed1_add_cpt(ident_t *id_ref, int gtid, char *lhs,
1083 char rhs, int flag);
1084char __kmpc_atomic_fixed1_andb_cpt(ident_t *id_ref, int gtid, char *lhs,
1085 char rhs, int flag);
1086char __kmpc_atomic_fixed1_div_cpt(ident_t *id_ref, int gtid, char *lhs,
1087 char rhs, int flag);
1088unsigned char __kmpc_atomic_fixed1u_div_cpt(ident_t *id_ref, int gtid,
1089 unsigned char *lhs,
1090 unsigned char rhs, int flag);
1091char __kmpc_atomic_fixed1_mul_cpt(ident_t *id_ref, int gtid, char *lhs,
1092 char rhs, int flag);
1093char __kmpc_atomic_fixed1_orb_cpt(ident_t *id_ref, int gtid, char *lhs,
1094 char rhs, int flag);
1095char __kmpc_atomic_fixed1_shl_cpt(ident_t *id_ref, int gtid, char *lhs,
1096 char rhs, int flag);
1097char __kmpc_atomic_fixed1_shr_cpt(ident_t *id_ref, int gtid, char *lhs,
1098 char rhs, int flag);
1099unsigned char __kmpc_atomic_fixed1u_shr_cpt(ident_t *id_ref, int gtid,
1100 unsigned char *lhs,
1101 unsigned char rhs, int flag);
1102char __kmpc_atomic_fixed1_sub_cpt(ident_t *id_ref, int gtid, char *lhs,
1103 char rhs, int flag);
1104char __kmpc_atomic_fixed1_xor_cpt(ident_t *id_ref, int gtid, char *lhs,
1105 char rhs, int flag);
1106// 2-byte
1107short __kmpc_atomic_fixed2_add_cpt(ident_t *id_ref, int gtid, short *lhs,
1108 short rhs, int flag);
1109short __kmpc_atomic_fixed2_andb_cpt(ident_t *id_ref, int gtid, short *lhs,
1110 short rhs, int flag);
1111short __kmpc_atomic_fixed2_div_cpt(ident_t *id_ref, int gtid, short *lhs,
1112 short rhs, int flag);
1113unsigned short __kmpc_atomic_fixed2u_div_cpt(ident_t *id_ref, int gtid,
1114 unsigned short *lhs,
1115 unsigned short rhs, int flag);
1116short __kmpc_atomic_fixed2_mul_cpt(ident_t *id_ref, int gtid, short *lhs,
1117 short rhs, int flag);
1118short __kmpc_atomic_fixed2_orb_cpt(ident_t *id_ref, int gtid, short *lhs,
1119 short rhs, int flag);
1120short __kmpc_atomic_fixed2_shl_cpt(ident_t *id_ref, int gtid, short *lhs,
1121 short rhs, int flag);
1122short __kmpc_atomic_fixed2_shr_cpt(ident_t *id_ref, int gtid, short *lhs,
1123 short rhs, int flag);
1124unsigned short __kmpc_atomic_fixed2u_shr_cpt(ident_t *id_ref, int gtid,
1125 unsigned short *lhs,
1126 unsigned short rhs, int flag);
1127short __kmpc_atomic_fixed2_sub_cpt(ident_t *id_ref, int gtid, short *lhs,
1128 short rhs, int flag);
1129short __kmpc_atomic_fixed2_xor_cpt(ident_t *id_ref, int gtid, short *lhs,
1130 short rhs, int flag);
1131// 4-byte add / sub fixed
1132kmp_int32 __kmpc_atomic_fixed4_add_cpt(ident_t *id_ref, int gtid,
1133 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1134kmp_int32 __kmpc_atomic_fixed4_sub_cpt(ident_t *id_ref, int gtid,
1135 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1136// 4-byte add / sub float
1137kmp_real32 __kmpc_atomic_float4_add_cpt(ident_t *id_ref, int gtid,
1138 kmp_real32 *lhs, kmp_real32 rhs,
1139 int flag);
1140kmp_real32 __kmpc_atomic_float4_sub_cpt(ident_t *id_ref, int gtid,
1141 kmp_real32 *lhs, kmp_real32 rhs,
1142 int flag);
1143// 8-byte add / sub fixed
1144kmp_int64 __kmpc_atomic_fixed8_add_cpt(ident_t *id_ref, int gtid,
1145 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1146kmp_int64 __kmpc_atomic_fixed8_sub_cpt(ident_t *id_ref, int gtid,
1147 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1148// 8-byte add / sub float
1149kmp_real64 __kmpc_atomic_float8_add_cpt(ident_t *id_ref, int gtid,
1150 kmp_real64 *lhs, kmp_real64 rhs,
1151 int flag);
1152kmp_real64 __kmpc_atomic_float8_sub_cpt(ident_t *id_ref, int gtid,
1153 kmp_real64 *lhs, kmp_real64 rhs,
1154 int flag);
1155// 4-byte fixed
1156kmp_int32 __kmpc_atomic_fixed4_andb_cpt(ident_t *id_ref, int gtid,
1157 kmp_int32 *lhs, kmp_int32 rhs,
1158 int flag);
1159kmp_int32 __kmpc_atomic_fixed4_div_cpt(ident_t *id_ref, int gtid,
1160 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1161kmp_uint32 __kmpc_atomic_fixed4u_div_cpt(ident_t *id_ref, int gtid,
1162 kmp_uint32 *lhs, kmp_uint32 rhs,
1163 int flag);
1164kmp_int32 __kmpc_atomic_fixed4_mul_cpt(ident_t *id_ref, int gtid,
1165 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1166kmp_int32 __kmpc_atomic_fixed4_orb_cpt(ident_t *id_ref, int gtid,
1167 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1168kmp_int32 __kmpc_atomic_fixed4_shl_cpt(ident_t *id_ref, int gtid,
1169 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1170kmp_int32 __kmpc_atomic_fixed4_shr_cpt(ident_t *id_ref, int gtid,
1171 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1172kmp_uint32 __kmpc_atomic_fixed4u_shr_cpt(ident_t *id_ref, int gtid,
1173 kmp_uint32 *lhs, kmp_uint32 rhs,
1174 int flag);
1175kmp_int32 __kmpc_atomic_fixed4_xor_cpt(ident_t *id_ref, int gtid,
1176 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1177// 8-byte fixed
1178kmp_int64 __kmpc_atomic_fixed8_andb_cpt(ident_t *id_ref, int gtid,
1179 kmp_int64 *lhs, kmp_int64 rhs,
1180 int flag);
1181kmp_int64 __kmpc_atomic_fixed8_div_cpt(ident_t *id_ref, int gtid,
1182 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1183kmp_uint64 __kmpc_atomic_fixed8u_div_cpt(ident_t *id_ref, int gtid,
1184 kmp_uint64 *lhs, kmp_uint64 rhs,
1185 int flag);
1186kmp_int64 __kmpc_atomic_fixed8_mul_cpt(ident_t *id_ref, int gtid,
1187 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1188kmp_int64 __kmpc_atomic_fixed8_orb_cpt(ident_t *id_ref, int gtid,
1189 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1190kmp_int64 __kmpc_atomic_fixed8_shl_cpt(ident_t *id_ref, int gtid,
1191 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1192kmp_int64 __kmpc_atomic_fixed8_shr_cpt(ident_t *id_ref, int gtid,
1193 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1194kmp_uint64 __kmpc_atomic_fixed8u_shr_cpt(ident_t *id_ref, int gtid,
1195 kmp_uint64 *lhs, kmp_uint64 rhs,
1196 int flag);
1197kmp_int64 __kmpc_atomic_fixed8_xor_cpt(ident_t *id_ref, int gtid,
1198 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1199// 4-byte float
1200kmp_real32 __kmpc_atomic_float4_div_cpt(ident_t *id_ref, int gtid,
1201 kmp_real32 *lhs, kmp_real32 rhs,
1202 int flag);
1203kmp_real32 __kmpc_atomic_float4_mul_cpt(ident_t *id_ref, int gtid,
1204 kmp_real32 *lhs, kmp_real32 rhs,
1205 int flag);
1206// 8-byte float
1207kmp_real64 __kmpc_atomic_float8_div_cpt(ident_t *id_ref, int gtid,
1208 kmp_real64 *lhs, kmp_real64 rhs,
1209 int flag);
1210kmp_real64 __kmpc_atomic_float8_mul_cpt(ident_t *id_ref, int gtid,
1211 kmp_real64 *lhs, kmp_real64 rhs,
1212 int flag);
1213// 1-, 2-, 4-, 8-byte logical (&&, ||)
1214char __kmpc_atomic_fixed1_andl_cpt(ident_t *id_ref, int gtid, char *lhs,
1215 char rhs, int flag);
1216char __kmpc_atomic_fixed1_orl_cpt(ident_t *id_ref, int gtid, char *lhs,
1217 char rhs, int flag);
1218short __kmpc_atomic_fixed2_andl_cpt(ident_t *id_ref, int gtid, short *lhs,
1219 short rhs, int flag);
1220short __kmpc_atomic_fixed2_orl_cpt(ident_t *id_ref, int gtid, short *lhs,
1221 short rhs, int flag);
1222kmp_int32 __kmpc_atomic_fixed4_andl_cpt(ident_t *id_ref, int gtid,
1223 kmp_int32 *lhs, kmp_int32 rhs,
1224 int flag);
1225kmp_int32 __kmpc_atomic_fixed4_orl_cpt(ident_t *id_ref, int gtid,
1226 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1227kmp_int64 __kmpc_atomic_fixed8_andl_cpt(ident_t *id_ref, int gtid,
1228 kmp_int64 *lhs, kmp_int64 rhs,
1229 int flag);
1230kmp_int64 __kmpc_atomic_fixed8_orl_cpt(ident_t *id_ref, int gtid,
1231 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1232// MIN / MAX
1233char __kmpc_atomic_fixed1_max_cpt(ident_t *id_ref, int gtid, char *lhs,
1234 char rhs, int flag);
1235char __kmpc_atomic_fixed1_min_cpt(ident_t *id_ref, int gtid, char *lhs,
1236 char rhs, int flag);
1237short __kmpc_atomic_fixed2_max_cpt(ident_t *id_ref, int gtid, short *lhs,
1238 short rhs, int flag);
1239short __kmpc_atomic_fixed2_min_cpt(ident_t *id_ref, int gtid, short *lhs,
1240 short rhs, int flag);
1241kmp_int32 __kmpc_atomic_fixed4_max_cpt(ident_t *id_ref, int gtid,
1242 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1243kmp_int32 __kmpc_atomic_fixed4_min_cpt(ident_t *id_ref, int gtid,
1244 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1245kmp_int64 __kmpc_atomic_fixed8_max_cpt(ident_t *id_ref, int gtid,
1246 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1247kmp_int64 __kmpc_atomic_fixed8_min_cpt(ident_t *id_ref, int gtid,
1248 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1249kmp_real32 __kmpc_atomic_float4_max_cpt(ident_t *id_ref, int gtid,
1250 kmp_real32 *lhs, kmp_real32 rhs,
1251 int flag);
1252kmp_real32 __kmpc_atomic_float4_min_cpt(ident_t *id_ref, int gtid,
1253 kmp_real32 *lhs, kmp_real32 rhs,
1254 int flag);
1255kmp_real64 __kmpc_atomic_float8_max_cpt(ident_t *id_ref, int gtid,
1256 kmp_real64 *lhs, kmp_real64 rhs,
1257 int flag);
1258kmp_real64 __kmpc_atomic_float8_min_cpt(ident_t *id_ref, int gtid,
1259 kmp_real64 *lhs, kmp_real64 rhs,
1260 int flag);
1261long double __kmpc_atomic_float10_max_cpt(ident_t *id_ref, int gtid,
1262 long double *lhs, long double rhs,
1263 int flag);
1264long double __kmpc_atomic_float10_min_cpt(ident_t *id_ref, int gtid,
1265 long double *lhs, long double rhs,
1266 int flag);
1267#if KMP_HAVE_QUAD
1268QUAD_LEGACY __kmpc_atomic_float16_max_cpt(ident_t *id_ref, int gtid,
1269 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1270 int flag);
1271QUAD_LEGACY __kmpc_atomic_float16_min_cpt(ident_t *id_ref, int gtid,
1272 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1273 int flag);
1274#endif
1275// .NEQV. (same as xor)
1276char __kmpc_atomic_fixed1_neqv_cpt(ident_t *id_ref, int gtid, char *lhs,
1277 char rhs, int flag);
1278short __kmpc_atomic_fixed2_neqv_cpt(ident_t *id_ref, int gtid, short *lhs,
1279 short rhs, int flag);
1280kmp_int32 __kmpc_atomic_fixed4_neqv_cpt(ident_t *id_ref, int gtid,
1281 kmp_int32 *lhs, kmp_int32 rhs,
1282 int flag);
1283kmp_int64 __kmpc_atomic_fixed8_neqv_cpt(ident_t *id_ref, int gtid,
1284 kmp_int64 *lhs, kmp_int64 rhs,
1285 int flag);
1286// .EQV. (same as ~xor)
1287char __kmpc_atomic_fixed1_eqv_cpt(ident_t *id_ref, int gtid, char *lhs,
1288 char rhs, int flag);
1289short __kmpc_atomic_fixed2_eqv_cpt(ident_t *id_ref, int gtid, short *lhs,
1290 short rhs, int flag);
1291kmp_int32 __kmpc_atomic_fixed4_eqv_cpt(ident_t *id_ref, int gtid,
1292 kmp_int32 *lhs, kmp_int32 rhs, int flag);
1293kmp_int64 __kmpc_atomic_fixed8_eqv_cpt(ident_t *id_ref, int gtid,
1294 kmp_int64 *lhs, kmp_int64 rhs, int flag);
1295// long double type
1296long double __kmpc_atomic_float10_add_cpt(ident_t *id_ref, int gtid,
1297 long double *lhs, long double rhs,
1298 int flag);
1299long double __kmpc_atomic_float10_sub_cpt(ident_t *id_ref, int gtid,
1300 long double *lhs, long double rhs,
1301 int flag);
1302long double __kmpc_atomic_float10_mul_cpt(ident_t *id_ref, int gtid,
1303 long double *lhs, long double rhs,
1304 int flag);
1305long double __kmpc_atomic_float10_div_cpt(ident_t *id_ref, int gtid,
1306 long double *lhs, long double rhs,
1307 int flag);
1308#if KMP_HAVE_QUAD
1309// _Quad type
1310QUAD_LEGACY __kmpc_atomic_float16_add_cpt(ident_t *id_ref, int gtid,
1311 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1312 int flag);
1313QUAD_LEGACY __kmpc_atomic_float16_sub_cpt(ident_t *id_ref, int gtid,
1314 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1315 int flag);
1316QUAD_LEGACY __kmpc_atomic_float16_mul_cpt(ident_t *id_ref, int gtid,
1317 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1318 int flag);
1319QUAD_LEGACY __kmpc_atomic_float16_div_cpt(ident_t *id_ref, int gtid,
1320 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1321 int flag);
1322#endif
1323// routines for complex types
1324// Workaround for cmplx4 routines - return void; captured value is returned via
1325// the argument
1326void __kmpc_atomic_cmplx4_add_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
1327 kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
1328void __kmpc_atomic_cmplx4_sub_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
1329 kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
1330void __kmpc_atomic_cmplx4_mul_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
1331 kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
1332void __kmpc_atomic_cmplx4_div_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
1333 kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
1334
1335kmp_cmplx64 __kmpc_atomic_cmplx8_add_cpt(ident_t *id_ref, int gtid,
1336 kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
1337 int flag);
1338kmp_cmplx64 __kmpc_atomic_cmplx8_sub_cpt(ident_t *id_ref, int gtid,
1339 kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
1340 int flag);
1341kmp_cmplx64 __kmpc_atomic_cmplx8_mul_cpt(ident_t *id_ref, int gtid,
1342 kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
1343 int flag);
1344kmp_cmplx64 __kmpc_atomic_cmplx8_div_cpt(ident_t *id_ref, int gtid,
1345 kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
1346 int flag);
1347kmp_cmplx80 __kmpc_atomic_cmplx10_add_cpt(ident_t *id_ref, int gtid,
1348 kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
1349 int flag);
1350kmp_cmplx80 __kmpc_atomic_cmplx10_sub_cpt(ident_t *id_ref, int gtid,
1351 kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
1352 int flag);
1353kmp_cmplx80 __kmpc_atomic_cmplx10_mul_cpt(ident_t *id_ref, int gtid,
1354 kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
1355 int flag);
1356kmp_cmplx80 __kmpc_atomic_cmplx10_div_cpt(ident_t *id_ref, int gtid,
1357 kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
1358 int flag);
1359#if KMP_HAVE_QUAD
1360CPLX128_LEG __kmpc_atomic_cmplx16_add_cpt(ident_t *id_ref, int gtid,
1361 CPLX128_LEG *lhs, CPLX128_LEG rhs,
1362 int flag);
1363CPLX128_LEG __kmpc_atomic_cmplx16_sub_cpt(ident_t *id_ref, int gtid,
1364 CPLX128_LEG *lhs, CPLX128_LEG rhs,
1365 int flag);
1366CPLX128_LEG __kmpc_atomic_cmplx16_mul_cpt(ident_t *id_ref, int gtid,
1367 CPLX128_LEG *lhs, CPLX128_LEG rhs,
1368 int flag);
1369CPLX128_LEG __kmpc_atomic_cmplx16_div_cpt(ident_t *id_ref, int gtid,
1370 CPLX128_LEG *lhs, CPLX128_LEG rhs,
1371 int flag);
1372#if (KMP_ARCH_X86)
1373// Routines with 16-byte arguments aligned to 16-byte boundary
1374Quad_a16_t __kmpc_atomic_float16_add_a16_cpt(ident_t *id_ref, int gtid,
1375 Quad_a16_t *lhs, Quad_a16_t rhs,
1376 int flag);
1377Quad_a16_t __kmpc_atomic_float16_sub_a16_cpt(ident_t *id_ref, int gtid,
1378 Quad_a16_t *lhs, Quad_a16_t rhs,
1379 int flag);
1380Quad_a16_t __kmpc_atomic_float16_mul_a16_cpt(ident_t *id_ref, int gtid,
1381 Quad_a16_t *lhs, Quad_a16_t rhs,
1382 int flag);
1383Quad_a16_t __kmpc_atomic_float16_div_a16_cpt(ident_t *id_ref, int gtid,
1384 Quad_a16_t *lhs, Quad_a16_t rhs,
1385 int flag);
1386Quad_a16_t __kmpc_atomic_float16_max_a16_cpt(ident_t *id_ref, int gtid,
1387 Quad_a16_t *lhs, Quad_a16_t rhs,
1388 int flag);
1389Quad_a16_t __kmpc_atomic_float16_min_a16_cpt(ident_t *id_ref, int gtid,
1390 Quad_a16_t *lhs, Quad_a16_t rhs,
1391 int flag);
1392kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_add_a16_cpt(ident_t *id_ref, int gtid,
1393 kmp_cmplx128_a16_t *lhs,
1394 kmp_cmplx128_a16_t rhs,
1395 int flag);
1396kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_sub_a16_cpt(ident_t *id_ref, int gtid,
1397 kmp_cmplx128_a16_t *lhs,
1398 kmp_cmplx128_a16_t rhs,
1399 int flag);
1400kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_mul_a16_cpt(ident_t *id_ref, int gtid,
1401 kmp_cmplx128_a16_t *lhs,
1402 kmp_cmplx128_a16_t rhs,
1403 int flag);
1404kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_div_a16_cpt(ident_t *id_ref, int gtid,
1405 kmp_cmplx128_a16_t *lhs,
1406 kmp_cmplx128_a16_t rhs,
1407 int flag);
1408#endif
1409#endif
1410
1411void __kmpc_atomic_start(void);
1412void __kmpc_atomic_end(void);
1413
1414// OpenMP 4.0: v = x = expr binop x; { v = x; x = expr binop x; } { x = expr
1415// binop x; v = x; } for non-commutative operations.
1416
1417char __kmpc_atomic_fixed1_sub_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
1418 char rhs, int flag);
1419char __kmpc_atomic_fixed1_div_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
1420 char rhs, int flag);
1421unsigned char __kmpc_atomic_fixed1u_div_cpt_rev(ident_t *id_ref, int gtid,
1422 unsigned char *lhs,
1423 unsigned char rhs, int flag);
1424char __kmpc_atomic_fixed1_shl_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
1425 char rhs, int flag);
1426char __kmpc_atomic_fixed1_shr_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
1427 char rhs, int flag);
1428unsigned char __kmpc_atomic_fixed1u_shr_cpt_rev(ident_t *id_ref, int gtid,
1429 unsigned char *lhs,
1430 unsigned char rhs, int flag);
1431short __kmpc_atomic_fixed2_sub_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
1432 short rhs, int flag);
1433short __kmpc_atomic_fixed2_div_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
1434 short rhs, int flag);
1435unsigned short __kmpc_atomic_fixed2u_div_cpt_rev(ident_t *id_ref, int gtid,
1436 unsigned short *lhs,
1437 unsigned short rhs, int flag);
1438short __kmpc_atomic_fixed2_shl_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
1439 short rhs, int flag);
1440short __kmpc_atomic_fixed2_shr_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
1441 short rhs, int flag);
1442unsigned short __kmpc_atomic_fixed2u_shr_cpt_rev(ident_t *id_ref, int gtid,
1443 unsigned short *lhs,
1444 unsigned short rhs, int flag);
1445kmp_int32 __kmpc_atomic_fixed4_sub_cpt_rev(ident_t *id_ref, int gtid,
1446 kmp_int32 *lhs, kmp_int32 rhs,
1447 int flag);
1448kmp_int32 __kmpc_atomic_fixed4_div_cpt_rev(ident_t *id_ref, int gtid,
1449 kmp_int32 *lhs, kmp_int32 rhs,
1450 int flag);
1451kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_rev(ident_t *id_ref, int gtid,
1452 kmp_uint32 *lhs, kmp_uint32 rhs,
1453 int flag);
1454kmp_int32 __kmpc_atomic_fixed4_shl_cpt_rev(ident_t *id_ref, int gtid,
1455 kmp_int32 *lhs, kmp_int32 rhs,
1456 int flag);
1457kmp_int32 __kmpc_atomic_fixed4_shr_cpt_rev(ident_t *id_ref, int gtid,
1458 kmp_int32 *lhs, kmp_int32 rhs,
1459 int flag);
1460kmp_uint32 __kmpc_atomic_fixed4u_shr_cpt_rev(ident_t *id_ref, int gtid,
1461 kmp_uint32 *lhs, kmp_uint32 rhs,
1462 int flag);
1463kmp_int64 __kmpc_atomic_fixed8_sub_cpt_rev(ident_t *id_ref, int gtid,
1464 kmp_int64 *lhs, kmp_int64 rhs,
1465 int flag);
1466kmp_int64 __kmpc_atomic_fixed8_div_cpt_rev(ident_t *id_ref, int gtid,
1467 kmp_int64 *lhs, kmp_int64 rhs,
1468 int flag);
1469kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_rev(ident_t *id_ref, int gtid,
1470 kmp_uint64 *lhs, kmp_uint64 rhs,
1471 int flag);
1472kmp_int64 __kmpc_atomic_fixed8_shl_cpt_rev(ident_t *id_ref, int gtid,
1473 kmp_int64 *lhs, kmp_int64 rhs,
1474 int flag);
1475kmp_int64 __kmpc_atomic_fixed8_shr_cpt_rev(ident_t *id_ref, int gtid,
1476 kmp_int64 *lhs, kmp_int64 rhs,
1477 int flag);
1478kmp_uint64 __kmpc_atomic_fixed8u_shr_cpt_rev(ident_t *id_ref, int gtid,
1479 kmp_uint64 *lhs, kmp_uint64 rhs,
1480 int flag);
1481float __kmpc_atomic_float4_sub_cpt_rev(ident_t *id_ref, int gtid, float *lhs,
1482 float rhs, int flag);
1483float __kmpc_atomic_float4_div_cpt_rev(ident_t *id_ref, int gtid, float *lhs,
1484 float rhs, int flag);
1485double __kmpc_atomic_float8_sub_cpt_rev(ident_t *id_ref, int gtid, double *lhs,
1486 double rhs, int flag);
1487double __kmpc_atomic_float8_div_cpt_rev(ident_t *id_ref, int gtid, double *lhs,
1488 double rhs, int flag);
1489long double __kmpc_atomic_float10_sub_cpt_rev(ident_t *id_ref, int gtid,
1490 long double *lhs, long double rhs,
1491 int flag);
1492long double __kmpc_atomic_float10_div_cpt_rev(ident_t *id_ref, int gtid,
1493 long double *lhs, long double rhs,
1494 int flag);
1495#if KMP_HAVE_QUAD
1496QUAD_LEGACY __kmpc_atomic_float16_sub_cpt_rev(ident_t *id_ref, int gtid,
1497 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1498 int flag);
1499QUAD_LEGACY __kmpc_atomic_float16_div_cpt_rev(ident_t *id_ref, int gtid,
1500 QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
1501 int flag);
1502#endif
1503// Workaround for cmplx4 routines - return void; captured value is returned via
1504// the argument
1505void __kmpc_atomic_cmplx4_sub_cpt_rev(ident_t *id_ref, int gtid,
1506 kmp_cmplx32 *lhs, kmp_cmplx32 rhs,
1507 kmp_cmplx32 *out, int flag);
1508void __kmpc_atomic_cmplx4_div_cpt_rev(ident_t *id_ref, int gtid,
1509 kmp_cmplx32 *lhs, kmp_cmplx32 rhs,
1510 kmp_cmplx32 *out, int flag);
1511kmp_cmplx64 __kmpc_atomic_cmplx8_sub_cpt_rev(ident_t *id_ref, int gtid,
1512 kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
1513 int flag);
1514kmp_cmplx64 __kmpc_atomic_cmplx8_div_cpt_rev(ident_t *id_ref, int gtid,
1515 kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
1516 int flag);
1517kmp_cmplx80 __kmpc_atomic_cmplx10_sub_cpt_rev(ident_t *id_ref, int gtid,
1518 kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
1519 int flag);
1520kmp_cmplx80 __kmpc_atomic_cmplx10_div_cpt_rev(ident_t *id_ref, int gtid,
1521 kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
1522 int flag);
1523#if KMP_HAVE_QUAD
1524CPLX128_LEG __kmpc_atomic_cmplx16_sub_cpt_rev(ident_t *id_ref, int gtid,
1525 CPLX128_LEG *lhs, CPLX128_LEG rhs,
1526 int flag);
1527CPLX128_LEG __kmpc_atomic_cmplx16_div_cpt_rev(ident_t *id_ref, int gtid,
1528 CPLX128_LEG *lhs, CPLX128_LEG rhs,
1529 int flag);
1530#if (KMP_ARCH_X86)
1531Quad_a16_t __kmpc_atomic_float16_sub_a16_cpt_rev(ident_t *id_ref, int gtid,
1532 Quad_a16_t *lhs,
1533 Quad_a16_t rhs, int flag);
1534Quad_a16_t __kmpc_atomic_float16_div_a16_cpt_rev(ident_t *id_ref, int gtid,
1535 Quad_a16_t *lhs,
1536 Quad_a16_t rhs, int flag);
1537kmp_cmplx128_a16_t
1538__kmpc_atomic_cmplx16_sub_a16_cpt_rev(ident_t *id_ref, int gtid,
1539 kmp_cmplx128_a16_t *lhs,
1540 kmp_cmplx128_a16_t rhs, int flag);
1541kmp_cmplx128_a16_t
1542__kmpc_atomic_cmplx16_div_a16_cpt_rev(ident_t *id_ref, int gtid,
1543 kmp_cmplx128_a16_t *lhs,
1544 kmp_cmplx128_a16_t rhs, int flag);
1545#endif
1546#endif
1547
1548// OpenMP 4.0 Capture-write (swap): {v = x; x = expr;}
1549char __kmpc_atomic_fixed1_swp(ident_t *id_ref, int gtid, char *lhs, char rhs);
1550short __kmpc_atomic_fixed2_swp(ident_t *id_ref, int gtid, short *lhs,
1551 short rhs);
1552kmp_int32 __kmpc_atomic_fixed4_swp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
1553 kmp_int32 rhs);
1554kmp_int64 __kmpc_atomic_fixed8_swp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
1555 kmp_int64 rhs);
1556float __kmpc_atomic_float4_swp(ident_t *id_ref, int gtid, float *lhs,
1557 float rhs);
1558double __kmpc_atomic_float8_swp(ident_t *id_ref, int gtid, double *lhs,
1559 double rhs);
1560long double __kmpc_atomic_float10_swp(ident_t *id_ref, int gtid,
1561 long double *lhs, long double rhs);
1562#if KMP_HAVE_QUAD
1563QUAD_LEGACY __kmpc_atomic_float16_swp(ident_t *id_ref, int gtid,
1564 QUAD_LEGACY *lhs, QUAD_LEGACY rhs);
1565#endif
1566// !!! TODO: check if we need a workaround here
1567void __kmpc_atomic_cmplx4_swp(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
1568 kmp_cmplx32 rhs, kmp_cmplx32 *out);
1569// kmp_cmplx32 __kmpc_atomic_cmplx4_swp( ident_t *id_ref, int gtid,
1570// kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
1571
1572kmp_cmplx64 __kmpc_atomic_cmplx8_swp(ident_t *id_ref, int gtid,
1573 kmp_cmplx64 *lhs, kmp_cmplx64 rhs);
1574kmp_cmplx80 __kmpc_atomic_cmplx10_swp(ident_t *id_ref, int gtid,
1575 kmp_cmplx80 *lhs, kmp_cmplx80 rhs);
1576#if KMP_HAVE_QUAD
1577CPLX128_LEG __kmpc_atomic_cmplx16_swp(ident_t *id_ref, int gtid,
1578 CPLX128_LEG *lhs, CPLX128_LEG rhs);
1579#if (KMP_ARCH_X86)
1580Quad_a16_t __kmpc_atomic_float16_a16_swp(ident_t *id_ref, int gtid,
1581 Quad_a16_t *lhs, Quad_a16_t rhs);
1582kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_swp(ident_t *id_ref, int gtid,
1583 kmp_cmplx128_a16_t *lhs,
1584 kmp_cmplx128_a16_t rhs);
1585#endif
1586#endif
1587
1588// Capture routines for mixed types (RHS=float16)
1589#if KMP_HAVE_QUAD
1590
1591char __kmpc_atomic_fixed1_add_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
1592 _Quad rhs, int flag);
1593char __kmpc_atomic_fixed1_sub_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
1594 _Quad rhs, int flag);
1595char __kmpc_atomic_fixed1_mul_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
1596 _Quad rhs, int flag);
1597char __kmpc_atomic_fixed1_div_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
1598 _Quad rhs, int flag);
1599unsigned char __kmpc_atomic_fixed1u_add_cpt_fp(ident_t *id_ref, int gtid,
1600 unsigned char *lhs, _Quad rhs,
1601 int flag);
1602unsigned char __kmpc_atomic_fixed1u_sub_cpt_fp(ident_t *id_ref, int gtid,
1603 unsigned char *lhs, _Quad rhs,
1604 int flag);
1605unsigned char __kmpc_atomic_fixed1u_mul_cpt_fp(ident_t *id_ref, int gtid,
1606 unsigned char *lhs, _Quad rhs,
1607 int flag);
1608unsigned char __kmpc_atomic_fixed1u_div_cpt_fp(ident_t *id_ref, int gtid,
1609 unsigned char *lhs, _Quad rhs,
1610 int flag);
1611
1612short __kmpc_atomic_fixed2_add_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
1613 _Quad rhs, int flag);
1614short __kmpc_atomic_fixed2_sub_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
1615 _Quad rhs, int flag);
1616short __kmpc_atomic_fixed2_mul_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
1617 _Quad rhs, int flag);
1618short __kmpc_atomic_fixed2_div_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
1619 _Quad rhs, int flag);
1620unsigned short __kmpc_atomic_fixed2u_add_cpt_fp(ident_t *id_ref, int gtid,
1621 unsigned short *lhs, _Quad rhs,
1622 int flag);
1623unsigned short __kmpc_atomic_fixed2u_sub_cpt_fp(ident_t *id_ref, int gtid,
1624 unsigned short *lhs, _Quad rhs,
1625 int flag);
1626unsigned short __kmpc_atomic_fixed2u_mul_cpt_fp(ident_t *id_ref, int gtid,
1627 unsigned short *lhs, _Quad rhs,
1628 int flag);
1629unsigned short __kmpc_atomic_fixed2u_div_cpt_fp(ident_t *id_ref, int gtid,
1630 unsigned short *lhs, _Quad rhs,
1631 int flag);
1632
1633kmp_int32 __kmpc_atomic_fixed4_add_cpt_fp(ident_t *id_ref, int gtid,
1634 kmp_int32 *lhs, _Quad rhs, int flag);
1635kmp_int32 __kmpc_atomic_fixed4_sub_cpt_fp(ident_t *id_ref, int gtid,
1636 kmp_int32 *lhs, _Quad rhs, int flag);
1637kmp_int32 __kmpc_atomic_fixed4_mul_cpt_fp(ident_t *id_ref, int gtid,
1638 kmp_int32 *lhs, _Quad rhs, int flag);
1639kmp_int32 __kmpc_atomic_fixed4_div_cpt_fp(ident_t *id_ref, int gtid,
1640 kmp_int32 *lhs, _Quad rhs, int flag);
1641kmp_uint32 __kmpc_atomic_fixed4u_add_cpt_fp(ident_t *id_ref, int gtid,
1642 kmp_uint32 *lhs, _Quad rhs,
1643 int flag);
1644kmp_uint32 __kmpc_atomic_fixed4u_sub_cpt_fp(ident_t *id_ref, int gtid,
1645 kmp_uint32 *lhs, _Quad rhs,
1646 int flag);
1647kmp_uint32 __kmpc_atomic_fixed4u_mul_cpt_fp(ident_t *id_ref, int gtid,
1648 kmp_uint32 *lhs, _Quad rhs,
1649 int flag);
1650kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_fp(ident_t *id_ref, int gtid,
1651 kmp_uint32 *lhs, _Quad rhs,
1652 int flag);
1653
1654kmp_int64 __kmpc_atomic_fixed8_add_cpt_fp(ident_t *id_ref, int gtid,
1655 kmp_int64 *lhs, _Quad rhs, int flag);
1656kmp_int64 __kmpc_atomic_fixed8_sub_cpt_fp(ident_t *id_ref, int gtid,
1657 kmp_int64 *lhs, _Quad rhs, int flag);
1658kmp_int64 __kmpc_atomic_fixed8_mul_cpt_fp(ident_t *id_ref, int gtid,
1659 kmp_int64 *lhs, _Quad rhs, int flag);
1660kmp_int64 __kmpc_atomic_fixed8_div_cpt_fp(ident_t *id_ref, int gtid,
1661 kmp_int64 *lhs, _Quad rhs, int flag);
1662kmp_uint64 __kmpc_atomic_fixed8u_add_cpt_fp(ident_t *id_ref, int gtid,
1663 kmp_uint64 *lhs, _Quad rhs,
1664 int flag);
1665kmp_uint64 __kmpc_atomic_fixed8u_sub_cpt_fp(ident_t *id_ref, int gtid,
1666 kmp_uint64 *lhs, _Quad rhs,
1667 int flag);
1668kmp_uint64 __kmpc_atomic_fixed8u_mul_cpt_fp(ident_t *id_ref, int gtid,
1669 kmp_uint64 *lhs, _Quad rhs,
1670 int flag);
1671kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_fp(ident_t *id_ref, int gtid,
1672 kmp_uint64 *lhs, _Quad rhs,
1673 int flag);
1674
1675float __kmpc_atomic_float4_add_cpt_fp(ident_t *id_ref, int gtid,
1676 kmp_real32 *lhs, _Quad rhs, int flag);
1677float __kmpc_atomic_float4_sub_cpt_fp(ident_t *id_ref, int gtid,
1678 kmp_real32 *lhs, _Quad rhs, int flag);
1679float __kmpc_atomic_float4_mul_cpt_fp(ident_t *id_ref, int gtid,
1680 kmp_real32 *lhs, _Quad rhs, int flag);
1681float __kmpc_atomic_float4_div_cpt_fp(ident_t *id_ref, int gtid,
1682 kmp_real32 *lhs, _Quad rhs, int flag);
1683
1684double __kmpc_atomic_float8_add_cpt_fp(ident_t *id_ref, int gtid,
1685 kmp_real64 *lhs, _Quad rhs, int flag);
1686double __kmpc_atomic_float8_sub_cpt_fp(ident_t *id_ref, int gtid,
1687 kmp_real64 *lhs, _Quad rhs, int flag);
1688double __kmpc_atomic_float8_mul_cpt_fp(ident_t *id_ref, int gtid,
1689 kmp_real64 *lhs, _Quad rhs, int flag);
1690double __kmpc_atomic_float8_div_cpt_fp(ident_t *id_ref, int gtid,
1691 kmp_real64 *lhs, _Quad rhs, int flag);
1692
1693long double __kmpc_atomic_float10_add_cpt_fp(ident_t *id_ref, int gtid,
1694 long double *lhs, _Quad rhs,
1695 int flag);
1696long double __kmpc_atomic_float10_sub_cpt_fp(ident_t *id_ref, int gtid,
1697 long double *lhs, _Quad rhs,
1698 int flag);
1699long double __kmpc_atomic_float10_mul_cpt_fp(ident_t *id_ref, int gtid,
1700 long double *lhs, _Quad rhs,
1701 int flag);
1702long double __kmpc_atomic_float10_div_cpt_fp(ident_t *id_ref, int gtid,
1703 long double *lhs, _Quad rhs,
1704 int flag);
1705
1706char __kmpc_atomic_fixed1_sub_cpt_rev_fp(ident_t *id_ref, int gtid, char *lhs,
1707 _Quad rhs, int flag);
1708unsigned char __kmpc_atomic_fixed1u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1709 unsigned char *lhs,
1710 _Quad rhs, int flag);
1711char __kmpc_atomic_fixed1_div_cpt_rev_fp(ident_t *id_ref, int gtid, char *lhs,
1712 _Quad rhs, int flag);
1713unsigned char __kmpc_atomic_fixed1u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1714 unsigned char *lhs,
1715 _Quad rhs, int flag);
1716short __kmpc_atomic_fixed2_sub_cpt_rev_fp(ident_t *id_ref, int gtid, short *lhs,
1717 _Quad rhs, int flag);
1718unsigned short __kmpc_atomic_fixed2u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1719 unsigned short *lhs,
1720 _Quad rhs, int flag);
1721short __kmpc_atomic_fixed2_div_cpt_rev_fp(ident_t *id_ref, int gtid, short *lhs,
1722 _Quad rhs, int flag);
1723unsigned short __kmpc_atomic_fixed2u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1724 unsigned short *lhs,
1725 _Quad rhs, int flag);
1726kmp_int32 __kmpc_atomic_fixed4_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1727 kmp_int32 *lhs, _Quad rhs,
1728 int flag);
1729kmp_uint32 __kmpc_atomic_fixed4u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1730 kmp_uint32 *lhs, _Quad rhs,
1731 int flag);
1732kmp_int32 __kmpc_atomic_fixed4_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1733 kmp_int32 *lhs, _Quad rhs,
1734 int flag);
1735kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1736 kmp_uint32 *lhs, _Quad rhs,
1737 int flag);
1738kmp_int64 __kmpc_atomic_fixed8_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1739 kmp_int64 *lhs, _Quad rhs,
1740 int flag);
1741kmp_uint64 __kmpc_atomic_fixed8u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1742 kmp_uint64 *lhs, _Quad rhs,
1743 int flag);
1744kmp_int64 __kmpc_atomic_fixed8_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1745 kmp_int64 *lhs, _Quad rhs,
1746 int flag);
1747kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1748 kmp_uint64 *lhs, _Quad rhs,
1749 int flag);
1750float __kmpc_atomic_float4_sub_cpt_rev_fp(ident_t *id_ref, int gtid, float *lhs,
1751 _Quad rhs, int flag);
1752float __kmpc_atomic_float4_div_cpt_rev_fp(ident_t *id_ref, int gtid, float *lhs,
1753 _Quad rhs, int flag);
1754double __kmpc_atomic_float8_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1755 double *lhs, _Quad rhs, int flag);
1756double __kmpc_atomic_float8_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1757 double *lhs, _Quad rhs, int flag);
1758long double __kmpc_atomic_float10_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
1759 long double *lhs, _Quad rhs,
1760 int flag);
1761long double __kmpc_atomic_float10_div_cpt_rev_fp(ident_t *id_ref, int gtid,
1762 long double *lhs, _Quad rhs,
1763 int flag);
1764
1765#endif // KMP_HAVE_QUAD
1766
1767// End of OpenMP 4.0 capture
1768
1769// OpenMP 5.1 compare and swap
1770/*
1771 __kmpc_atomic_bool_1_cas
1772 __kmpc_atomic_bool_2_cas
1773 __kmpc_atomic_bool_4_cas
1774 __kmpc_atomic_bool_8_cas
1775 __kmpc_atomic_val_1_cas
1776 __kmpc_atomic_val_2_cas
1777 __kmpc_atomic_val_4_cas
1778 __kmpc_atomic_val_8_cas
1779 __kmpc_atomic_bool_1_cas_cpt
1780 __kmpc_atomic_bool_2_cas_cpt
1781 __kmpc_atomic_bool_4_cas_cpt
1782 __kmpc_atomic_bool_8_cas_cpt
1783 __kmpc_atomic_val_1_cas_cpt
1784 __kmpc_atomic_val_2_cas_cpt
1785 __kmpc_atomic_val_4_cas_cpt
1786 __kmpc_atomic_val_8_cas_cpt
1787*/
1788// In all interfaces of CAS (Compare And Swap):
1789// r is the boolean result of comparison
1790// x is memory location to operate on
1791// e is expected (old) value
1792// d is desired (new) value
1793// pv is pointer to captured value v whose location may coincide with e
1794
1795// { r = x == e; if(r) { x = d; } }
1796// functions return result of comparison
1797bool __kmpc_atomic_bool_1_cas(ident_t *loc, int gtid, char *x, char e, char d);
1798bool __kmpc_atomic_bool_2_cas(ident_t *loc, int gtid, short *x, short e,
1799 short d);
1800bool __kmpc_atomic_bool_4_cas(ident_t *loc, int gtid, kmp_int32 *x, kmp_int32 e,
1801 kmp_int32 d);
1802bool __kmpc_atomic_bool_8_cas(ident_t *loc, int gtid, kmp_int64 *x, kmp_int64 e,
1803 kmp_int64 d);
1804
1805// { v = x; if (x == e) { x = d; } }
1806// functions return old value
1807char __kmpc_atomic_val_1_cas(ident_t *loc, int gtid, char *x, char e, char d);
1808short __kmpc_atomic_val_2_cas(ident_t *loc, int gtid, short *x, short e,
1809 short d);
1810kmp_int32 __kmpc_atomic_val_4_cas(ident_t *loc, int gtid, kmp_int32 *x,
1811 kmp_int32 e, kmp_int32 d);
1812kmp_int64 __kmpc_atomic_val_8_cas(ident_t *loc, int gtid, kmp_int64 *x,
1813 kmp_int64 e, kmp_int64 d);
1814
1815// { r = x == e; if(r) { x = d; } else { v = x; } }
1816// v gets old value if comparison failed, untouched otherwise
1817// functions return result of comparison
1818bool __kmpc_atomic_bool_1_cas_cpt(ident_t *loc, int gtid, char *x, char e,
1819 char d, char *pv);
1820bool __kmpc_atomic_bool_2_cas_cpt(ident_t *loc, int gtid, short *x, short e,
1821 short d, short *pv);
1822bool __kmpc_atomic_bool_4_cas_cpt(ident_t *loc, int gtid, kmp_int32 *x,
1823 kmp_int32 e, kmp_int32 d, kmp_int32 *pv);
1824bool __kmpc_atomic_bool_8_cas_cpt(ident_t *loc, int gtid, kmp_int64 *x,
1825 kmp_int64 e, kmp_int64 d, kmp_int64 *pv);
1826
1827// { if (x == e) { x = d; }; v = x; }
1828// v gets old value if comparison failed, new value otherwise
1829// functions return old value
1830char __kmpc_atomic_val_1_cas_cpt(ident_t *loc, int gtid, char *x, char e,
1831 char d, char *pv);
1832short __kmpc_atomic_val_2_cas_cpt(ident_t *loc, int gtid, short *x, short e,
1833 short d, short *pv);
1834kmp_int32 __kmpc_atomic_val_4_cas_cpt(ident_t *loc, int gtid, kmp_int32 *x,
1835 kmp_int32 e, kmp_int32 d, kmp_int32 *pv);
1836kmp_int64 __kmpc_atomic_val_8_cas_cpt(ident_t *loc, int gtid, kmp_int64 *x,
1837 kmp_int64 e, kmp_int64 d, kmp_int64 *pv);
1838
1839// End OpenMP 5.1 compare + capture
1840
1841#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
1842
1843/* ------------------------------------------------------------------------ */
1844
1845#ifdef __cplusplus
1846} // extern "C"
1847#endif
1848
1849#endif /* KMP_ATOMIC_H */
1850
1851// end of file
Definition: kmp.h:234