xref: /freebsd/contrib/llvm-project/openmp/runtime/src/kmp_atomic.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10b57cec5SDimitry Andric /*
20b57cec5SDimitry Andric  * kmp_atomic.h - ATOMIC header file
30b57cec5SDimitry Andric  */
40b57cec5SDimitry Andric 
50b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
80b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
90b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef KMP_ATOMIC_H
140b57cec5SDimitry Andric #define KMP_ATOMIC_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "kmp_lock.h"
170b57cec5SDimitry Andric #include "kmp_os.h"
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric #if OMPT_SUPPORT
200b57cec5SDimitry Andric #include "ompt-specific.h"
210b57cec5SDimitry Andric #endif
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric // C++ build port.
240b57cec5SDimitry Andric // Intel compiler does not support _Complex datatype on win.
250b57cec5SDimitry Andric // Intel compiler supports _Complex datatype on lin and mac.
260b57cec5SDimitry Andric // On the other side, there is a problem of stack alignment on lin_32 and mac_32
270b57cec5SDimitry Andric // if the rhs is cmplx80 or cmplx128 typedef'ed datatype.
280b57cec5SDimitry Andric // The decision is: to use compiler supported _Complex type on lin and mac,
290b57cec5SDimitry Andric //                  to use typedef'ed types on win.
300b57cec5SDimitry Andric // Condition for WIN64 was modified in anticipation of 10.1 build compiler.
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric #if defined(__cplusplus) && (KMP_OS_WINDOWS)
330b57cec5SDimitry Andric // create shortcuts for c99 complex types
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric // Visual Studio cannot have function parameters that have the
360b57cec5SDimitry Andric // align __declspec attribute, so we must remove it. (Compiler Error C2719)
370b57cec5SDimitry Andric #if KMP_COMPILER_MSVC
380b57cec5SDimitry Andric #undef KMP_DO_ALIGN
390b57cec5SDimitry Andric #define KMP_DO_ALIGN(alignment) /* Nothing */
400b57cec5SDimitry Andric #endif
410b57cec5SDimitry Andric 
42e8d8bef9SDimitry Andric #if defined(_MSC_VER) && (_MSC_VER < 1600) && defined(_DEBUG)
430b57cec5SDimitry Andric // Workaround for the problem of _DebugHeapTag unresolved external.
440b57cec5SDimitry Andric // This problem prevented to use our static debug library for C tests
450b57cec5SDimitry Andric // compiled with /MDd option (the library itself built with /MTd),
460b57cec5SDimitry Andric #undef _DEBUG
470b57cec5SDimitry Andric #define _DEBUG_TEMPORARILY_UNSET_
480b57cec5SDimitry Andric #endif
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric #include <complex>
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric template <typename type_lhs, typename type_rhs>
__kmp_lhs_div_rhs(const std::complex<type_lhs> & lhs,const std::complex<type_rhs> & rhs)530b57cec5SDimitry Andric std::complex<type_lhs> __kmp_lhs_div_rhs(const std::complex<type_lhs> &lhs,
540b57cec5SDimitry Andric                                          const std::complex<type_rhs> &rhs) {
550b57cec5SDimitry Andric   type_lhs a = lhs.real();
560b57cec5SDimitry Andric   type_lhs b = lhs.imag();
570b57cec5SDimitry Andric   type_rhs c = rhs.real();
580b57cec5SDimitry Andric   type_rhs d = rhs.imag();
590b57cec5SDimitry Andric   type_rhs den = c * c + d * d;
600b57cec5SDimitry Andric   type_rhs r = (a * c + b * d);
610b57cec5SDimitry Andric   type_rhs i = (b * c - a * d);
620b57cec5SDimitry Andric   std::complex<type_lhs> ret(r / den, i / den);
630b57cec5SDimitry Andric   return ret;
640b57cec5SDimitry Andric }
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric // complex8
670b57cec5SDimitry Andric struct __kmp_cmplx64_t : std::complex<double> {
680b57cec5SDimitry Andric 
__kmp_cmplx64_t__kmp_cmplx64_t690b57cec5SDimitry Andric   __kmp_cmplx64_t() : std::complex<double>() {}
700b57cec5SDimitry Andric 
__kmp_cmplx64_t__kmp_cmplx64_t710b57cec5SDimitry Andric   __kmp_cmplx64_t(const std::complex<double> &cd) : std::complex<double>(cd) {}
720b57cec5SDimitry Andric 
730b57cec5SDimitry Andric   void operator/=(const __kmp_cmplx64_t &rhs) {
740b57cec5SDimitry Andric     std::complex<double> lhs = *this;
750b57cec5SDimitry Andric     *this = __kmp_lhs_div_rhs(lhs, rhs);
760b57cec5SDimitry Andric   }
770b57cec5SDimitry Andric 
780b57cec5SDimitry Andric   __kmp_cmplx64_t operator/(const __kmp_cmplx64_t &rhs) {
790b57cec5SDimitry Andric     std::complex<double> lhs = *this;
800b57cec5SDimitry Andric     return __kmp_lhs_div_rhs(lhs, rhs);
810b57cec5SDimitry Andric   }
820b57cec5SDimitry Andric };
830b57cec5SDimitry Andric typedef struct __kmp_cmplx64_t kmp_cmplx64;
840b57cec5SDimitry Andric 
850b57cec5SDimitry Andric // complex4
860b57cec5SDimitry Andric struct __kmp_cmplx32_t : std::complex<float> {
870b57cec5SDimitry Andric 
__kmp_cmplx32_t__kmp_cmplx32_t880b57cec5SDimitry Andric   __kmp_cmplx32_t() : std::complex<float>() {}
890b57cec5SDimitry Andric 
__kmp_cmplx32_t__kmp_cmplx32_t900b57cec5SDimitry Andric   __kmp_cmplx32_t(const std::complex<float> &cf) : std::complex<float>(cf) {}
910b57cec5SDimitry Andric 
920b57cec5SDimitry Andric   __kmp_cmplx32_t operator+(const __kmp_cmplx32_t &b) {
930b57cec5SDimitry Andric     std::complex<float> lhs = *this;
940b57cec5SDimitry Andric     std::complex<float> rhs = b;
950b57cec5SDimitry Andric     return (lhs + rhs);
960b57cec5SDimitry Andric   }
970b57cec5SDimitry Andric   __kmp_cmplx32_t operator-(const __kmp_cmplx32_t &b) {
980b57cec5SDimitry Andric     std::complex<float> lhs = *this;
990b57cec5SDimitry Andric     std::complex<float> rhs = b;
1000b57cec5SDimitry Andric     return (lhs - rhs);
1010b57cec5SDimitry Andric   }
1020b57cec5SDimitry Andric   __kmp_cmplx32_t operator*(const __kmp_cmplx32_t &b) {
1030b57cec5SDimitry Andric     std::complex<float> lhs = *this;
1040b57cec5SDimitry Andric     std::complex<float> rhs = b;
1050b57cec5SDimitry Andric     return (lhs * rhs);
1060b57cec5SDimitry Andric   }
1070b57cec5SDimitry Andric 
1080b57cec5SDimitry Andric   __kmp_cmplx32_t operator+(const kmp_cmplx64 &b) {
1090b57cec5SDimitry Andric     kmp_cmplx64 t = kmp_cmplx64(*this) + b;
1100b57cec5SDimitry Andric     std::complex<double> d(t);
1110b57cec5SDimitry Andric     std::complex<float> f(d);
1120b57cec5SDimitry Andric     __kmp_cmplx32_t r(f);
1130b57cec5SDimitry Andric     return r;
1140b57cec5SDimitry Andric   }
1150b57cec5SDimitry Andric   __kmp_cmplx32_t operator-(const kmp_cmplx64 &b) {
1160b57cec5SDimitry Andric     kmp_cmplx64 t = kmp_cmplx64(*this) - b;
1170b57cec5SDimitry Andric     std::complex<double> d(t);
1180b57cec5SDimitry Andric     std::complex<float> f(d);
1190b57cec5SDimitry Andric     __kmp_cmplx32_t r(f);
1200b57cec5SDimitry Andric     return r;
1210b57cec5SDimitry Andric   }
1220b57cec5SDimitry Andric   __kmp_cmplx32_t operator*(const kmp_cmplx64 &b) {
1230b57cec5SDimitry Andric     kmp_cmplx64 t = kmp_cmplx64(*this) * b;
1240b57cec5SDimitry Andric     std::complex<double> d(t);
1250b57cec5SDimitry Andric     std::complex<float> f(d);
1260b57cec5SDimitry Andric     __kmp_cmplx32_t r(f);
1270b57cec5SDimitry Andric     return r;
1280b57cec5SDimitry Andric   }
1290b57cec5SDimitry Andric 
1300b57cec5SDimitry Andric   void operator/=(const __kmp_cmplx32_t &rhs) {
1310b57cec5SDimitry Andric     std::complex<float> lhs = *this;
1320b57cec5SDimitry Andric     *this = __kmp_lhs_div_rhs(lhs, rhs);
1330b57cec5SDimitry Andric   }
1340b57cec5SDimitry Andric 
1350b57cec5SDimitry Andric   __kmp_cmplx32_t operator/(const __kmp_cmplx32_t &rhs) {
1360b57cec5SDimitry Andric     std::complex<float> lhs = *this;
1370b57cec5SDimitry Andric     return __kmp_lhs_div_rhs(lhs, rhs);
1380b57cec5SDimitry Andric   }
1390b57cec5SDimitry Andric 
1400b57cec5SDimitry Andric   void operator/=(const kmp_cmplx64 &rhs) {
1410b57cec5SDimitry Andric     std::complex<float> lhs = *this;
1420b57cec5SDimitry Andric     *this = __kmp_lhs_div_rhs(lhs, rhs);
1430b57cec5SDimitry Andric   }
1440b57cec5SDimitry Andric 
1450b57cec5SDimitry Andric   __kmp_cmplx32_t operator/(const kmp_cmplx64 &rhs) {
1460b57cec5SDimitry Andric     std::complex<float> lhs = *this;
1470b57cec5SDimitry Andric     return __kmp_lhs_div_rhs(lhs, rhs);
1480b57cec5SDimitry Andric   }
1490b57cec5SDimitry Andric };
1500b57cec5SDimitry Andric typedef struct __kmp_cmplx32_t kmp_cmplx32;
1510b57cec5SDimitry Andric 
1520b57cec5SDimitry Andric // complex10
1530b57cec5SDimitry Andric struct KMP_DO_ALIGN(16) __kmp_cmplx80_t : std::complex<long double> {
1540b57cec5SDimitry Andric 
__kmp_cmplx80_t__kmp_cmplx80_t1550b57cec5SDimitry Andric   __kmp_cmplx80_t() : std::complex<long double>() {}
1560b57cec5SDimitry Andric 
__kmp_cmplx80_t__kmp_cmplx80_t1570b57cec5SDimitry Andric   __kmp_cmplx80_t(const std::complex<long double> &cld)
1580b57cec5SDimitry Andric       : std::complex<long double>(cld) {}
1590b57cec5SDimitry Andric 
1600b57cec5SDimitry Andric   void operator/=(const __kmp_cmplx80_t &rhs) {
1610b57cec5SDimitry Andric     std::complex<long double> lhs = *this;
1620b57cec5SDimitry Andric     *this = __kmp_lhs_div_rhs(lhs, rhs);
1630b57cec5SDimitry Andric   }
1640b57cec5SDimitry Andric 
1650b57cec5SDimitry Andric   __kmp_cmplx80_t operator/(const __kmp_cmplx80_t &rhs) {
1660b57cec5SDimitry Andric     std::complex<long double> lhs = *this;
1670b57cec5SDimitry Andric     return __kmp_lhs_div_rhs(lhs, rhs);
1680b57cec5SDimitry Andric   }
1690b57cec5SDimitry Andric };
1700b57cec5SDimitry Andric typedef KMP_DO_ALIGN(16) struct __kmp_cmplx80_t kmp_cmplx80;
1710b57cec5SDimitry Andric 
1720b57cec5SDimitry Andric // complex16
1730b57cec5SDimitry Andric #if KMP_HAVE_QUAD
1740b57cec5SDimitry Andric struct __kmp_cmplx128_t : std::complex<_Quad> {
1750b57cec5SDimitry Andric 
__kmp_cmplx128_t__kmp_cmplx128_t1760b57cec5SDimitry Andric   __kmp_cmplx128_t() : std::complex<_Quad>() {}
1770b57cec5SDimitry Andric 
__kmp_cmplx128_t__kmp_cmplx128_t1780b57cec5SDimitry Andric   __kmp_cmplx128_t(const std::complex<_Quad> &cq) : std::complex<_Quad>(cq) {}
1790b57cec5SDimitry Andric 
1800b57cec5SDimitry Andric   void operator/=(const __kmp_cmplx128_t &rhs) {
1810b57cec5SDimitry Andric     std::complex<_Quad> lhs = *this;
1820b57cec5SDimitry Andric     *this = __kmp_lhs_div_rhs(lhs, rhs);
1830b57cec5SDimitry Andric   }
1840b57cec5SDimitry Andric 
1850b57cec5SDimitry Andric   __kmp_cmplx128_t operator/(const __kmp_cmplx128_t &rhs) {
1860b57cec5SDimitry Andric     std::complex<_Quad> lhs = *this;
1870b57cec5SDimitry Andric     return __kmp_lhs_div_rhs(lhs, rhs);
1880b57cec5SDimitry Andric   }
1890b57cec5SDimitry Andric };
1900b57cec5SDimitry Andric typedef struct __kmp_cmplx128_t kmp_cmplx128;
1910b57cec5SDimitry Andric #endif /* KMP_HAVE_QUAD */
1920b57cec5SDimitry Andric 
1930b57cec5SDimitry Andric #ifdef _DEBUG_TEMPORARILY_UNSET_
1940b57cec5SDimitry Andric #undef _DEBUG_TEMPORARILY_UNSET_
1950b57cec5SDimitry Andric // Set it back now
1960b57cec5SDimitry Andric #define _DEBUG 1
1970b57cec5SDimitry Andric #endif
1980b57cec5SDimitry Andric 
1990b57cec5SDimitry Andric #else
2000b57cec5SDimitry Andric // create shortcuts for c99 complex types
2010b57cec5SDimitry Andric typedef float _Complex kmp_cmplx32;
2020b57cec5SDimitry Andric typedef double _Complex kmp_cmplx64;
2030b57cec5SDimitry Andric typedef long double _Complex kmp_cmplx80;
2040b57cec5SDimitry Andric #if KMP_HAVE_QUAD
2050b57cec5SDimitry Andric typedef _Quad _Complex kmp_cmplx128;
2060b57cec5SDimitry Andric #endif
2070b57cec5SDimitry Andric #endif
2080b57cec5SDimitry Andric 
2090b57cec5SDimitry Andric // Compiler 12.0 changed alignment of 16 and 32-byte arguments (like _Quad
2100b57cec5SDimitry Andric // and kmp_cmplx128) on IA-32 architecture. The following aligned structures
2110b57cec5SDimitry Andric // are implemented to support the old alignment in 10.1, 11.0, 11.1 and
2120b57cec5SDimitry Andric // introduce the new alignment in 12.0. See CQ88405.
2130b57cec5SDimitry Andric #if KMP_ARCH_X86 && KMP_HAVE_QUAD
2140b57cec5SDimitry Andric 
2150b57cec5SDimitry Andric // 4-byte aligned structures for backward compatibility.
2160b57cec5SDimitry Andric 
2170b57cec5SDimitry Andric #pragma pack(push, 4)
2180b57cec5SDimitry Andric 
2190b57cec5SDimitry Andric struct KMP_DO_ALIGN(4) Quad_a4_t {
2200b57cec5SDimitry Andric   _Quad q;
2210b57cec5SDimitry Andric 
Quad_a4_tQuad_a4_t2220b57cec5SDimitry Andric   Quad_a4_t() : q() {}
Quad_a4_tQuad_a4_t2230b57cec5SDimitry Andric   Quad_a4_t(const _Quad &cq) : q(cq) {}
2240b57cec5SDimitry Andric 
2250b57cec5SDimitry Andric   Quad_a4_t operator+(const Quad_a4_t &b) {
2260b57cec5SDimitry Andric     _Quad lhs = (*this).q;
2270b57cec5SDimitry Andric     _Quad rhs = b.q;
2280b57cec5SDimitry Andric     return (Quad_a4_t)(lhs + rhs);
2290b57cec5SDimitry Andric   }
2300b57cec5SDimitry Andric 
2310b57cec5SDimitry Andric   Quad_a4_t operator-(const Quad_a4_t &b) {
2320b57cec5SDimitry Andric     _Quad lhs = (*this).q;
2330b57cec5SDimitry Andric     _Quad rhs = b.q;
2340b57cec5SDimitry Andric     return (Quad_a4_t)(lhs - rhs);
2350b57cec5SDimitry Andric   }
2360b57cec5SDimitry Andric   Quad_a4_t operator*(const Quad_a4_t &b) {
2370b57cec5SDimitry Andric     _Quad lhs = (*this).q;
2380b57cec5SDimitry Andric     _Quad rhs = b.q;
2390b57cec5SDimitry Andric     return (Quad_a4_t)(lhs * rhs);
2400b57cec5SDimitry Andric   }
2410b57cec5SDimitry Andric 
2420b57cec5SDimitry Andric   Quad_a4_t operator/(const Quad_a4_t &b) {
2430b57cec5SDimitry Andric     _Quad lhs = (*this).q;
2440b57cec5SDimitry Andric     _Quad rhs = b.q;
2450b57cec5SDimitry Andric     return (Quad_a4_t)(lhs / rhs);
2460b57cec5SDimitry Andric   }
2470b57cec5SDimitry Andric };
2480b57cec5SDimitry Andric 
2490b57cec5SDimitry Andric struct KMP_DO_ALIGN(4) kmp_cmplx128_a4_t {
2500b57cec5SDimitry Andric   kmp_cmplx128 q;
2510b57cec5SDimitry Andric 
kmp_cmplx128_a4_tkmp_cmplx128_a4_t2520b57cec5SDimitry Andric   kmp_cmplx128_a4_t() : q() {}
2530b57cec5SDimitry Andric 
25481ad6265SDimitry Andric #if defined(__cplusplus) && (KMP_OS_WINDOWS)
kmp_cmplx128_a4_tkmp_cmplx128_a4_t25581ad6265SDimitry Andric   kmp_cmplx128_a4_t(const std::complex<_Quad> &c128) : q(c128) {}
25681ad6265SDimitry Andric #endif
kmp_cmplx128_a4_tkmp_cmplx128_a4_t2570b57cec5SDimitry Andric   kmp_cmplx128_a4_t(const kmp_cmplx128 &c128) : q(c128) {}
2580b57cec5SDimitry Andric 
2590b57cec5SDimitry Andric   kmp_cmplx128_a4_t operator+(const kmp_cmplx128_a4_t &b) {
2600b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
2610b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
2620b57cec5SDimitry Andric     return (kmp_cmplx128_a4_t)(lhs + rhs);
2630b57cec5SDimitry Andric   }
2640b57cec5SDimitry Andric   kmp_cmplx128_a4_t operator-(const kmp_cmplx128_a4_t &b) {
2650b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
2660b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
2670b57cec5SDimitry Andric     return (kmp_cmplx128_a4_t)(lhs - rhs);
2680b57cec5SDimitry Andric   }
2690b57cec5SDimitry Andric   kmp_cmplx128_a4_t operator*(const kmp_cmplx128_a4_t &b) {
2700b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
2710b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
2720b57cec5SDimitry Andric     return (kmp_cmplx128_a4_t)(lhs * rhs);
2730b57cec5SDimitry Andric   }
2740b57cec5SDimitry Andric 
2750b57cec5SDimitry Andric   kmp_cmplx128_a4_t operator/(const kmp_cmplx128_a4_t &b) {
2760b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
2770b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
2780b57cec5SDimitry Andric     return (kmp_cmplx128_a4_t)(lhs / rhs);
2790b57cec5SDimitry Andric   }
2800b57cec5SDimitry Andric };
2810b57cec5SDimitry Andric 
2820b57cec5SDimitry Andric #pragma pack(pop)
2830b57cec5SDimitry Andric 
2840b57cec5SDimitry Andric // New 16-byte aligned structures for 12.0 compiler.
2850b57cec5SDimitry Andric struct KMP_DO_ALIGN(16) Quad_a16_t {
2860b57cec5SDimitry Andric   _Quad q;
2870b57cec5SDimitry Andric 
Quad_a16_tQuad_a16_t2880b57cec5SDimitry Andric   Quad_a16_t() : q() {}
Quad_a16_tQuad_a16_t2890b57cec5SDimitry Andric   Quad_a16_t(const _Quad &cq) : q(cq) {}
2900b57cec5SDimitry Andric 
2910b57cec5SDimitry Andric   Quad_a16_t operator+(const Quad_a16_t &b) {
2920b57cec5SDimitry Andric     _Quad lhs = (*this).q;
2930b57cec5SDimitry Andric     _Quad rhs = b.q;
2940b57cec5SDimitry Andric     return (Quad_a16_t)(lhs + rhs);
2950b57cec5SDimitry Andric   }
2960b57cec5SDimitry Andric 
2970b57cec5SDimitry Andric   Quad_a16_t operator-(const Quad_a16_t &b) {
2980b57cec5SDimitry Andric     _Quad lhs = (*this).q;
2990b57cec5SDimitry Andric     _Quad rhs = b.q;
3000b57cec5SDimitry Andric     return (Quad_a16_t)(lhs - rhs);
3010b57cec5SDimitry Andric   }
3020b57cec5SDimitry Andric   Quad_a16_t operator*(const Quad_a16_t &b) {
3030b57cec5SDimitry Andric     _Quad lhs = (*this).q;
3040b57cec5SDimitry Andric     _Quad rhs = b.q;
3050b57cec5SDimitry Andric     return (Quad_a16_t)(lhs * rhs);
3060b57cec5SDimitry Andric   }
3070b57cec5SDimitry Andric 
3080b57cec5SDimitry Andric   Quad_a16_t operator/(const Quad_a16_t &b) {
3090b57cec5SDimitry Andric     _Quad lhs = (*this).q;
3100b57cec5SDimitry Andric     _Quad rhs = b.q;
3110b57cec5SDimitry Andric     return (Quad_a16_t)(lhs / rhs);
3120b57cec5SDimitry Andric   }
3130b57cec5SDimitry Andric };
3140b57cec5SDimitry Andric 
3150b57cec5SDimitry Andric struct KMP_DO_ALIGN(16) kmp_cmplx128_a16_t {
3160b57cec5SDimitry Andric   kmp_cmplx128 q;
3170b57cec5SDimitry Andric 
kmp_cmplx128_a16_tkmp_cmplx128_a16_t3180b57cec5SDimitry Andric   kmp_cmplx128_a16_t() : q() {}
3190b57cec5SDimitry Andric 
32081ad6265SDimitry Andric #if defined(__cplusplus) && (KMP_OS_WINDOWS)
kmp_cmplx128_a16_tkmp_cmplx128_a16_t32181ad6265SDimitry Andric   kmp_cmplx128_a16_t(const std::complex<_Quad> &c128) : q(c128) {}
32281ad6265SDimitry Andric #endif
kmp_cmplx128_a16_tkmp_cmplx128_a16_t3230b57cec5SDimitry Andric   kmp_cmplx128_a16_t(const kmp_cmplx128 &c128) : q(c128) {}
3240b57cec5SDimitry Andric 
3250b57cec5SDimitry Andric   kmp_cmplx128_a16_t operator+(const kmp_cmplx128_a16_t &b) {
3260b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
3270b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
3280b57cec5SDimitry Andric     return (kmp_cmplx128_a16_t)(lhs + rhs);
3290b57cec5SDimitry Andric   }
3300b57cec5SDimitry Andric   kmp_cmplx128_a16_t operator-(const kmp_cmplx128_a16_t &b) {
3310b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
3320b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
3330b57cec5SDimitry Andric     return (kmp_cmplx128_a16_t)(lhs - rhs);
3340b57cec5SDimitry Andric   }
3350b57cec5SDimitry Andric   kmp_cmplx128_a16_t operator*(const kmp_cmplx128_a16_t &b) {
3360b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
3370b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
3380b57cec5SDimitry Andric     return (kmp_cmplx128_a16_t)(lhs * rhs);
3390b57cec5SDimitry Andric   }
3400b57cec5SDimitry Andric 
3410b57cec5SDimitry Andric   kmp_cmplx128_a16_t operator/(const kmp_cmplx128_a16_t &b) {
3420b57cec5SDimitry Andric     kmp_cmplx128 lhs = (*this).q;
3430b57cec5SDimitry Andric     kmp_cmplx128 rhs = b.q;
3440b57cec5SDimitry Andric     return (kmp_cmplx128_a16_t)(lhs / rhs);
3450b57cec5SDimitry Andric   }
3460b57cec5SDimitry Andric };
3470b57cec5SDimitry Andric 
3480b57cec5SDimitry Andric #endif
3490b57cec5SDimitry Andric 
3500b57cec5SDimitry Andric #if (KMP_ARCH_X86)
3510b57cec5SDimitry Andric #define QUAD_LEGACY Quad_a4_t
3520b57cec5SDimitry Andric #define CPLX128_LEG kmp_cmplx128_a4_t
3530b57cec5SDimitry Andric #else
3540b57cec5SDimitry Andric #define QUAD_LEGACY _Quad
3550b57cec5SDimitry Andric #define CPLX128_LEG kmp_cmplx128
3560b57cec5SDimitry Andric #endif
3570b57cec5SDimitry Andric 
3580b57cec5SDimitry Andric #ifdef __cplusplus
3590b57cec5SDimitry Andric extern "C" {
3600b57cec5SDimitry Andric #endif
3610b57cec5SDimitry Andric 
3620b57cec5SDimitry Andric extern int __kmp_atomic_mode;
3630b57cec5SDimitry Andric 
3640b57cec5SDimitry Andric // Atomic locks can easily become contended, so we use queuing locks for them.
3650b57cec5SDimitry Andric typedef kmp_queuing_lock_t kmp_atomic_lock_t;
3660b57cec5SDimitry Andric 
__kmp_acquire_atomic_lock(kmp_atomic_lock_t * lck,kmp_int32 gtid)3670b57cec5SDimitry Andric static inline void __kmp_acquire_atomic_lock(kmp_atomic_lock_t *lck,
3680b57cec5SDimitry Andric                                              kmp_int32 gtid) {
3690b57cec5SDimitry Andric #if OMPT_SUPPORT && OMPT_OPTIONAL
3700b57cec5SDimitry Andric   if (ompt_enabled.ompt_callback_mutex_acquire) {
3710b57cec5SDimitry Andric     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
372fe6060f1SDimitry Andric         ompt_mutex_atomic, 0, kmp_mutex_impl_queuing,
373fe6060f1SDimitry Andric         (ompt_wait_id_t)(uintptr_t)lck, OMPT_GET_RETURN_ADDRESS(0));
3740b57cec5SDimitry Andric   }
3750b57cec5SDimitry Andric #endif
3760b57cec5SDimitry Andric 
3770b57cec5SDimitry Andric   __kmp_acquire_queuing_lock(lck, gtid);
3780b57cec5SDimitry Andric 
3790b57cec5SDimitry Andric #if OMPT_SUPPORT && OMPT_OPTIONAL
3800b57cec5SDimitry Andric   if (ompt_enabled.ompt_callback_mutex_acquired) {
3810b57cec5SDimitry Andric     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
382fe6060f1SDimitry Andric         ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck,
383fe6060f1SDimitry Andric         OMPT_GET_RETURN_ADDRESS(0));
3840b57cec5SDimitry Andric   }
3850b57cec5SDimitry Andric #endif
3860b57cec5SDimitry Andric }
3870b57cec5SDimitry Andric 
__kmp_test_atomic_lock(kmp_atomic_lock_t * lck,kmp_int32 gtid)3880b57cec5SDimitry Andric static inline int __kmp_test_atomic_lock(kmp_atomic_lock_t *lck,
3890b57cec5SDimitry Andric                                          kmp_int32 gtid) {
3900b57cec5SDimitry Andric   return __kmp_test_queuing_lock(lck, gtid);
3910b57cec5SDimitry Andric }
3920b57cec5SDimitry Andric 
__kmp_release_atomic_lock(kmp_atomic_lock_t * lck,kmp_int32 gtid)3930b57cec5SDimitry Andric static inline void __kmp_release_atomic_lock(kmp_atomic_lock_t *lck,
3940b57cec5SDimitry Andric                                              kmp_int32 gtid) {
3950b57cec5SDimitry Andric   __kmp_release_queuing_lock(lck, gtid);
3960b57cec5SDimitry Andric #if OMPT_SUPPORT && OMPT_OPTIONAL
3970b57cec5SDimitry Andric   if (ompt_enabled.ompt_callback_mutex_released) {
3980b57cec5SDimitry Andric     ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
399fe6060f1SDimitry Andric         ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck,
400fe6060f1SDimitry Andric         OMPT_GET_RETURN_ADDRESS(0));
4010b57cec5SDimitry Andric   }
4020b57cec5SDimitry Andric #endif
4030b57cec5SDimitry Andric }
4040b57cec5SDimitry Andric 
__kmp_init_atomic_lock(kmp_atomic_lock_t * lck)4050b57cec5SDimitry Andric static inline void __kmp_init_atomic_lock(kmp_atomic_lock_t *lck) {
4060b57cec5SDimitry Andric   __kmp_init_queuing_lock(lck);
4070b57cec5SDimitry Andric }
4080b57cec5SDimitry Andric 
__kmp_destroy_atomic_lock(kmp_atomic_lock_t * lck)4090b57cec5SDimitry Andric static inline void __kmp_destroy_atomic_lock(kmp_atomic_lock_t *lck) {
4100b57cec5SDimitry Andric   __kmp_destroy_queuing_lock(lck);
4110b57cec5SDimitry Andric }
4120b57cec5SDimitry Andric 
4130b57cec5SDimitry Andric // Global Locks
4140b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock; /* Control access to all user coded
4150b57cec5SDimitry Andric                                                atomics in Gnu compat mode   */
4160b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_1i; /* Control access to all user
4170b57cec5SDimitry Andric                                                   coded atomics for 1-byte fixed
4180b57cec5SDimitry Andric                                                   data types */
4190b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_2i; /* Control access to all user
4200b57cec5SDimitry Andric                                                   coded atomics for 2-byte fixed
4210b57cec5SDimitry Andric                                                   data types */
4220b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_4i; /* Control access to all user
4230b57cec5SDimitry Andric                                                   coded atomics for 4-byte fixed
4240b57cec5SDimitry Andric                                                   data types */
4250b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_4r; /* Control access to all user
4260b57cec5SDimitry Andric                                                   coded atomics for kmp_real32
4270b57cec5SDimitry Andric                                                   data type    */
4280b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_8i; /* Control access to all user
4290b57cec5SDimitry Andric                                                   coded atomics for 8-byte fixed
4300b57cec5SDimitry Andric                                                   data types */
4310b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_8r; /* Control access to all user
4320b57cec5SDimitry Andric                                                   coded atomics for kmp_real64
4330b57cec5SDimitry Andric                                                   data type    */
4340b57cec5SDimitry Andric extern kmp_atomic_lock_t
4350b57cec5SDimitry Andric     __kmp_atomic_lock_8c; /* Control access to all user coded atomics for
4360b57cec5SDimitry Andric                              complex byte data type  */
4370b57cec5SDimitry Andric extern kmp_atomic_lock_t
4380b57cec5SDimitry Andric     __kmp_atomic_lock_10r; /* Control access to all user coded atomics for long
4390b57cec5SDimitry Andric                               double data type   */
4400b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_16r; /* Control access to all user
4410b57cec5SDimitry Andric                                                    coded atomics for _Quad data
4420b57cec5SDimitry Andric                                                    type         */
4430b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_16c; /* Control access to all user
4440b57cec5SDimitry Andric                                                    coded atomics for double
4450b57cec5SDimitry Andric                                                    complex data type*/
4460b57cec5SDimitry Andric extern kmp_atomic_lock_t
4470b57cec5SDimitry Andric     __kmp_atomic_lock_20c; /* Control access to all user coded atomics for long
4480b57cec5SDimitry Andric                               double complex type*/
4490b57cec5SDimitry Andric extern kmp_atomic_lock_t __kmp_atomic_lock_32c; /* Control access to all user
4500b57cec5SDimitry Andric                                                    coded atomics for _Quad
4510b57cec5SDimitry Andric                                                    complex data type */
4520b57cec5SDimitry Andric 
4530b57cec5SDimitry Andric //  Below routines for atomic UPDATE are listed
4540b57cec5SDimitry Andric 
4550b57cec5SDimitry Andric // 1-byte
4560b57cec5SDimitry Andric void __kmpc_atomic_fixed1_add(ident_t *id_ref, int gtid, char *lhs, char rhs);
4570b57cec5SDimitry Andric void __kmpc_atomic_fixed1_andb(ident_t *id_ref, int gtid, char *lhs, char rhs);
4580b57cec5SDimitry Andric void __kmpc_atomic_fixed1_div(ident_t *id_ref, int gtid, char *lhs, char rhs);
4590b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_div(ident_t *id_ref, int gtid, unsigned char *lhs,
4600b57cec5SDimitry Andric                                unsigned char rhs);
4610b57cec5SDimitry Andric void __kmpc_atomic_fixed1_mul(ident_t *id_ref, int gtid, char *lhs, char rhs);
4620b57cec5SDimitry Andric void __kmpc_atomic_fixed1_orb(ident_t *id_ref, int gtid, char *lhs, char rhs);
4630b57cec5SDimitry Andric void __kmpc_atomic_fixed1_shl(ident_t *id_ref, int gtid, char *lhs, char rhs);
4640b57cec5SDimitry Andric void __kmpc_atomic_fixed1_shr(ident_t *id_ref, int gtid, char *lhs, char rhs);
4650b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_shr(ident_t *id_ref, int gtid, unsigned char *lhs,
4660b57cec5SDimitry Andric                                unsigned char rhs);
4670b57cec5SDimitry Andric void __kmpc_atomic_fixed1_sub(ident_t *id_ref, int gtid, char *lhs, char rhs);
4680b57cec5SDimitry Andric void __kmpc_atomic_fixed1_xor(ident_t *id_ref, int gtid, char *lhs, char rhs);
4690b57cec5SDimitry Andric // 2-byte
4700b57cec5SDimitry Andric void __kmpc_atomic_fixed2_add(ident_t *id_ref, int gtid, short *lhs, short rhs);
4710b57cec5SDimitry Andric void __kmpc_atomic_fixed2_andb(ident_t *id_ref, int gtid, short *lhs,
4720b57cec5SDimitry Andric                                short rhs);
4730b57cec5SDimitry Andric void __kmpc_atomic_fixed2_div(ident_t *id_ref, int gtid, short *lhs, short rhs);
4740b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_div(ident_t *id_ref, int gtid, unsigned short *lhs,
4750b57cec5SDimitry Andric                                unsigned short rhs);
4760b57cec5SDimitry Andric void __kmpc_atomic_fixed2_mul(ident_t *id_ref, int gtid, short *lhs, short rhs);
4770b57cec5SDimitry Andric void __kmpc_atomic_fixed2_orb(ident_t *id_ref, int gtid, short *lhs, short rhs);
4780b57cec5SDimitry Andric void __kmpc_atomic_fixed2_shl(ident_t *id_ref, int gtid, short *lhs, short rhs);
4790b57cec5SDimitry Andric void __kmpc_atomic_fixed2_shr(ident_t *id_ref, int gtid, short *lhs, short rhs);
4800b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_shr(ident_t *id_ref, int gtid, unsigned short *lhs,
4810b57cec5SDimitry Andric                                unsigned short rhs);
4820b57cec5SDimitry Andric void __kmpc_atomic_fixed2_sub(ident_t *id_ref, int gtid, short *lhs, short rhs);
4830b57cec5SDimitry Andric void __kmpc_atomic_fixed2_xor(ident_t *id_ref, int gtid, short *lhs, short rhs);
4840b57cec5SDimitry Andric // 4-byte add / sub fixed
4850b57cec5SDimitry Andric void __kmpc_atomic_fixed4_add(ident_t *id_ref, int gtid, kmp_int32 *lhs,
4860b57cec5SDimitry Andric                               kmp_int32 rhs);
4870b57cec5SDimitry Andric void __kmpc_atomic_fixed4_sub(ident_t *id_ref, int gtid, kmp_int32 *lhs,
4880b57cec5SDimitry Andric                               kmp_int32 rhs);
4890b57cec5SDimitry Andric // 4-byte add / sub float
4900b57cec5SDimitry Andric void __kmpc_atomic_float4_add(ident_t *id_ref, int gtid, kmp_real32 *lhs,
4910b57cec5SDimitry Andric                               kmp_real32 rhs);
4920b57cec5SDimitry Andric void __kmpc_atomic_float4_sub(ident_t *id_ref, int gtid, kmp_real32 *lhs,
4930b57cec5SDimitry Andric                               kmp_real32 rhs);
4940b57cec5SDimitry Andric // 8-byte add / sub fixed
4950b57cec5SDimitry Andric void __kmpc_atomic_fixed8_add(ident_t *id_ref, int gtid, kmp_int64 *lhs,
4960b57cec5SDimitry Andric                               kmp_int64 rhs);
4970b57cec5SDimitry Andric void __kmpc_atomic_fixed8_sub(ident_t *id_ref, int gtid, kmp_int64 *lhs,
4980b57cec5SDimitry Andric                               kmp_int64 rhs);
4990b57cec5SDimitry Andric // 8-byte add / sub float
5000b57cec5SDimitry Andric void __kmpc_atomic_float8_add(ident_t *id_ref, int gtid, kmp_real64 *lhs,
5010b57cec5SDimitry Andric                               kmp_real64 rhs);
5020b57cec5SDimitry Andric void __kmpc_atomic_float8_sub(ident_t *id_ref, int gtid, kmp_real64 *lhs,
5030b57cec5SDimitry Andric                               kmp_real64 rhs);
5040b57cec5SDimitry Andric // 4-byte fixed
5050b57cec5SDimitry Andric void __kmpc_atomic_fixed4_andb(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5060b57cec5SDimitry Andric                                kmp_int32 rhs);
5070b57cec5SDimitry Andric void __kmpc_atomic_fixed4_div(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5080b57cec5SDimitry Andric                               kmp_int32 rhs);
5090b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_div(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
5100b57cec5SDimitry Andric                                kmp_uint32 rhs);
5110b57cec5SDimitry Andric void __kmpc_atomic_fixed4_mul(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5120b57cec5SDimitry Andric                               kmp_int32 rhs);
5130b57cec5SDimitry Andric void __kmpc_atomic_fixed4_orb(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5140b57cec5SDimitry Andric                               kmp_int32 rhs);
5150b57cec5SDimitry Andric void __kmpc_atomic_fixed4_shl(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5160b57cec5SDimitry Andric                               kmp_int32 rhs);
5170b57cec5SDimitry Andric void __kmpc_atomic_fixed4_shr(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5180b57cec5SDimitry Andric                               kmp_int32 rhs);
5190b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_shr(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
5200b57cec5SDimitry Andric                                kmp_uint32 rhs);
5210b57cec5SDimitry Andric void __kmpc_atomic_fixed4_xor(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5220b57cec5SDimitry Andric                               kmp_int32 rhs);
5230b57cec5SDimitry Andric // 8-byte fixed
5240b57cec5SDimitry Andric void __kmpc_atomic_fixed8_andb(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5250b57cec5SDimitry Andric                                kmp_int64 rhs);
5260b57cec5SDimitry Andric void __kmpc_atomic_fixed8_div(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5270b57cec5SDimitry Andric                               kmp_int64 rhs);
5280b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_div(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
5290b57cec5SDimitry Andric                                kmp_uint64 rhs);
5300b57cec5SDimitry Andric void __kmpc_atomic_fixed8_mul(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5310b57cec5SDimitry Andric                               kmp_int64 rhs);
5320b57cec5SDimitry Andric void __kmpc_atomic_fixed8_orb(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5330b57cec5SDimitry Andric                               kmp_int64 rhs);
5340b57cec5SDimitry Andric void __kmpc_atomic_fixed8_shl(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5350b57cec5SDimitry Andric                               kmp_int64 rhs);
5360b57cec5SDimitry Andric void __kmpc_atomic_fixed8_shr(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5370b57cec5SDimitry Andric                               kmp_int64 rhs);
5380b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_shr(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
5390b57cec5SDimitry Andric                                kmp_uint64 rhs);
5400b57cec5SDimitry Andric void __kmpc_atomic_fixed8_xor(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5410b57cec5SDimitry Andric                               kmp_int64 rhs);
5420b57cec5SDimitry Andric // 4-byte float
5430b57cec5SDimitry Andric void __kmpc_atomic_float4_div(ident_t *id_ref, int gtid, kmp_real32 *lhs,
5440b57cec5SDimitry Andric                               kmp_real32 rhs);
5450b57cec5SDimitry Andric void __kmpc_atomic_float4_mul(ident_t *id_ref, int gtid, kmp_real32 *lhs,
5460b57cec5SDimitry Andric                               kmp_real32 rhs);
5470b57cec5SDimitry Andric // 8-byte float
5480b57cec5SDimitry Andric void __kmpc_atomic_float8_div(ident_t *id_ref, int gtid, kmp_real64 *lhs,
5490b57cec5SDimitry Andric                               kmp_real64 rhs);
5500b57cec5SDimitry Andric void __kmpc_atomic_float8_mul(ident_t *id_ref, int gtid, kmp_real64 *lhs,
5510b57cec5SDimitry Andric                               kmp_real64 rhs);
5520b57cec5SDimitry Andric // 1-, 2-, 4-, 8-byte logical (&&, ||)
5530b57cec5SDimitry Andric void __kmpc_atomic_fixed1_andl(ident_t *id_ref, int gtid, char *lhs, char rhs);
5540b57cec5SDimitry Andric void __kmpc_atomic_fixed1_orl(ident_t *id_ref, int gtid, char *lhs, char rhs);
5550b57cec5SDimitry Andric void __kmpc_atomic_fixed2_andl(ident_t *id_ref, int gtid, short *lhs,
5560b57cec5SDimitry Andric                                short rhs);
5570b57cec5SDimitry Andric void __kmpc_atomic_fixed2_orl(ident_t *id_ref, int gtid, short *lhs, short rhs);
5580b57cec5SDimitry Andric void __kmpc_atomic_fixed4_andl(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5590b57cec5SDimitry Andric                                kmp_int32 rhs);
5600b57cec5SDimitry Andric void __kmpc_atomic_fixed4_orl(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5610b57cec5SDimitry Andric                               kmp_int32 rhs);
5620b57cec5SDimitry Andric void __kmpc_atomic_fixed8_andl(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5630b57cec5SDimitry Andric                                kmp_int64 rhs);
5640b57cec5SDimitry Andric void __kmpc_atomic_fixed8_orl(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5650b57cec5SDimitry Andric                               kmp_int64 rhs);
5660b57cec5SDimitry Andric // MIN / MAX
5670b57cec5SDimitry Andric void __kmpc_atomic_fixed1_max(ident_t *id_ref, int gtid, char *lhs, char rhs);
5680b57cec5SDimitry Andric void __kmpc_atomic_fixed1_min(ident_t *id_ref, int gtid, char *lhs, char rhs);
5690b57cec5SDimitry Andric void __kmpc_atomic_fixed2_max(ident_t *id_ref, int gtid, short *lhs, short rhs);
5700b57cec5SDimitry Andric void __kmpc_atomic_fixed2_min(ident_t *id_ref, int gtid, short *lhs, short rhs);
5710b57cec5SDimitry Andric void __kmpc_atomic_fixed4_max(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5720b57cec5SDimitry Andric                               kmp_int32 rhs);
5730b57cec5SDimitry Andric void __kmpc_atomic_fixed4_min(ident_t *id_ref, int gtid, kmp_int32 *lhs,
5740b57cec5SDimitry Andric                               kmp_int32 rhs);
5750b57cec5SDimitry Andric void __kmpc_atomic_fixed8_max(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5760b57cec5SDimitry Andric                               kmp_int64 rhs);
5770b57cec5SDimitry Andric void __kmpc_atomic_fixed8_min(ident_t *id_ref, int gtid, kmp_int64 *lhs,
5780b57cec5SDimitry Andric                               kmp_int64 rhs);
5790b57cec5SDimitry Andric void __kmpc_atomic_float4_max(ident_t *id_ref, int gtid, kmp_real32 *lhs,
5800b57cec5SDimitry Andric                               kmp_real32 rhs);
5810b57cec5SDimitry Andric void __kmpc_atomic_float4_min(ident_t *id_ref, int gtid, kmp_real32 *lhs,
5820b57cec5SDimitry Andric                               kmp_real32 rhs);
5830b57cec5SDimitry Andric void __kmpc_atomic_float8_max(ident_t *id_ref, int gtid, kmp_real64 *lhs,
5840b57cec5SDimitry Andric                               kmp_real64 rhs);
5850b57cec5SDimitry Andric void __kmpc_atomic_float8_min(ident_t *id_ref, int gtid, kmp_real64 *lhs,
5860b57cec5SDimitry Andric                               kmp_real64 rhs);
587349cc55cSDimitry Andric void __kmpc_atomic_float10_max(ident_t *id_ref, int gtid, long double *lhs,
588349cc55cSDimitry Andric                                long double rhs);
589349cc55cSDimitry Andric void __kmpc_atomic_float10_min(ident_t *id_ref, int gtid, long double *lhs,
590349cc55cSDimitry Andric                                long double rhs);
5910b57cec5SDimitry Andric #if KMP_HAVE_QUAD
5920b57cec5SDimitry Andric void __kmpc_atomic_float16_max(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
5930b57cec5SDimitry Andric                                QUAD_LEGACY rhs);
5940b57cec5SDimitry Andric void __kmpc_atomic_float16_min(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
5950b57cec5SDimitry Andric                                QUAD_LEGACY rhs);
5960b57cec5SDimitry Andric #if (KMP_ARCH_X86)
5970b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary; IA-32
5980b57cec5SDimitry Andric // architecture only
5990b57cec5SDimitry Andric void __kmpc_atomic_float16_max_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
6000b57cec5SDimitry Andric                                    Quad_a16_t rhs);
6010b57cec5SDimitry Andric void __kmpc_atomic_float16_min_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
6020b57cec5SDimitry Andric                                    Quad_a16_t rhs);
6030b57cec5SDimitry Andric #endif
6040b57cec5SDimitry Andric #endif
6050b57cec5SDimitry Andric // .NEQV. (same as xor)
6060b57cec5SDimitry Andric void __kmpc_atomic_fixed1_neqv(ident_t *id_ref, int gtid, char *lhs, char rhs);
6070b57cec5SDimitry Andric void __kmpc_atomic_fixed2_neqv(ident_t *id_ref, int gtid, short *lhs,
6080b57cec5SDimitry Andric                                short rhs);
6090b57cec5SDimitry Andric void __kmpc_atomic_fixed4_neqv(ident_t *id_ref, int gtid, kmp_int32 *lhs,
6100b57cec5SDimitry Andric                                kmp_int32 rhs);
6110b57cec5SDimitry Andric void __kmpc_atomic_fixed8_neqv(ident_t *id_ref, int gtid, kmp_int64 *lhs,
6120b57cec5SDimitry Andric                                kmp_int64 rhs);
6130b57cec5SDimitry Andric // .EQV. (same as ~xor)
6140b57cec5SDimitry Andric void __kmpc_atomic_fixed1_eqv(ident_t *id_ref, int gtid, char *lhs, char rhs);
6150b57cec5SDimitry Andric void __kmpc_atomic_fixed2_eqv(ident_t *id_ref, int gtid, short *lhs, short rhs);
6160b57cec5SDimitry Andric void __kmpc_atomic_fixed4_eqv(ident_t *id_ref, int gtid, kmp_int32 *lhs,
6170b57cec5SDimitry Andric                               kmp_int32 rhs);
6180b57cec5SDimitry Andric void __kmpc_atomic_fixed8_eqv(ident_t *id_ref, int gtid, kmp_int64 *lhs,
6190b57cec5SDimitry Andric                               kmp_int64 rhs);
6200b57cec5SDimitry Andric // long double type
6210b57cec5SDimitry Andric void __kmpc_atomic_float10_add(ident_t *id_ref, int gtid, long double *lhs,
6220b57cec5SDimitry Andric                                long double rhs);
6230b57cec5SDimitry Andric void __kmpc_atomic_float10_sub(ident_t *id_ref, int gtid, long double *lhs,
6240b57cec5SDimitry Andric                                long double rhs);
6250b57cec5SDimitry Andric void __kmpc_atomic_float10_mul(ident_t *id_ref, int gtid, long double *lhs,
6260b57cec5SDimitry Andric                                long double rhs);
6270b57cec5SDimitry Andric void __kmpc_atomic_float10_div(ident_t *id_ref, int gtid, long double *lhs,
6280b57cec5SDimitry Andric                                long double rhs);
6290b57cec5SDimitry Andric // _Quad type
6300b57cec5SDimitry Andric #if KMP_HAVE_QUAD
6310b57cec5SDimitry Andric void __kmpc_atomic_float16_add(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
6320b57cec5SDimitry Andric                                QUAD_LEGACY rhs);
6330b57cec5SDimitry Andric void __kmpc_atomic_float16_sub(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
6340b57cec5SDimitry Andric                                QUAD_LEGACY rhs);
6350b57cec5SDimitry Andric void __kmpc_atomic_float16_mul(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
6360b57cec5SDimitry Andric                                QUAD_LEGACY rhs);
6370b57cec5SDimitry Andric void __kmpc_atomic_float16_div(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
6380b57cec5SDimitry Andric                                QUAD_LEGACY rhs);
6390b57cec5SDimitry Andric #if (KMP_ARCH_X86)
6400b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary
6410b57cec5SDimitry Andric void __kmpc_atomic_float16_add_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
6420b57cec5SDimitry Andric                                    Quad_a16_t rhs);
6430b57cec5SDimitry Andric void __kmpc_atomic_float16_sub_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
6440b57cec5SDimitry Andric                                    Quad_a16_t rhs);
6450b57cec5SDimitry Andric void __kmpc_atomic_float16_mul_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
6460b57cec5SDimitry Andric                                    Quad_a16_t rhs);
6470b57cec5SDimitry Andric void __kmpc_atomic_float16_div_a16(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
6480b57cec5SDimitry Andric                                    Quad_a16_t rhs);
6490b57cec5SDimitry Andric #endif
6500b57cec5SDimitry Andric #endif
6510b57cec5SDimitry Andric // routines for complex types
6520b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_add(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
6530b57cec5SDimitry Andric                               kmp_cmplx32 rhs);
6540b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_sub(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
6550b57cec5SDimitry Andric                               kmp_cmplx32 rhs);
6560b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_mul(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
6570b57cec5SDimitry Andric                               kmp_cmplx32 rhs);
6580b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_div(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
6590b57cec5SDimitry Andric                               kmp_cmplx32 rhs);
6600b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_add(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
6610b57cec5SDimitry Andric                               kmp_cmplx64 rhs);
6620b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_sub(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
6630b57cec5SDimitry Andric                               kmp_cmplx64 rhs);
6640b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_mul(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
6650b57cec5SDimitry Andric                               kmp_cmplx64 rhs);
6660b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_div(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
6670b57cec5SDimitry Andric                               kmp_cmplx64 rhs);
6680b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_add(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
6690b57cec5SDimitry Andric                                kmp_cmplx80 rhs);
6700b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_sub(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
6710b57cec5SDimitry Andric                                kmp_cmplx80 rhs);
6720b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_mul(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
6730b57cec5SDimitry Andric                                kmp_cmplx80 rhs);
6740b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_div(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
6750b57cec5SDimitry Andric                                kmp_cmplx80 rhs);
6760b57cec5SDimitry Andric #if KMP_HAVE_QUAD
6770b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_add(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
6780b57cec5SDimitry Andric                                CPLX128_LEG rhs);
6790b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_sub(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
6800b57cec5SDimitry Andric                                CPLX128_LEG rhs);
6810b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_mul(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
6820b57cec5SDimitry Andric                                CPLX128_LEG rhs);
6830b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_div(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
6840b57cec5SDimitry Andric                                CPLX128_LEG rhs);
6850b57cec5SDimitry Andric #if (KMP_ARCH_X86)
6860b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary
6870b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_add_a16(ident_t *id_ref, int gtid,
6880b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t *lhs,
6890b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t rhs);
6900b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_sub_a16(ident_t *id_ref, int gtid,
6910b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t *lhs,
6920b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t rhs);
6930b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_mul_a16(ident_t *id_ref, int gtid,
6940b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t *lhs,
6950b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t rhs);
6960b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_div_a16(ident_t *id_ref, int gtid,
6970b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t *lhs,
6980b57cec5SDimitry Andric                                    kmp_cmplx128_a16_t rhs);
6990b57cec5SDimitry Andric #endif
7000b57cec5SDimitry Andric #endif
7010b57cec5SDimitry Andric 
7020b57cec5SDimitry Andric // OpenMP 4.0: x = expr binop x for non-commutative operations.
7030b57cec5SDimitry Andric // Supported only on IA-32 architecture and Intel(R) 64
7040b57cec5SDimitry Andric #if KMP_ARCH_X86 || KMP_ARCH_X86_64
7050b57cec5SDimitry Andric 
7060b57cec5SDimitry Andric void __kmpc_atomic_fixed1_sub_rev(ident_t *id_ref, int gtid, char *lhs,
7070b57cec5SDimitry Andric                                   char rhs);
7080b57cec5SDimitry Andric void __kmpc_atomic_fixed1_div_rev(ident_t *id_ref, int gtid, char *lhs,
7090b57cec5SDimitry Andric                                   char rhs);
7100b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_div_rev(ident_t *id_ref, int gtid,
7110b57cec5SDimitry Andric                                    unsigned char *lhs, unsigned char rhs);
7120b57cec5SDimitry Andric void __kmpc_atomic_fixed1_shl_rev(ident_t *id_ref, int gtid, char *lhs,
7130b57cec5SDimitry Andric                                   char rhs);
7140b57cec5SDimitry Andric void __kmpc_atomic_fixed1_shr_rev(ident_t *id_ref, int gtid, char *lhs,
7150b57cec5SDimitry Andric                                   char rhs);
7160b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_shr_rev(ident_t *id_ref, int gtid,
7170b57cec5SDimitry Andric                                    unsigned char *lhs, unsigned char rhs);
7180b57cec5SDimitry Andric void __kmpc_atomic_fixed2_sub_rev(ident_t *id_ref, int gtid, short *lhs,
7190b57cec5SDimitry Andric                                   short rhs);
7200b57cec5SDimitry Andric void __kmpc_atomic_fixed2_div_rev(ident_t *id_ref, int gtid, short *lhs,
7210b57cec5SDimitry Andric                                   short rhs);
7220b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_div_rev(ident_t *id_ref, int gtid,
7230b57cec5SDimitry Andric                                    unsigned short *lhs, unsigned short rhs);
7240b57cec5SDimitry Andric void __kmpc_atomic_fixed2_shl_rev(ident_t *id_ref, int gtid, short *lhs,
7250b57cec5SDimitry Andric                                   short rhs);
7260b57cec5SDimitry Andric void __kmpc_atomic_fixed2_shr_rev(ident_t *id_ref, int gtid, short *lhs,
7270b57cec5SDimitry Andric                                   short rhs);
7280b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_shr_rev(ident_t *id_ref, int gtid,
7290b57cec5SDimitry Andric                                    unsigned short *lhs, unsigned short rhs);
7300b57cec5SDimitry Andric void __kmpc_atomic_fixed4_sub_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
7310b57cec5SDimitry Andric                                   kmp_int32 rhs);
7320b57cec5SDimitry Andric void __kmpc_atomic_fixed4_div_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
7330b57cec5SDimitry Andric                                   kmp_int32 rhs);
7340b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_div_rev(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
7350b57cec5SDimitry Andric                                    kmp_uint32 rhs);
7360b57cec5SDimitry Andric void __kmpc_atomic_fixed4_shl_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
7370b57cec5SDimitry Andric                                   kmp_int32 rhs);
7380b57cec5SDimitry Andric void __kmpc_atomic_fixed4_shr_rev(ident_t *id_ref, int gtid, kmp_int32 *lhs,
7390b57cec5SDimitry Andric                                   kmp_int32 rhs);
7400b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_shr_rev(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
7410b57cec5SDimitry Andric                                    kmp_uint32 rhs);
7420b57cec5SDimitry Andric void __kmpc_atomic_fixed8_sub_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
7430b57cec5SDimitry Andric                                   kmp_int64 rhs);
7440b57cec5SDimitry Andric void __kmpc_atomic_fixed8_div_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
7450b57cec5SDimitry Andric                                   kmp_int64 rhs);
7460b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_div_rev(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
7470b57cec5SDimitry Andric                                    kmp_uint64 rhs);
7480b57cec5SDimitry Andric void __kmpc_atomic_fixed8_shl_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
7490b57cec5SDimitry Andric                                   kmp_int64 rhs);
7500b57cec5SDimitry Andric void __kmpc_atomic_fixed8_shr_rev(ident_t *id_ref, int gtid, kmp_int64 *lhs,
7510b57cec5SDimitry Andric                                   kmp_int64 rhs);
7520b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_shr_rev(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
7530b57cec5SDimitry Andric                                    kmp_uint64 rhs);
7540b57cec5SDimitry Andric void __kmpc_atomic_float4_sub_rev(ident_t *id_ref, int gtid, float *lhs,
7550b57cec5SDimitry Andric                                   float rhs);
7560b57cec5SDimitry Andric void __kmpc_atomic_float4_div_rev(ident_t *id_ref, int gtid, float *lhs,
7570b57cec5SDimitry Andric                                   float rhs);
7580b57cec5SDimitry Andric void __kmpc_atomic_float8_sub_rev(ident_t *id_ref, int gtid, double *lhs,
7590b57cec5SDimitry Andric                                   double rhs);
7600b57cec5SDimitry Andric void __kmpc_atomic_float8_div_rev(ident_t *id_ref, int gtid, double *lhs,
7610b57cec5SDimitry Andric                                   double rhs);
7620b57cec5SDimitry Andric void __kmpc_atomic_float10_sub_rev(ident_t *id_ref, int gtid, long double *lhs,
7630b57cec5SDimitry Andric                                    long double rhs);
7640b57cec5SDimitry Andric void __kmpc_atomic_float10_div_rev(ident_t *id_ref, int gtid, long double *lhs,
7650b57cec5SDimitry Andric                                    long double rhs);
7660b57cec5SDimitry Andric #if KMP_HAVE_QUAD
7670b57cec5SDimitry Andric void __kmpc_atomic_float16_sub_rev(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
7680b57cec5SDimitry Andric                                    QUAD_LEGACY rhs);
7690b57cec5SDimitry Andric void __kmpc_atomic_float16_div_rev(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
7700b57cec5SDimitry Andric                                    QUAD_LEGACY rhs);
7710b57cec5SDimitry Andric #endif
7720b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_sub_rev(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
7730b57cec5SDimitry Andric                                   kmp_cmplx32 rhs);
7740b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_div_rev(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
7750b57cec5SDimitry Andric                                   kmp_cmplx32 rhs);
7760b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_sub_rev(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
7770b57cec5SDimitry Andric                                   kmp_cmplx64 rhs);
7780b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_div_rev(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
7790b57cec5SDimitry Andric                                   kmp_cmplx64 rhs);
7800b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_sub_rev(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
7810b57cec5SDimitry Andric                                    kmp_cmplx80 rhs);
7820b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_div_rev(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
7830b57cec5SDimitry Andric                                    kmp_cmplx80 rhs);
7840b57cec5SDimitry Andric #if KMP_HAVE_QUAD
7850b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_sub_rev(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
7860b57cec5SDimitry Andric                                    CPLX128_LEG rhs);
7870b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_div_rev(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
7880b57cec5SDimitry Andric                                    CPLX128_LEG rhs);
7890b57cec5SDimitry Andric #if (KMP_ARCH_X86)
7900b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary
7910b57cec5SDimitry Andric void __kmpc_atomic_float16_sub_a16_rev(ident_t *id_ref, int gtid,
7920b57cec5SDimitry Andric                                        Quad_a16_t *lhs, Quad_a16_t rhs);
7930b57cec5SDimitry Andric void __kmpc_atomic_float16_div_a16_rev(ident_t *id_ref, int gtid,
7940b57cec5SDimitry Andric                                        Quad_a16_t *lhs, Quad_a16_t rhs);
7950b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_sub_a16_rev(ident_t *id_ref, int gtid,
7960b57cec5SDimitry Andric                                        kmp_cmplx128_a16_t *lhs,
7970b57cec5SDimitry Andric                                        kmp_cmplx128_a16_t rhs);
7980b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_div_a16_rev(ident_t *id_ref, int gtid,
7990b57cec5SDimitry Andric                                        kmp_cmplx128_a16_t *lhs,
8000b57cec5SDimitry Andric                                        kmp_cmplx128_a16_t rhs);
8010b57cec5SDimitry Andric #endif
8020b57cec5SDimitry Andric #endif // KMP_HAVE_QUAD
8030b57cec5SDimitry Andric 
8040b57cec5SDimitry Andric #endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
8050b57cec5SDimitry Andric 
8060b57cec5SDimitry Andric // routines for mixed types
8070b57cec5SDimitry Andric 
8080b57cec5SDimitry Andric // RHS=float8
8090b57cec5SDimitry Andric void __kmpc_atomic_fixed1_mul_float8(ident_t *id_ref, int gtid, char *lhs,
8100b57cec5SDimitry Andric                                      kmp_real64 rhs);
8110b57cec5SDimitry Andric void __kmpc_atomic_fixed1_div_float8(ident_t *id_ref, int gtid, char *lhs,
8120b57cec5SDimitry Andric                                      kmp_real64 rhs);
8130b57cec5SDimitry Andric void __kmpc_atomic_fixed2_mul_float8(ident_t *id_ref, int gtid, short *lhs,
8140b57cec5SDimitry Andric                                      kmp_real64 rhs);
8150b57cec5SDimitry Andric void __kmpc_atomic_fixed2_div_float8(ident_t *id_ref, int gtid, short *lhs,
8160b57cec5SDimitry Andric                                      kmp_real64 rhs);
8170b57cec5SDimitry Andric void __kmpc_atomic_fixed4_mul_float8(ident_t *id_ref, int gtid, kmp_int32 *lhs,
8180b57cec5SDimitry Andric                                      kmp_real64 rhs);
8190b57cec5SDimitry Andric void __kmpc_atomic_fixed4_div_float8(ident_t *id_ref, int gtid, kmp_int32 *lhs,
8200b57cec5SDimitry Andric                                      kmp_real64 rhs);
8210b57cec5SDimitry Andric void __kmpc_atomic_fixed8_mul_float8(ident_t *id_ref, int gtid, kmp_int64 *lhs,
8220b57cec5SDimitry Andric                                      kmp_real64 rhs);
8230b57cec5SDimitry Andric void __kmpc_atomic_fixed8_div_float8(ident_t *id_ref, int gtid, kmp_int64 *lhs,
8240b57cec5SDimitry Andric                                      kmp_real64 rhs);
8250b57cec5SDimitry Andric void __kmpc_atomic_float4_add_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
8260b57cec5SDimitry Andric                                      kmp_real64 rhs);
8270b57cec5SDimitry Andric void __kmpc_atomic_float4_sub_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
8280b57cec5SDimitry Andric                                      kmp_real64 rhs);
8290b57cec5SDimitry Andric void __kmpc_atomic_float4_mul_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
8300b57cec5SDimitry Andric                                      kmp_real64 rhs);
8310b57cec5SDimitry Andric void __kmpc_atomic_float4_div_float8(ident_t *id_ref, int gtid, kmp_real32 *lhs,
8320b57cec5SDimitry Andric                                      kmp_real64 rhs);
8330b57cec5SDimitry Andric 
8340b57cec5SDimitry Andric // RHS=float16 (deprecated, to be removed when we are sure the compiler does not
8350b57cec5SDimitry Andric // use them)
8360b57cec5SDimitry Andric #if KMP_HAVE_QUAD
8370b57cec5SDimitry Andric void __kmpc_atomic_fixed1_add_fp(ident_t *id_ref, int gtid, char *lhs,
8380b57cec5SDimitry Andric                                  _Quad rhs);
8390b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_add_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
8400b57cec5SDimitry Andric                                   _Quad rhs);
8410b57cec5SDimitry Andric void __kmpc_atomic_fixed1_sub_fp(ident_t *id_ref, int gtid, char *lhs,
8420b57cec5SDimitry Andric                                  _Quad rhs);
8430b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_sub_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
8440b57cec5SDimitry Andric                                   _Quad rhs);
8450b57cec5SDimitry Andric void __kmpc_atomic_fixed1_mul_fp(ident_t *id_ref, int gtid, char *lhs,
8460b57cec5SDimitry Andric                                  _Quad rhs);
8470b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_mul_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
8480b57cec5SDimitry Andric                                   _Quad rhs);
8490b57cec5SDimitry Andric void __kmpc_atomic_fixed1_div_fp(ident_t *id_ref, int gtid, char *lhs,
8500b57cec5SDimitry Andric                                  _Quad rhs);
8510b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_div_fp(ident_t *id_ref, int gtid, unsigned char *lhs,
8520b57cec5SDimitry Andric                                   _Quad rhs);
8530b57cec5SDimitry Andric 
8540b57cec5SDimitry Andric void __kmpc_atomic_fixed2_add_fp(ident_t *id_ref, int gtid, short *lhs,
8550b57cec5SDimitry Andric                                  _Quad rhs);
8560b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_add_fp(ident_t *id_ref, int gtid,
8570b57cec5SDimitry Andric                                   unsigned short *lhs, _Quad rhs);
8580b57cec5SDimitry Andric void __kmpc_atomic_fixed2_sub_fp(ident_t *id_ref, int gtid, short *lhs,
8590b57cec5SDimitry Andric                                  _Quad rhs);
8600b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_sub_fp(ident_t *id_ref, int gtid,
8610b57cec5SDimitry Andric                                   unsigned short *lhs, _Quad rhs);
8620b57cec5SDimitry Andric void __kmpc_atomic_fixed2_mul_fp(ident_t *id_ref, int gtid, short *lhs,
8630b57cec5SDimitry Andric                                  _Quad rhs);
8640b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_mul_fp(ident_t *id_ref, int gtid,
8650b57cec5SDimitry Andric                                   unsigned short *lhs, _Quad rhs);
8660b57cec5SDimitry Andric void __kmpc_atomic_fixed2_div_fp(ident_t *id_ref, int gtid, short *lhs,
8670b57cec5SDimitry Andric                                  _Quad rhs);
8680b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_div_fp(ident_t *id_ref, int gtid,
8690b57cec5SDimitry Andric                                   unsigned short *lhs, _Quad rhs);
8700b57cec5SDimitry Andric 
8710b57cec5SDimitry Andric void __kmpc_atomic_fixed4_add_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
8720b57cec5SDimitry Andric                                  _Quad rhs);
8730b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_add_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
8740b57cec5SDimitry Andric                                   _Quad rhs);
8750b57cec5SDimitry Andric void __kmpc_atomic_fixed4_sub_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
8760b57cec5SDimitry Andric                                  _Quad rhs);
8770b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_sub_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
8780b57cec5SDimitry Andric                                   _Quad rhs);
8790b57cec5SDimitry Andric void __kmpc_atomic_fixed4_mul_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
8800b57cec5SDimitry Andric                                  _Quad rhs);
8810b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_mul_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
8820b57cec5SDimitry Andric                                   _Quad rhs);
8830b57cec5SDimitry Andric void __kmpc_atomic_fixed4_div_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
8840b57cec5SDimitry Andric                                  _Quad rhs);
8850b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_div_fp(ident_t *id_ref, int gtid, kmp_uint32 *lhs,
8860b57cec5SDimitry Andric                                   _Quad rhs);
8870b57cec5SDimitry Andric 
8880b57cec5SDimitry Andric void __kmpc_atomic_fixed8_add_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
8890b57cec5SDimitry Andric                                  _Quad rhs);
8900b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_add_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
8910b57cec5SDimitry Andric                                   _Quad rhs);
8920b57cec5SDimitry Andric void __kmpc_atomic_fixed8_sub_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
8930b57cec5SDimitry Andric                                  _Quad rhs);
8940b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_sub_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
8950b57cec5SDimitry Andric                                   _Quad rhs);
8960b57cec5SDimitry Andric void __kmpc_atomic_fixed8_mul_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
8970b57cec5SDimitry Andric                                  _Quad rhs);
8980b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_mul_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
8990b57cec5SDimitry Andric                                   _Quad rhs);
9000b57cec5SDimitry Andric void __kmpc_atomic_fixed8_div_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
9010b57cec5SDimitry Andric                                  _Quad rhs);
9020b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_div_fp(ident_t *id_ref, int gtid, kmp_uint64 *lhs,
9030b57cec5SDimitry Andric                                   _Quad rhs);
9040b57cec5SDimitry Andric 
9050b57cec5SDimitry Andric void __kmpc_atomic_float4_add_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
9060b57cec5SDimitry Andric                                  _Quad rhs);
9070b57cec5SDimitry Andric void __kmpc_atomic_float4_sub_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
9080b57cec5SDimitry Andric                                  _Quad rhs);
9090b57cec5SDimitry Andric void __kmpc_atomic_float4_mul_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
9100b57cec5SDimitry Andric                                  _Quad rhs);
9110b57cec5SDimitry Andric void __kmpc_atomic_float4_div_fp(ident_t *id_ref, int gtid, kmp_real32 *lhs,
9120b57cec5SDimitry Andric                                  _Quad rhs);
9130b57cec5SDimitry Andric 
9140b57cec5SDimitry Andric void __kmpc_atomic_float8_add_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
9150b57cec5SDimitry Andric                                  _Quad rhs);
9160b57cec5SDimitry Andric void __kmpc_atomic_float8_sub_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
9170b57cec5SDimitry Andric                                  _Quad rhs);
9180b57cec5SDimitry Andric void __kmpc_atomic_float8_mul_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
9190b57cec5SDimitry Andric                                  _Quad rhs);
9200b57cec5SDimitry Andric void __kmpc_atomic_float8_div_fp(ident_t *id_ref, int gtid, kmp_real64 *lhs,
9210b57cec5SDimitry Andric                                  _Quad rhs);
9220b57cec5SDimitry Andric 
9230b57cec5SDimitry Andric void __kmpc_atomic_float10_add_fp(ident_t *id_ref, int gtid, long double *lhs,
9240b57cec5SDimitry Andric                                   _Quad rhs);
9250b57cec5SDimitry Andric void __kmpc_atomic_float10_sub_fp(ident_t *id_ref, int gtid, long double *lhs,
9260b57cec5SDimitry Andric                                   _Quad rhs);
9270b57cec5SDimitry Andric void __kmpc_atomic_float10_mul_fp(ident_t *id_ref, int gtid, long double *lhs,
9280b57cec5SDimitry Andric                                   _Quad rhs);
9290b57cec5SDimitry Andric void __kmpc_atomic_float10_div_fp(ident_t *id_ref, int gtid, long double *lhs,
9300b57cec5SDimitry Andric                                   _Quad rhs);
9310b57cec5SDimitry Andric 
9320b57cec5SDimitry Andric // Reverse operations
9330b57cec5SDimitry Andric void __kmpc_atomic_fixed1_sub_rev_fp(ident_t *id_ref, int gtid, char *lhs,
9340b57cec5SDimitry Andric                                      _Quad rhs);
9350b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_sub_rev_fp(ident_t *id_ref, int gtid,
9360b57cec5SDimitry Andric                                       unsigned char *lhs, _Quad rhs);
9370b57cec5SDimitry Andric void __kmpc_atomic_fixed1_div_rev_fp(ident_t *id_ref, int gtid, char *lhs,
9380b57cec5SDimitry Andric                                      _Quad rhs);
9390b57cec5SDimitry Andric void __kmpc_atomic_fixed1u_div_rev_fp(ident_t *id_ref, int gtid,
9400b57cec5SDimitry Andric                                       unsigned char *lhs, _Quad rhs);
9410b57cec5SDimitry Andric void __kmpc_atomic_fixed2_sub_rev_fp(ident_t *id_ref, int gtid, short *lhs,
9420b57cec5SDimitry Andric                                      _Quad rhs);
9430b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_sub_rev_fp(ident_t *id_ref, int gtid,
9440b57cec5SDimitry Andric                                       unsigned short *lhs, _Quad rhs);
9450b57cec5SDimitry Andric void __kmpc_atomic_fixed2_div_rev_fp(ident_t *id_ref, int gtid, short *lhs,
9460b57cec5SDimitry Andric                                      _Quad rhs);
9470b57cec5SDimitry Andric void __kmpc_atomic_fixed2u_div_rev_fp(ident_t *id_ref, int gtid,
9480b57cec5SDimitry Andric                                       unsigned short *lhs, _Quad rhs);
9490b57cec5SDimitry Andric void __kmpc_atomic_fixed4_sub_rev_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
9500b57cec5SDimitry Andric                                      _Quad rhs);
9510b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_sub_rev_fp(ident_t *id_ref, int gtid,
9520b57cec5SDimitry Andric                                       kmp_uint32 *lhs, _Quad rhs);
9530b57cec5SDimitry Andric void __kmpc_atomic_fixed4_div_rev_fp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
9540b57cec5SDimitry Andric                                      _Quad rhs);
9550b57cec5SDimitry Andric void __kmpc_atomic_fixed4u_div_rev_fp(ident_t *id_ref, int gtid,
9560b57cec5SDimitry Andric                                       kmp_uint32 *lhs, _Quad rhs);
9570b57cec5SDimitry Andric void __kmpc_atomic_fixed8_sub_rev_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
9580b57cec5SDimitry Andric                                      _Quad rhs);
9590b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_sub_rev_fp(ident_t *id_ref, int gtid,
9600b57cec5SDimitry Andric                                       kmp_uint64 *lhs, _Quad rhs);
9610b57cec5SDimitry Andric void __kmpc_atomic_fixed8_div_rev_fp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
9620b57cec5SDimitry Andric                                      _Quad rhs);
9630b57cec5SDimitry Andric void __kmpc_atomic_fixed8u_div_rev_fp(ident_t *id_ref, int gtid,
9640b57cec5SDimitry Andric                                       kmp_uint64 *lhs, _Quad rhs);
9650b57cec5SDimitry Andric void __kmpc_atomic_float4_sub_rev_fp(ident_t *id_ref, int gtid, float *lhs,
9660b57cec5SDimitry Andric                                      _Quad rhs);
9670b57cec5SDimitry Andric void __kmpc_atomic_float4_div_rev_fp(ident_t *id_ref, int gtid, float *lhs,
9680b57cec5SDimitry Andric                                      _Quad rhs);
9690b57cec5SDimitry Andric void __kmpc_atomic_float8_sub_rev_fp(ident_t *id_ref, int gtid, double *lhs,
9700b57cec5SDimitry Andric                                      _Quad rhs);
9710b57cec5SDimitry Andric void __kmpc_atomic_float8_div_rev_fp(ident_t *id_ref, int gtid, double *lhs,
9720b57cec5SDimitry Andric                                      _Quad rhs);
9730b57cec5SDimitry Andric void __kmpc_atomic_float10_sub_rev_fp(ident_t *id_ref, int gtid,
9740b57cec5SDimitry Andric                                       long double *lhs, _Quad rhs);
9750b57cec5SDimitry Andric void __kmpc_atomic_float10_div_rev_fp(ident_t *id_ref, int gtid,
9760b57cec5SDimitry Andric                                       long double *lhs, _Quad rhs);
9770b57cec5SDimitry Andric 
9780b57cec5SDimitry Andric #endif // KMP_HAVE_QUAD
9790b57cec5SDimitry Andric 
9800b57cec5SDimitry Andric // RHS=cmplx8
9810b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_add_cmplx8(ident_t *id_ref, int gtid,
9820b57cec5SDimitry Andric                                      kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
9830b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_sub_cmplx8(ident_t *id_ref, int gtid,
9840b57cec5SDimitry Andric                                      kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
9850b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_mul_cmplx8(ident_t *id_ref, int gtid,
9860b57cec5SDimitry Andric                                      kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
9870b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_div_cmplx8(ident_t *id_ref, int gtid,
9880b57cec5SDimitry Andric                                      kmp_cmplx32 *lhs, kmp_cmplx64 rhs);
9890b57cec5SDimitry Andric 
9900b57cec5SDimitry Andric // generic atomic routines
9910b57cec5SDimitry Andric void __kmpc_atomic_1(ident_t *id_ref, int gtid, void *lhs, void *rhs,
9920b57cec5SDimitry Andric                      void (*f)(void *, void *, void *));
9930b57cec5SDimitry Andric void __kmpc_atomic_2(ident_t *id_ref, int gtid, void *lhs, void *rhs,
9940b57cec5SDimitry Andric                      void (*f)(void *, void *, void *));
9950b57cec5SDimitry Andric void __kmpc_atomic_4(ident_t *id_ref, int gtid, void *lhs, void *rhs,
9960b57cec5SDimitry Andric                      void (*f)(void *, void *, void *));
9970b57cec5SDimitry Andric void __kmpc_atomic_8(ident_t *id_ref, int gtid, void *lhs, void *rhs,
9980b57cec5SDimitry Andric                      void (*f)(void *, void *, void *));
9990b57cec5SDimitry Andric void __kmpc_atomic_10(ident_t *id_ref, int gtid, void *lhs, void *rhs,
10000b57cec5SDimitry Andric                       void (*f)(void *, void *, void *));
10010b57cec5SDimitry Andric void __kmpc_atomic_16(ident_t *id_ref, int gtid, void *lhs, void *rhs,
10020b57cec5SDimitry Andric                       void (*f)(void *, void *, void *));
10030b57cec5SDimitry Andric void __kmpc_atomic_20(ident_t *id_ref, int gtid, void *lhs, void *rhs,
10040b57cec5SDimitry Andric                       void (*f)(void *, void *, void *));
10050b57cec5SDimitry Andric void __kmpc_atomic_32(ident_t *id_ref, int gtid, void *lhs, void *rhs,
10060b57cec5SDimitry Andric                       void (*f)(void *, void *, void *));
10070b57cec5SDimitry Andric 
1008*bdd1243dSDimitry Andric // READ, WRITE, CAPTURE
10090b57cec5SDimitry Andric 
10100b57cec5SDimitry Andric //  Below routines for atomic READ are listed
10110b57cec5SDimitry Andric char __kmpc_atomic_fixed1_rd(ident_t *id_ref, int gtid, char *loc);
10120b57cec5SDimitry Andric short __kmpc_atomic_fixed2_rd(ident_t *id_ref, int gtid, short *loc);
10130b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_rd(ident_t *id_ref, int gtid, kmp_int32 *loc);
10140b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_rd(ident_t *id_ref, int gtid, kmp_int64 *loc);
10150b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_rd(ident_t *id_ref, int gtid, kmp_real32 *loc);
10160b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_rd(ident_t *id_ref, int gtid, kmp_real64 *loc);
10170b57cec5SDimitry Andric long double __kmpc_atomic_float10_rd(ident_t *id_ref, int gtid,
10180b57cec5SDimitry Andric                                      long double *loc);
10190b57cec5SDimitry Andric #if KMP_HAVE_QUAD
10200b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_rd(ident_t *id_ref, int gtid,
10210b57cec5SDimitry Andric                                      QUAD_LEGACY *loc);
10220b57cec5SDimitry Andric #endif
10230b57cec5SDimitry Andric // Fix for CQ220361: cmplx4 READ will return void on Windows* OS; read value
10240b57cec5SDimitry Andric // will be returned through an additional parameter
10250b57cec5SDimitry Andric #if (KMP_OS_WINDOWS)
10260b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_rd(kmp_cmplx32 *out, ident_t *id_ref, int gtid,
10270b57cec5SDimitry Andric                              kmp_cmplx32 *loc);
10280b57cec5SDimitry Andric #else
10290b57cec5SDimitry Andric kmp_cmplx32 __kmpc_atomic_cmplx4_rd(ident_t *id_ref, int gtid,
10300b57cec5SDimitry Andric                                     kmp_cmplx32 *loc);
10310b57cec5SDimitry Andric #endif
10320b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_rd(ident_t *id_ref, int gtid,
10330b57cec5SDimitry Andric                                     kmp_cmplx64 *loc);
10340b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_rd(ident_t *id_ref, int gtid,
10350b57cec5SDimitry Andric                                      kmp_cmplx80 *loc);
10360b57cec5SDimitry Andric #if KMP_HAVE_QUAD
10370b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_rd(ident_t *id_ref, int gtid,
10380b57cec5SDimitry Andric                                      CPLX128_LEG *loc);
10390b57cec5SDimitry Andric #if (KMP_ARCH_X86)
10400b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary
10410b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_a16_rd(ident_t *id_ref, int gtid,
10420b57cec5SDimitry Andric                                         Quad_a16_t *loc);
10430b57cec5SDimitry Andric kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_rd(ident_t *id_ref, int gtid,
10440b57cec5SDimitry Andric                                                 kmp_cmplx128_a16_t *loc);
10450b57cec5SDimitry Andric #endif
10460b57cec5SDimitry Andric #endif
10470b57cec5SDimitry Andric 
10480b57cec5SDimitry Andric //  Below routines for atomic WRITE are listed
10490b57cec5SDimitry Andric void __kmpc_atomic_fixed1_wr(ident_t *id_ref, int gtid, char *lhs, char rhs);
10500b57cec5SDimitry Andric void __kmpc_atomic_fixed2_wr(ident_t *id_ref, int gtid, short *lhs, short rhs);
10510b57cec5SDimitry Andric void __kmpc_atomic_fixed4_wr(ident_t *id_ref, int gtid, kmp_int32 *lhs,
10520b57cec5SDimitry Andric                              kmp_int32 rhs);
10530b57cec5SDimitry Andric void __kmpc_atomic_fixed8_wr(ident_t *id_ref, int gtid, kmp_int64 *lhs,
10540b57cec5SDimitry Andric                              kmp_int64 rhs);
10550b57cec5SDimitry Andric void __kmpc_atomic_float4_wr(ident_t *id_ref, int gtid, kmp_real32 *lhs,
10560b57cec5SDimitry Andric                              kmp_real32 rhs);
10570b57cec5SDimitry Andric void __kmpc_atomic_float8_wr(ident_t *id_ref, int gtid, kmp_real64 *lhs,
10580b57cec5SDimitry Andric                              kmp_real64 rhs);
10590b57cec5SDimitry Andric void __kmpc_atomic_float10_wr(ident_t *id_ref, int gtid, long double *lhs,
10600b57cec5SDimitry Andric                               long double rhs);
10610b57cec5SDimitry Andric #if KMP_HAVE_QUAD
10620b57cec5SDimitry Andric void __kmpc_atomic_float16_wr(ident_t *id_ref, int gtid, QUAD_LEGACY *lhs,
10630b57cec5SDimitry Andric                               QUAD_LEGACY rhs);
10640b57cec5SDimitry Andric #endif
10650b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_wr(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
10660b57cec5SDimitry Andric                              kmp_cmplx32 rhs);
10670b57cec5SDimitry Andric void __kmpc_atomic_cmplx8_wr(ident_t *id_ref, int gtid, kmp_cmplx64 *lhs,
10680b57cec5SDimitry Andric                              kmp_cmplx64 rhs);
10690b57cec5SDimitry Andric void __kmpc_atomic_cmplx10_wr(ident_t *id_ref, int gtid, kmp_cmplx80 *lhs,
10700b57cec5SDimitry Andric                               kmp_cmplx80 rhs);
10710b57cec5SDimitry Andric #if KMP_HAVE_QUAD
10720b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_wr(ident_t *id_ref, int gtid, CPLX128_LEG *lhs,
10730b57cec5SDimitry Andric                               CPLX128_LEG rhs);
10740b57cec5SDimitry Andric #if (KMP_ARCH_X86)
10750b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary
10760b57cec5SDimitry Andric void __kmpc_atomic_float16_a16_wr(ident_t *id_ref, int gtid, Quad_a16_t *lhs,
10770b57cec5SDimitry Andric                                   Quad_a16_t rhs);
10780b57cec5SDimitry Andric void __kmpc_atomic_cmplx16_a16_wr(ident_t *id_ref, int gtid,
10790b57cec5SDimitry Andric                                   kmp_cmplx128_a16_t *lhs,
10800b57cec5SDimitry Andric                                   kmp_cmplx128_a16_t rhs);
10810b57cec5SDimitry Andric #endif
10820b57cec5SDimitry Andric #endif
10830b57cec5SDimitry Andric 
10840b57cec5SDimitry Andric //  Below routines for atomic CAPTURE are listed
10850b57cec5SDimitry Andric 
10860b57cec5SDimitry Andric // 1-byte
10870b57cec5SDimitry Andric char __kmpc_atomic_fixed1_add_cpt(ident_t *id_ref, int gtid, char *lhs,
10880b57cec5SDimitry Andric                                   char rhs, int flag);
10890b57cec5SDimitry Andric char __kmpc_atomic_fixed1_andb_cpt(ident_t *id_ref, int gtid, char *lhs,
10900b57cec5SDimitry Andric                                    char rhs, int flag);
10910b57cec5SDimitry Andric char __kmpc_atomic_fixed1_div_cpt(ident_t *id_ref, int gtid, char *lhs,
10920b57cec5SDimitry Andric                                   char rhs, int flag);
10930b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_div_cpt(ident_t *id_ref, int gtid,
10940b57cec5SDimitry Andric                                             unsigned char *lhs,
10950b57cec5SDimitry Andric                                             unsigned char rhs, int flag);
10960b57cec5SDimitry Andric char __kmpc_atomic_fixed1_mul_cpt(ident_t *id_ref, int gtid, char *lhs,
10970b57cec5SDimitry Andric                                   char rhs, int flag);
10980b57cec5SDimitry Andric char __kmpc_atomic_fixed1_orb_cpt(ident_t *id_ref, int gtid, char *lhs,
10990b57cec5SDimitry Andric                                   char rhs, int flag);
11000b57cec5SDimitry Andric char __kmpc_atomic_fixed1_shl_cpt(ident_t *id_ref, int gtid, char *lhs,
11010b57cec5SDimitry Andric                                   char rhs, int flag);
11020b57cec5SDimitry Andric char __kmpc_atomic_fixed1_shr_cpt(ident_t *id_ref, int gtid, char *lhs,
11030b57cec5SDimitry Andric                                   char rhs, int flag);
11040b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_shr_cpt(ident_t *id_ref, int gtid,
11050b57cec5SDimitry Andric                                             unsigned char *lhs,
11060b57cec5SDimitry Andric                                             unsigned char rhs, int flag);
11070b57cec5SDimitry Andric char __kmpc_atomic_fixed1_sub_cpt(ident_t *id_ref, int gtid, char *lhs,
11080b57cec5SDimitry Andric                                   char rhs, int flag);
11090b57cec5SDimitry Andric char __kmpc_atomic_fixed1_xor_cpt(ident_t *id_ref, int gtid, char *lhs,
11100b57cec5SDimitry Andric                                   char rhs, int flag);
11110b57cec5SDimitry Andric // 2-byte
11120b57cec5SDimitry Andric short __kmpc_atomic_fixed2_add_cpt(ident_t *id_ref, int gtid, short *lhs,
11130b57cec5SDimitry Andric                                    short rhs, int flag);
11140b57cec5SDimitry Andric short __kmpc_atomic_fixed2_andb_cpt(ident_t *id_ref, int gtid, short *lhs,
11150b57cec5SDimitry Andric                                     short rhs, int flag);
11160b57cec5SDimitry Andric short __kmpc_atomic_fixed2_div_cpt(ident_t *id_ref, int gtid, short *lhs,
11170b57cec5SDimitry Andric                                    short rhs, int flag);
11180b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_div_cpt(ident_t *id_ref, int gtid,
11190b57cec5SDimitry Andric                                              unsigned short *lhs,
11200b57cec5SDimitry Andric                                              unsigned short rhs, int flag);
11210b57cec5SDimitry Andric short __kmpc_atomic_fixed2_mul_cpt(ident_t *id_ref, int gtid, short *lhs,
11220b57cec5SDimitry Andric                                    short rhs, int flag);
11230b57cec5SDimitry Andric short __kmpc_atomic_fixed2_orb_cpt(ident_t *id_ref, int gtid, short *lhs,
11240b57cec5SDimitry Andric                                    short rhs, int flag);
11250b57cec5SDimitry Andric short __kmpc_atomic_fixed2_shl_cpt(ident_t *id_ref, int gtid, short *lhs,
11260b57cec5SDimitry Andric                                    short rhs, int flag);
11270b57cec5SDimitry Andric short __kmpc_atomic_fixed2_shr_cpt(ident_t *id_ref, int gtid, short *lhs,
11280b57cec5SDimitry Andric                                    short rhs, int flag);
11290b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_shr_cpt(ident_t *id_ref, int gtid,
11300b57cec5SDimitry Andric                                              unsigned short *lhs,
11310b57cec5SDimitry Andric                                              unsigned short rhs, int flag);
11320b57cec5SDimitry Andric short __kmpc_atomic_fixed2_sub_cpt(ident_t *id_ref, int gtid, short *lhs,
11330b57cec5SDimitry Andric                                    short rhs, int flag);
11340b57cec5SDimitry Andric short __kmpc_atomic_fixed2_xor_cpt(ident_t *id_ref, int gtid, short *lhs,
11350b57cec5SDimitry Andric                                    short rhs, int flag);
11360b57cec5SDimitry Andric // 4-byte add / sub fixed
11370b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_add_cpt(ident_t *id_ref, int gtid,
11380b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11390b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_sub_cpt(ident_t *id_ref, int gtid,
11400b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11410b57cec5SDimitry Andric // 4-byte add / sub float
11420b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_add_cpt(ident_t *id_ref, int gtid,
11430b57cec5SDimitry Andric                                         kmp_real32 *lhs, kmp_real32 rhs,
11440b57cec5SDimitry Andric                                         int flag);
11450b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_sub_cpt(ident_t *id_ref, int gtid,
11460b57cec5SDimitry Andric                                         kmp_real32 *lhs, kmp_real32 rhs,
11470b57cec5SDimitry Andric                                         int flag);
11480b57cec5SDimitry Andric // 8-byte add / sub fixed
11490b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_add_cpt(ident_t *id_ref, int gtid,
11500b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11510b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_sub_cpt(ident_t *id_ref, int gtid,
11520b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11530b57cec5SDimitry Andric // 8-byte add / sub float
11540b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_add_cpt(ident_t *id_ref, int gtid,
11550b57cec5SDimitry Andric                                         kmp_real64 *lhs, kmp_real64 rhs,
11560b57cec5SDimitry Andric                                         int flag);
11570b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_sub_cpt(ident_t *id_ref, int gtid,
11580b57cec5SDimitry Andric                                         kmp_real64 *lhs, kmp_real64 rhs,
11590b57cec5SDimitry Andric                                         int flag);
11600b57cec5SDimitry Andric // 4-byte fixed
11610b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_andb_cpt(ident_t *id_ref, int gtid,
11620b57cec5SDimitry Andric                                         kmp_int32 *lhs, kmp_int32 rhs,
11630b57cec5SDimitry Andric                                         int flag);
11640b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_div_cpt(ident_t *id_ref, int gtid,
11650b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11660b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_div_cpt(ident_t *id_ref, int gtid,
11670b57cec5SDimitry Andric                                          kmp_uint32 *lhs, kmp_uint32 rhs,
11680b57cec5SDimitry Andric                                          int flag);
11690b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_mul_cpt(ident_t *id_ref, int gtid,
11700b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11710b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_orb_cpt(ident_t *id_ref, int gtid,
11720b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11730b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_shl_cpt(ident_t *id_ref, int gtid,
11740b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11750b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_shr_cpt(ident_t *id_ref, int gtid,
11760b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11770b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_shr_cpt(ident_t *id_ref, int gtid,
11780b57cec5SDimitry Andric                                          kmp_uint32 *lhs, kmp_uint32 rhs,
11790b57cec5SDimitry Andric                                          int flag);
11800b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_xor_cpt(ident_t *id_ref, int gtid,
11810b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
11820b57cec5SDimitry Andric // 8-byte fixed
11830b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_andb_cpt(ident_t *id_ref, int gtid,
11840b57cec5SDimitry Andric                                         kmp_int64 *lhs, kmp_int64 rhs,
11850b57cec5SDimitry Andric                                         int flag);
11860b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_div_cpt(ident_t *id_ref, int gtid,
11870b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11880b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_div_cpt(ident_t *id_ref, int gtid,
11890b57cec5SDimitry Andric                                          kmp_uint64 *lhs, kmp_uint64 rhs,
11900b57cec5SDimitry Andric                                          int flag);
11910b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_mul_cpt(ident_t *id_ref, int gtid,
11920b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11930b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_orb_cpt(ident_t *id_ref, int gtid,
11940b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11950b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_shl_cpt(ident_t *id_ref, int gtid,
11960b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11970b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_shr_cpt(ident_t *id_ref, int gtid,
11980b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
11990b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_shr_cpt(ident_t *id_ref, int gtid,
12000b57cec5SDimitry Andric                                          kmp_uint64 *lhs, kmp_uint64 rhs,
12010b57cec5SDimitry Andric                                          int flag);
12020b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_xor_cpt(ident_t *id_ref, int gtid,
12030b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
12040b57cec5SDimitry Andric // 4-byte float
12050b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_div_cpt(ident_t *id_ref, int gtid,
12060b57cec5SDimitry Andric                                         kmp_real32 *lhs, kmp_real32 rhs,
12070b57cec5SDimitry Andric                                         int flag);
12080b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_mul_cpt(ident_t *id_ref, int gtid,
12090b57cec5SDimitry Andric                                         kmp_real32 *lhs, kmp_real32 rhs,
12100b57cec5SDimitry Andric                                         int flag);
12110b57cec5SDimitry Andric // 8-byte float
12120b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_div_cpt(ident_t *id_ref, int gtid,
12130b57cec5SDimitry Andric                                         kmp_real64 *lhs, kmp_real64 rhs,
12140b57cec5SDimitry Andric                                         int flag);
12150b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_mul_cpt(ident_t *id_ref, int gtid,
12160b57cec5SDimitry Andric                                         kmp_real64 *lhs, kmp_real64 rhs,
12170b57cec5SDimitry Andric                                         int flag);
12180b57cec5SDimitry Andric // 1-, 2-, 4-, 8-byte logical (&&, ||)
12190b57cec5SDimitry Andric char __kmpc_atomic_fixed1_andl_cpt(ident_t *id_ref, int gtid, char *lhs,
12200b57cec5SDimitry Andric                                    char rhs, int flag);
12210b57cec5SDimitry Andric char __kmpc_atomic_fixed1_orl_cpt(ident_t *id_ref, int gtid, char *lhs,
12220b57cec5SDimitry Andric                                   char rhs, int flag);
12230b57cec5SDimitry Andric short __kmpc_atomic_fixed2_andl_cpt(ident_t *id_ref, int gtid, short *lhs,
12240b57cec5SDimitry Andric                                     short rhs, int flag);
12250b57cec5SDimitry Andric short __kmpc_atomic_fixed2_orl_cpt(ident_t *id_ref, int gtid, short *lhs,
12260b57cec5SDimitry Andric                                    short rhs, int flag);
12270b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_andl_cpt(ident_t *id_ref, int gtid,
12280b57cec5SDimitry Andric                                         kmp_int32 *lhs, kmp_int32 rhs,
12290b57cec5SDimitry Andric                                         int flag);
12300b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_orl_cpt(ident_t *id_ref, int gtid,
12310b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
12320b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_andl_cpt(ident_t *id_ref, int gtid,
12330b57cec5SDimitry Andric                                         kmp_int64 *lhs, kmp_int64 rhs,
12340b57cec5SDimitry Andric                                         int flag);
12350b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_orl_cpt(ident_t *id_ref, int gtid,
12360b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
12370b57cec5SDimitry Andric // MIN / MAX
12380b57cec5SDimitry Andric char __kmpc_atomic_fixed1_max_cpt(ident_t *id_ref, int gtid, char *lhs,
12390b57cec5SDimitry Andric                                   char rhs, int flag);
12400b57cec5SDimitry Andric char __kmpc_atomic_fixed1_min_cpt(ident_t *id_ref, int gtid, char *lhs,
12410b57cec5SDimitry Andric                                   char rhs, int flag);
12420b57cec5SDimitry Andric short __kmpc_atomic_fixed2_max_cpt(ident_t *id_ref, int gtid, short *lhs,
12430b57cec5SDimitry Andric                                    short rhs, int flag);
12440b57cec5SDimitry Andric short __kmpc_atomic_fixed2_min_cpt(ident_t *id_ref, int gtid, short *lhs,
12450b57cec5SDimitry Andric                                    short rhs, int flag);
12460b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_max_cpt(ident_t *id_ref, int gtid,
12470b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
12480b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_min_cpt(ident_t *id_ref, int gtid,
12490b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
12500b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_max_cpt(ident_t *id_ref, int gtid,
12510b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
12520b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_min_cpt(ident_t *id_ref, int gtid,
12530b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
12540b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_max_cpt(ident_t *id_ref, int gtid,
12550b57cec5SDimitry Andric                                         kmp_real32 *lhs, kmp_real32 rhs,
12560b57cec5SDimitry Andric                                         int flag);
12570b57cec5SDimitry Andric kmp_real32 __kmpc_atomic_float4_min_cpt(ident_t *id_ref, int gtid,
12580b57cec5SDimitry Andric                                         kmp_real32 *lhs, kmp_real32 rhs,
12590b57cec5SDimitry Andric                                         int flag);
12600b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_max_cpt(ident_t *id_ref, int gtid,
12610b57cec5SDimitry Andric                                         kmp_real64 *lhs, kmp_real64 rhs,
12620b57cec5SDimitry Andric                                         int flag);
12630b57cec5SDimitry Andric kmp_real64 __kmpc_atomic_float8_min_cpt(ident_t *id_ref, int gtid,
12640b57cec5SDimitry Andric                                         kmp_real64 *lhs, kmp_real64 rhs,
12650b57cec5SDimitry Andric                                         int flag);
1266349cc55cSDimitry Andric long double __kmpc_atomic_float10_max_cpt(ident_t *id_ref, int gtid,
1267349cc55cSDimitry Andric                                           long double *lhs, long double rhs,
1268349cc55cSDimitry Andric                                           int flag);
1269349cc55cSDimitry Andric long double __kmpc_atomic_float10_min_cpt(ident_t *id_ref, int gtid,
1270349cc55cSDimitry Andric                                           long double *lhs, long double rhs,
1271349cc55cSDimitry Andric                                           int flag);
12720b57cec5SDimitry Andric #if KMP_HAVE_QUAD
12730b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_max_cpt(ident_t *id_ref, int gtid,
12740b57cec5SDimitry Andric                                           QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
12750b57cec5SDimitry Andric                                           int flag);
12760b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_min_cpt(ident_t *id_ref, int gtid,
12770b57cec5SDimitry Andric                                           QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
12780b57cec5SDimitry Andric                                           int flag);
12790b57cec5SDimitry Andric #endif
12800b57cec5SDimitry Andric // .NEQV. (same as xor)
12810b57cec5SDimitry Andric char __kmpc_atomic_fixed1_neqv_cpt(ident_t *id_ref, int gtid, char *lhs,
12820b57cec5SDimitry Andric                                    char rhs, int flag);
12830b57cec5SDimitry Andric short __kmpc_atomic_fixed2_neqv_cpt(ident_t *id_ref, int gtid, short *lhs,
12840b57cec5SDimitry Andric                                     short rhs, int flag);
12850b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_neqv_cpt(ident_t *id_ref, int gtid,
12860b57cec5SDimitry Andric                                         kmp_int32 *lhs, kmp_int32 rhs,
12870b57cec5SDimitry Andric                                         int flag);
12880b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_neqv_cpt(ident_t *id_ref, int gtid,
12890b57cec5SDimitry Andric                                         kmp_int64 *lhs, kmp_int64 rhs,
12900b57cec5SDimitry Andric                                         int flag);
12910b57cec5SDimitry Andric // .EQV. (same as ~xor)
12920b57cec5SDimitry Andric char __kmpc_atomic_fixed1_eqv_cpt(ident_t *id_ref, int gtid, char *lhs,
12930b57cec5SDimitry Andric                                   char rhs, int flag);
12940b57cec5SDimitry Andric short __kmpc_atomic_fixed2_eqv_cpt(ident_t *id_ref, int gtid, short *lhs,
12950b57cec5SDimitry Andric                                    short rhs, int flag);
12960b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_eqv_cpt(ident_t *id_ref, int gtid,
12970b57cec5SDimitry Andric                                        kmp_int32 *lhs, kmp_int32 rhs, int flag);
12980b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_eqv_cpt(ident_t *id_ref, int gtid,
12990b57cec5SDimitry Andric                                        kmp_int64 *lhs, kmp_int64 rhs, int flag);
13000b57cec5SDimitry Andric // long double type
13010b57cec5SDimitry Andric long double __kmpc_atomic_float10_add_cpt(ident_t *id_ref, int gtid,
13020b57cec5SDimitry Andric                                           long double *lhs, long double rhs,
13030b57cec5SDimitry Andric                                           int flag);
13040b57cec5SDimitry Andric long double __kmpc_atomic_float10_sub_cpt(ident_t *id_ref, int gtid,
13050b57cec5SDimitry Andric                                           long double *lhs, long double rhs,
13060b57cec5SDimitry Andric                                           int flag);
13070b57cec5SDimitry Andric long double __kmpc_atomic_float10_mul_cpt(ident_t *id_ref, int gtid,
13080b57cec5SDimitry Andric                                           long double *lhs, long double rhs,
13090b57cec5SDimitry Andric                                           int flag);
13100b57cec5SDimitry Andric long double __kmpc_atomic_float10_div_cpt(ident_t *id_ref, int gtid,
13110b57cec5SDimitry Andric                                           long double *lhs, long double rhs,
13120b57cec5SDimitry Andric                                           int flag);
13130b57cec5SDimitry Andric #if KMP_HAVE_QUAD
13140b57cec5SDimitry Andric // _Quad type
13150b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_add_cpt(ident_t *id_ref, int gtid,
13160b57cec5SDimitry Andric                                           QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
13170b57cec5SDimitry Andric                                           int flag);
13180b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_sub_cpt(ident_t *id_ref, int gtid,
13190b57cec5SDimitry Andric                                           QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
13200b57cec5SDimitry Andric                                           int flag);
13210b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_mul_cpt(ident_t *id_ref, int gtid,
13220b57cec5SDimitry Andric                                           QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
13230b57cec5SDimitry Andric                                           int flag);
13240b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_div_cpt(ident_t *id_ref, int gtid,
13250b57cec5SDimitry Andric                                           QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
13260b57cec5SDimitry Andric                                           int flag);
13270b57cec5SDimitry Andric #endif
13280b57cec5SDimitry Andric // routines for complex types
13290b57cec5SDimitry Andric // Workaround for cmplx4 routines - return void; captured value is returned via
13300b57cec5SDimitry Andric // the argument
13310b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_add_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
13320b57cec5SDimitry Andric                                   kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
13330b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_sub_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
13340b57cec5SDimitry Andric                                   kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
13350b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_mul_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
13360b57cec5SDimitry Andric                                   kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
13370b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_div_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
13380b57cec5SDimitry Andric                                   kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
13390b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_add_cpt(ident_t *id_ref, int gtid,
13400b57cec5SDimitry Andric                                          kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
13410b57cec5SDimitry Andric                                          int flag);
13420b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_sub_cpt(ident_t *id_ref, int gtid,
13430b57cec5SDimitry Andric                                          kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
13440b57cec5SDimitry Andric                                          int flag);
13450b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_mul_cpt(ident_t *id_ref, int gtid,
13460b57cec5SDimitry Andric                                          kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
13470b57cec5SDimitry Andric                                          int flag);
13480b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_div_cpt(ident_t *id_ref, int gtid,
13490b57cec5SDimitry Andric                                          kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
13500b57cec5SDimitry Andric                                          int flag);
13510b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_add_cpt(ident_t *id_ref, int gtid,
13520b57cec5SDimitry Andric                                           kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
13530b57cec5SDimitry Andric                                           int flag);
13540b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_sub_cpt(ident_t *id_ref, int gtid,
13550b57cec5SDimitry Andric                                           kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
13560b57cec5SDimitry Andric                                           int flag);
13570b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_mul_cpt(ident_t *id_ref, int gtid,
13580b57cec5SDimitry Andric                                           kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
13590b57cec5SDimitry Andric                                           int flag);
13600b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_div_cpt(ident_t *id_ref, int gtid,
13610b57cec5SDimitry Andric                                           kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
13620b57cec5SDimitry Andric                                           int flag);
13630b57cec5SDimitry Andric #if KMP_HAVE_QUAD
13640b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_add_cpt(ident_t *id_ref, int gtid,
13650b57cec5SDimitry Andric                                           CPLX128_LEG *lhs, CPLX128_LEG rhs,
13660b57cec5SDimitry Andric                                           int flag);
13670b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_sub_cpt(ident_t *id_ref, int gtid,
13680b57cec5SDimitry Andric                                           CPLX128_LEG *lhs, CPLX128_LEG rhs,
13690b57cec5SDimitry Andric                                           int flag);
13700b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_mul_cpt(ident_t *id_ref, int gtid,
13710b57cec5SDimitry Andric                                           CPLX128_LEG *lhs, CPLX128_LEG rhs,
13720b57cec5SDimitry Andric                                           int flag);
13730b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_div_cpt(ident_t *id_ref, int gtid,
13740b57cec5SDimitry Andric                                           CPLX128_LEG *lhs, CPLX128_LEG rhs,
13750b57cec5SDimitry Andric                                           int flag);
13760b57cec5SDimitry Andric #if (KMP_ARCH_X86)
13770b57cec5SDimitry Andric // Routines with 16-byte arguments aligned to 16-byte boundary
13780b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_add_a16_cpt(ident_t *id_ref, int gtid,
13790b57cec5SDimitry Andric                                              Quad_a16_t *lhs, Quad_a16_t rhs,
13800b57cec5SDimitry Andric                                              int flag);
13810b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_sub_a16_cpt(ident_t *id_ref, int gtid,
13820b57cec5SDimitry Andric                                              Quad_a16_t *lhs, Quad_a16_t rhs,
13830b57cec5SDimitry Andric                                              int flag);
13840b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_mul_a16_cpt(ident_t *id_ref, int gtid,
13850b57cec5SDimitry Andric                                              Quad_a16_t *lhs, Quad_a16_t rhs,
13860b57cec5SDimitry Andric                                              int flag);
13870b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_div_a16_cpt(ident_t *id_ref, int gtid,
13880b57cec5SDimitry Andric                                              Quad_a16_t *lhs, Quad_a16_t rhs,
13890b57cec5SDimitry Andric                                              int flag);
13900b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_max_a16_cpt(ident_t *id_ref, int gtid,
13910b57cec5SDimitry Andric                                              Quad_a16_t *lhs, Quad_a16_t rhs,
13920b57cec5SDimitry Andric                                              int flag);
13930b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_min_a16_cpt(ident_t *id_ref, int gtid,
13940b57cec5SDimitry Andric                                              Quad_a16_t *lhs, Quad_a16_t rhs,
13950b57cec5SDimitry Andric                                              int flag);
13960b57cec5SDimitry Andric kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_add_a16_cpt(ident_t *id_ref, int gtid,
13970b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t *lhs,
13980b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t rhs,
13990b57cec5SDimitry Andric                                                      int flag);
14000b57cec5SDimitry Andric kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_sub_a16_cpt(ident_t *id_ref, int gtid,
14010b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t *lhs,
14020b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t rhs,
14030b57cec5SDimitry Andric                                                      int flag);
14040b57cec5SDimitry Andric kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_mul_a16_cpt(ident_t *id_ref, int gtid,
14050b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t *lhs,
14060b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t rhs,
14070b57cec5SDimitry Andric                                                      int flag);
14080b57cec5SDimitry Andric kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_div_a16_cpt(ident_t *id_ref, int gtid,
14090b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t *lhs,
14100b57cec5SDimitry Andric                                                      kmp_cmplx128_a16_t rhs,
14110b57cec5SDimitry Andric                                                      int flag);
14120b57cec5SDimitry Andric #endif
14130b57cec5SDimitry Andric #endif
14140b57cec5SDimitry Andric 
14150b57cec5SDimitry Andric void __kmpc_atomic_start(void);
14160b57cec5SDimitry Andric void __kmpc_atomic_end(void);
14170b57cec5SDimitry Andric 
14180b57cec5SDimitry Andric // OpenMP 4.0: v = x = expr binop x; { v = x; x = expr binop x; } { x = expr
14190b57cec5SDimitry Andric // binop x; v = x; }  for non-commutative operations.
1420*bdd1243dSDimitry Andric #if KMP_ARCH_X86 || KMP_ARCH_X86_64
14210b57cec5SDimitry Andric char __kmpc_atomic_fixed1_sub_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
14220b57cec5SDimitry Andric                                       char rhs, int flag);
14230b57cec5SDimitry Andric char __kmpc_atomic_fixed1_div_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
14240b57cec5SDimitry Andric                                       char rhs, int flag);
14250b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_div_cpt_rev(ident_t *id_ref, int gtid,
14260b57cec5SDimitry Andric                                                 unsigned char *lhs,
14270b57cec5SDimitry Andric                                                 unsigned char rhs, int flag);
14280b57cec5SDimitry Andric char __kmpc_atomic_fixed1_shl_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
14290b57cec5SDimitry Andric                                       char rhs, int flag);
14300b57cec5SDimitry Andric char __kmpc_atomic_fixed1_shr_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
14310b57cec5SDimitry Andric                                       char rhs, int flag);
14320b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_shr_cpt_rev(ident_t *id_ref, int gtid,
14330b57cec5SDimitry Andric                                                 unsigned char *lhs,
14340b57cec5SDimitry Andric                                                 unsigned char rhs, int flag);
14350b57cec5SDimitry Andric short __kmpc_atomic_fixed2_sub_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
14360b57cec5SDimitry Andric                                        short rhs, int flag);
14370b57cec5SDimitry Andric short __kmpc_atomic_fixed2_div_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
14380b57cec5SDimitry Andric                                        short rhs, int flag);
14390b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_div_cpt_rev(ident_t *id_ref, int gtid,
14400b57cec5SDimitry Andric                                                  unsigned short *lhs,
14410b57cec5SDimitry Andric                                                  unsigned short rhs, int flag);
14420b57cec5SDimitry Andric short __kmpc_atomic_fixed2_shl_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
14430b57cec5SDimitry Andric                                        short rhs, int flag);
14440b57cec5SDimitry Andric short __kmpc_atomic_fixed2_shr_cpt_rev(ident_t *id_ref, int gtid, short *lhs,
14450b57cec5SDimitry Andric                                        short rhs, int flag);
14460b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_shr_cpt_rev(ident_t *id_ref, int gtid,
14470b57cec5SDimitry Andric                                                  unsigned short *lhs,
14480b57cec5SDimitry Andric                                                  unsigned short rhs, int flag);
14490b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_sub_cpt_rev(ident_t *id_ref, int gtid,
14500b57cec5SDimitry Andric                                            kmp_int32 *lhs, kmp_int32 rhs,
14510b57cec5SDimitry Andric                                            int flag);
14520b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_div_cpt_rev(ident_t *id_ref, int gtid,
14530b57cec5SDimitry Andric                                            kmp_int32 *lhs, kmp_int32 rhs,
14540b57cec5SDimitry Andric                                            int flag);
14550b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_rev(ident_t *id_ref, int gtid,
14560b57cec5SDimitry Andric                                              kmp_uint32 *lhs, kmp_uint32 rhs,
14570b57cec5SDimitry Andric                                              int flag);
14580b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_shl_cpt_rev(ident_t *id_ref, int gtid,
14590b57cec5SDimitry Andric                                            kmp_int32 *lhs, kmp_int32 rhs,
14600b57cec5SDimitry Andric                                            int flag);
14610b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_shr_cpt_rev(ident_t *id_ref, int gtid,
14620b57cec5SDimitry Andric                                            kmp_int32 *lhs, kmp_int32 rhs,
14630b57cec5SDimitry Andric                                            int flag);
14640b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_shr_cpt_rev(ident_t *id_ref, int gtid,
14650b57cec5SDimitry Andric                                              kmp_uint32 *lhs, kmp_uint32 rhs,
14660b57cec5SDimitry Andric                                              int flag);
14670b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_sub_cpt_rev(ident_t *id_ref, int gtid,
14680b57cec5SDimitry Andric                                            kmp_int64 *lhs, kmp_int64 rhs,
14690b57cec5SDimitry Andric                                            int flag);
14700b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_div_cpt_rev(ident_t *id_ref, int gtid,
14710b57cec5SDimitry Andric                                            kmp_int64 *lhs, kmp_int64 rhs,
14720b57cec5SDimitry Andric                                            int flag);
14730b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_rev(ident_t *id_ref, int gtid,
14740b57cec5SDimitry Andric                                              kmp_uint64 *lhs, kmp_uint64 rhs,
14750b57cec5SDimitry Andric                                              int flag);
14760b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_shl_cpt_rev(ident_t *id_ref, int gtid,
14770b57cec5SDimitry Andric                                            kmp_int64 *lhs, kmp_int64 rhs,
14780b57cec5SDimitry Andric                                            int flag);
14790b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_shr_cpt_rev(ident_t *id_ref, int gtid,
14800b57cec5SDimitry Andric                                            kmp_int64 *lhs, kmp_int64 rhs,
14810b57cec5SDimitry Andric                                            int flag);
14820b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_shr_cpt_rev(ident_t *id_ref, int gtid,
14830b57cec5SDimitry Andric                                              kmp_uint64 *lhs, kmp_uint64 rhs,
14840b57cec5SDimitry Andric                                              int flag);
14850b57cec5SDimitry Andric float __kmpc_atomic_float4_sub_cpt_rev(ident_t *id_ref, int gtid, float *lhs,
14860b57cec5SDimitry Andric                                        float rhs, int flag);
14870b57cec5SDimitry Andric float __kmpc_atomic_float4_div_cpt_rev(ident_t *id_ref, int gtid, float *lhs,
14880b57cec5SDimitry Andric                                        float rhs, int flag);
14890b57cec5SDimitry Andric double __kmpc_atomic_float8_sub_cpt_rev(ident_t *id_ref, int gtid, double *lhs,
14900b57cec5SDimitry Andric                                         double rhs, int flag);
14910b57cec5SDimitry Andric double __kmpc_atomic_float8_div_cpt_rev(ident_t *id_ref, int gtid, double *lhs,
14920b57cec5SDimitry Andric                                         double rhs, int flag);
14930b57cec5SDimitry Andric long double __kmpc_atomic_float10_sub_cpt_rev(ident_t *id_ref, int gtid,
14940b57cec5SDimitry Andric                                               long double *lhs, long double rhs,
14950b57cec5SDimitry Andric                                               int flag);
14960b57cec5SDimitry Andric long double __kmpc_atomic_float10_div_cpt_rev(ident_t *id_ref, int gtid,
14970b57cec5SDimitry Andric                                               long double *lhs, long double rhs,
14980b57cec5SDimitry Andric                                               int flag);
14990b57cec5SDimitry Andric #if KMP_HAVE_QUAD
15000b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_sub_cpt_rev(ident_t *id_ref, int gtid,
15010b57cec5SDimitry Andric                                               QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
15020b57cec5SDimitry Andric                                               int flag);
15030b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_div_cpt_rev(ident_t *id_ref, int gtid,
15040b57cec5SDimitry Andric                                               QUAD_LEGACY *lhs, QUAD_LEGACY rhs,
15050b57cec5SDimitry Andric                                               int flag);
15060b57cec5SDimitry Andric #endif
15070b57cec5SDimitry Andric // Workaround for cmplx4 routines - return void; captured value is returned via
15080b57cec5SDimitry Andric // the argument
15090b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_sub_cpt_rev(ident_t *id_ref, int gtid,
15100b57cec5SDimitry Andric                                       kmp_cmplx32 *lhs, kmp_cmplx32 rhs,
15110b57cec5SDimitry Andric                                       kmp_cmplx32 *out, int flag);
15120b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_div_cpt_rev(ident_t *id_ref, int gtid,
15130b57cec5SDimitry Andric                                       kmp_cmplx32 *lhs, kmp_cmplx32 rhs,
15140b57cec5SDimitry Andric                                       kmp_cmplx32 *out, int flag);
15150b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_sub_cpt_rev(ident_t *id_ref, int gtid,
15160b57cec5SDimitry Andric                                              kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
15170b57cec5SDimitry Andric                                              int flag);
15180b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_div_cpt_rev(ident_t *id_ref, int gtid,
15190b57cec5SDimitry Andric                                              kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
15200b57cec5SDimitry Andric                                              int flag);
15210b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_sub_cpt_rev(ident_t *id_ref, int gtid,
15220b57cec5SDimitry Andric                                               kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
15230b57cec5SDimitry Andric                                               int flag);
15240b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_div_cpt_rev(ident_t *id_ref, int gtid,
15250b57cec5SDimitry Andric                                               kmp_cmplx80 *lhs, kmp_cmplx80 rhs,
15260b57cec5SDimitry Andric                                               int flag);
15270b57cec5SDimitry Andric #if KMP_HAVE_QUAD
15280b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_sub_cpt_rev(ident_t *id_ref, int gtid,
15290b57cec5SDimitry Andric                                               CPLX128_LEG *lhs, CPLX128_LEG rhs,
15300b57cec5SDimitry Andric                                               int flag);
15310b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_div_cpt_rev(ident_t *id_ref, int gtid,
15320b57cec5SDimitry Andric                                               CPLX128_LEG *lhs, CPLX128_LEG rhs,
15330b57cec5SDimitry Andric                                               int flag);
15340b57cec5SDimitry Andric #if (KMP_ARCH_X86)
15350b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_sub_a16_cpt_rev(ident_t *id_ref, int gtid,
15360b57cec5SDimitry Andric                                                  Quad_a16_t *lhs,
15370b57cec5SDimitry Andric                                                  Quad_a16_t rhs, int flag);
15380b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_div_a16_cpt_rev(ident_t *id_ref, int gtid,
15390b57cec5SDimitry Andric                                                  Quad_a16_t *lhs,
15400b57cec5SDimitry Andric                                                  Quad_a16_t rhs, int flag);
15410b57cec5SDimitry Andric kmp_cmplx128_a16_t
15420b57cec5SDimitry Andric __kmpc_atomic_cmplx16_sub_a16_cpt_rev(ident_t *id_ref, int gtid,
15430b57cec5SDimitry Andric                                       kmp_cmplx128_a16_t *lhs,
15440b57cec5SDimitry Andric                                       kmp_cmplx128_a16_t rhs, int flag);
15450b57cec5SDimitry Andric kmp_cmplx128_a16_t
15460b57cec5SDimitry Andric __kmpc_atomic_cmplx16_div_a16_cpt_rev(ident_t *id_ref, int gtid,
15470b57cec5SDimitry Andric                                       kmp_cmplx128_a16_t *lhs,
15480b57cec5SDimitry Andric                                       kmp_cmplx128_a16_t rhs, int flag);
15490b57cec5SDimitry Andric #endif
15500b57cec5SDimitry Andric #endif
15510b57cec5SDimitry Andric 
15520b57cec5SDimitry Andric //   OpenMP 4.0 Capture-write (swap): {v = x; x = expr;}
15530b57cec5SDimitry Andric char __kmpc_atomic_fixed1_swp(ident_t *id_ref, int gtid, char *lhs, char rhs);
15540b57cec5SDimitry Andric short __kmpc_atomic_fixed2_swp(ident_t *id_ref, int gtid, short *lhs,
15550b57cec5SDimitry Andric                                short rhs);
15560b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_swp(ident_t *id_ref, int gtid, kmp_int32 *lhs,
15570b57cec5SDimitry Andric                                    kmp_int32 rhs);
15580b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_swp(ident_t *id_ref, int gtid, kmp_int64 *lhs,
15590b57cec5SDimitry Andric                                    kmp_int64 rhs);
15600b57cec5SDimitry Andric float __kmpc_atomic_float4_swp(ident_t *id_ref, int gtid, float *lhs,
15610b57cec5SDimitry Andric                                float rhs);
15620b57cec5SDimitry Andric double __kmpc_atomic_float8_swp(ident_t *id_ref, int gtid, double *lhs,
15630b57cec5SDimitry Andric                                 double rhs);
15640b57cec5SDimitry Andric long double __kmpc_atomic_float10_swp(ident_t *id_ref, int gtid,
15650b57cec5SDimitry Andric                                       long double *lhs, long double rhs);
15660b57cec5SDimitry Andric #if KMP_HAVE_QUAD
15670b57cec5SDimitry Andric QUAD_LEGACY __kmpc_atomic_float16_swp(ident_t *id_ref, int gtid,
15680b57cec5SDimitry Andric                                       QUAD_LEGACY *lhs, QUAD_LEGACY rhs);
15690b57cec5SDimitry Andric #endif
15700b57cec5SDimitry Andric // !!! TODO: check if we need a workaround here
15710b57cec5SDimitry Andric void __kmpc_atomic_cmplx4_swp(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
15720b57cec5SDimitry Andric                               kmp_cmplx32 rhs, kmp_cmplx32 *out);
15730b57cec5SDimitry Andric // kmp_cmplx32   	__kmpc_atomic_cmplx4_swp(  ident_t *id_ref, int gtid,
15740b57cec5SDimitry Andric // kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
15750b57cec5SDimitry Andric 
15760b57cec5SDimitry Andric kmp_cmplx64 __kmpc_atomic_cmplx8_swp(ident_t *id_ref, int gtid,
15770b57cec5SDimitry Andric                                      kmp_cmplx64 *lhs, kmp_cmplx64 rhs);
15780b57cec5SDimitry Andric kmp_cmplx80 __kmpc_atomic_cmplx10_swp(ident_t *id_ref, int gtid,
15790b57cec5SDimitry Andric                                       kmp_cmplx80 *lhs, kmp_cmplx80 rhs);
15800b57cec5SDimitry Andric #if KMP_HAVE_QUAD
15810b57cec5SDimitry Andric CPLX128_LEG __kmpc_atomic_cmplx16_swp(ident_t *id_ref, int gtid,
15820b57cec5SDimitry Andric                                       CPLX128_LEG *lhs, CPLX128_LEG rhs);
15830b57cec5SDimitry Andric #if (KMP_ARCH_X86)
15840b57cec5SDimitry Andric Quad_a16_t __kmpc_atomic_float16_a16_swp(ident_t *id_ref, int gtid,
15850b57cec5SDimitry Andric                                          Quad_a16_t *lhs, Quad_a16_t rhs);
15860b57cec5SDimitry Andric kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_swp(ident_t *id_ref, int gtid,
15870b57cec5SDimitry Andric                                                  kmp_cmplx128_a16_t *lhs,
15880b57cec5SDimitry Andric                                                  kmp_cmplx128_a16_t rhs);
15890b57cec5SDimitry Andric #endif
15900b57cec5SDimitry Andric #endif
15910b57cec5SDimitry Andric 
15920b57cec5SDimitry Andric // Capture routines for mixed types (RHS=float16)
15930b57cec5SDimitry Andric #if KMP_HAVE_QUAD
15940b57cec5SDimitry Andric 
15950b57cec5SDimitry Andric char __kmpc_atomic_fixed1_add_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
15960b57cec5SDimitry Andric                                      _Quad rhs, int flag);
15970b57cec5SDimitry Andric char __kmpc_atomic_fixed1_sub_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
15980b57cec5SDimitry Andric                                      _Quad rhs, int flag);
15990b57cec5SDimitry Andric char __kmpc_atomic_fixed1_mul_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
16000b57cec5SDimitry Andric                                      _Quad rhs, int flag);
16010b57cec5SDimitry Andric char __kmpc_atomic_fixed1_div_cpt_fp(ident_t *id_ref, int gtid, char *lhs,
16020b57cec5SDimitry Andric                                      _Quad rhs, int flag);
16030b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_add_cpt_fp(ident_t *id_ref, int gtid,
16040b57cec5SDimitry Andric                                                unsigned char *lhs, _Quad rhs,
16050b57cec5SDimitry Andric                                                int flag);
16060b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_sub_cpt_fp(ident_t *id_ref, int gtid,
16070b57cec5SDimitry Andric                                                unsigned char *lhs, _Quad rhs,
16080b57cec5SDimitry Andric                                                int flag);
16090b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_mul_cpt_fp(ident_t *id_ref, int gtid,
16100b57cec5SDimitry Andric                                                unsigned char *lhs, _Quad rhs,
16110b57cec5SDimitry Andric                                                int flag);
16120b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_div_cpt_fp(ident_t *id_ref, int gtid,
16130b57cec5SDimitry Andric                                                unsigned char *lhs, _Quad rhs,
16140b57cec5SDimitry Andric                                                int flag);
16150b57cec5SDimitry Andric 
16160b57cec5SDimitry Andric short __kmpc_atomic_fixed2_add_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
16170b57cec5SDimitry Andric                                       _Quad rhs, int flag);
16180b57cec5SDimitry Andric short __kmpc_atomic_fixed2_sub_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
16190b57cec5SDimitry Andric                                       _Quad rhs, int flag);
16200b57cec5SDimitry Andric short __kmpc_atomic_fixed2_mul_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
16210b57cec5SDimitry Andric                                       _Quad rhs, int flag);
16220b57cec5SDimitry Andric short __kmpc_atomic_fixed2_div_cpt_fp(ident_t *id_ref, int gtid, short *lhs,
16230b57cec5SDimitry Andric                                       _Quad rhs, int flag);
16240b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_add_cpt_fp(ident_t *id_ref, int gtid,
16250b57cec5SDimitry Andric                                                 unsigned short *lhs, _Quad rhs,
16260b57cec5SDimitry Andric                                                 int flag);
16270b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_sub_cpt_fp(ident_t *id_ref, int gtid,
16280b57cec5SDimitry Andric                                                 unsigned short *lhs, _Quad rhs,
16290b57cec5SDimitry Andric                                                 int flag);
16300b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_mul_cpt_fp(ident_t *id_ref, int gtid,
16310b57cec5SDimitry Andric                                                 unsigned short *lhs, _Quad rhs,
16320b57cec5SDimitry Andric                                                 int flag);
16330b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_div_cpt_fp(ident_t *id_ref, int gtid,
16340b57cec5SDimitry Andric                                                 unsigned short *lhs, _Quad rhs,
16350b57cec5SDimitry Andric                                                 int flag);
16360b57cec5SDimitry Andric 
16370b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_add_cpt_fp(ident_t *id_ref, int gtid,
16380b57cec5SDimitry Andric                                           kmp_int32 *lhs, _Quad rhs, int flag);
16390b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_sub_cpt_fp(ident_t *id_ref, int gtid,
16400b57cec5SDimitry Andric                                           kmp_int32 *lhs, _Quad rhs, int flag);
16410b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_mul_cpt_fp(ident_t *id_ref, int gtid,
16420b57cec5SDimitry Andric                                           kmp_int32 *lhs, _Quad rhs, int flag);
16430b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_div_cpt_fp(ident_t *id_ref, int gtid,
16440b57cec5SDimitry Andric                                           kmp_int32 *lhs, _Quad rhs, int flag);
16450b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_add_cpt_fp(ident_t *id_ref, int gtid,
16460b57cec5SDimitry Andric                                             kmp_uint32 *lhs, _Quad rhs,
16470b57cec5SDimitry Andric                                             int flag);
16480b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_sub_cpt_fp(ident_t *id_ref, int gtid,
16490b57cec5SDimitry Andric                                             kmp_uint32 *lhs, _Quad rhs,
16500b57cec5SDimitry Andric                                             int flag);
16510b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_mul_cpt_fp(ident_t *id_ref, int gtid,
16520b57cec5SDimitry Andric                                             kmp_uint32 *lhs, _Quad rhs,
16530b57cec5SDimitry Andric                                             int flag);
16540b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_fp(ident_t *id_ref, int gtid,
16550b57cec5SDimitry Andric                                             kmp_uint32 *lhs, _Quad rhs,
16560b57cec5SDimitry Andric                                             int flag);
16570b57cec5SDimitry Andric 
16580b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_add_cpt_fp(ident_t *id_ref, int gtid,
16590b57cec5SDimitry Andric                                           kmp_int64 *lhs, _Quad rhs, int flag);
16600b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_sub_cpt_fp(ident_t *id_ref, int gtid,
16610b57cec5SDimitry Andric                                           kmp_int64 *lhs, _Quad rhs, int flag);
16620b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_mul_cpt_fp(ident_t *id_ref, int gtid,
16630b57cec5SDimitry Andric                                           kmp_int64 *lhs, _Quad rhs, int flag);
16640b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_div_cpt_fp(ident_t *id_ref, int gtid,
16650b57cec5SDimitry Andric                                           kmp_int64 *lhs, _Quad rhs, int flag);
16660b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_add_cpt_fp(ident_t *id_ref, int gtid,
16670b57cec5SDimitry Andric                                             kmp_uint64 *lhs, _Quad rhs,
16680b57cec5SDimitry Andric                                             int flag);
16690b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_sub_cpt_fp(ident_t *id_ref, int gtid,
16700b57cec5SDimitry Andric                                             kmp_uint64 *lhs, _Quad rhs,
16710b57cec5SDimitry Andric                                             int flag);
16720b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_mul_cpt_fp(ident_t *id_ref, int gtid,
16730b57cec5SDimitry Andric                                             kmp_uint64 *lhs, _Quad rhs,
16740b57cec5SDimitry Andric                                             int flag);
16750b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_fp(ident_t *id_ref, int gtid,
16760b57cec5SDimitry Andric                                             kmp_uint64 *lhs, _Quad rhs,
16770b57cec5SDimitry Andric                                             int flag);
16780b57cec5SDimitry Andric 
16790b57cec5SDimitry Andric float __kmpc_atomic_float4_add_cpt_fp(ident_t *id_ref, int gtid,
16800b57cec5SDimitry Andric                                       kmp_real32 *lhs, _Quad rhs, int flag);
16810b57cec5SDimitry Andric float __kmpc_atomic_float4_sub_cpt_fp(ident_t *id_ref, int gtid,
16820b57cec5SDimitry Andric                                       kmp_real32 *lhs, _Quad rhs, int flag);
16830b57cec5SDimitry Andric float __kmpc_atomic_float4_mul_cpt_fp(ident_t *id_ref, int gtid,
16840b57cec5SDimitry Andric                                       kmp_real32 *lhs, _Quad rhs, int flag);
16850b57cec5SDimitry Andric float __kmpc_atomic_float4_div_cpt_fp(ident_t *id_ref, int gtid,
16860b57cec5SDimitry Andric                                       kmp_real32 *lhs, _Quad rhs, int flag);
16870b57cec5SDimitry Andric 
16880b57cec5SDimitry Andric double __kmpc_atomic_float8_add_cpt_fp(ident_t *id_ref, int gtid,
16890b57cec5SDimitry Andric                                        kmp_real64 *lhs, _Quad rhs, int flag);
16900b57cec5SDimitry Andric double __kmpc_atomic_float8_sub_cpt_fp(ident_t *id_ref, int gtid,
16910b57cec5SDimitry Andric                                        kmp_real64 *lhs, _Quad rhs, int flag);
16920b57cec5SDimitry Andric double __kmpc_atomic_float8_mul_cpt_fp(ident_t *id_ref, int gtid,
16930b57cec5SDimitry Andric                                        kmp_real64 *lhs, _Quad rhs, int flag);
16940b57cec5SDimitry Andric double __kmpc_atomic_float8_div_cpt_fp(ident_t *id_ref, int gtid,
16950b57cec5SDimitry Andric                                        kmp_real64 *lhs, _Quad rhs, int flag);
16960b57cec5SDimitry Andric 
16970b57cec5SDimitry Andric long double __kmpc_atomic_float10_add_cpt_fp(ident_t *id_ref, int gtid,
16980b57cec5SDimitry Andric                                              long double *lhs, _Quad rhs,
16990b57cec5SDimitry Andric                                              int flag);
17000b57cec5SDimitry Andric long double __kmpc_atomic_float10_sub_cpt_fp(ident_t *id_ref, int gtid,
17010b57cec5SDimitry Andric                                              long double *lhs, _Quad rhs,
17020b57cec5SDimitry Andric                                              int flag);
17030b57cec5SDimitry Andric long double __kmpc_atomic_float10_mul_cpt_fp(ident_t *id_ref, int gtid,
17040b57cec5SDimitry Andric                                              long double *lhs, _Quad rhs,
17050b57cec5SDimitry Andric                                              int flag);
17060b57cec5SDimitry Andric long double __kmpc_atomic_float10_div_cpt_fp(ident_t *id_ref, int gtid,
17070b57cec5SDimitry Andric                                              long double *lhs, _Quad rhs,
17080b57cec5SDimitry Andric                                              int flag);
17090b57cec5SDimitry Andric 
17100b57cec5SDimitry Andric char __kmpc_atomic_fixed1_sub_cpt_rev_fp(ident_t *id_ref, int gtid, char *lhs,
17110b57cec5SDimitry Andric                                          _Quad rhs, int flag);
17120b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17130b57cec5SDimitry Andric                                                    unsigned char *lhs,
17140b57cec5SDimitry Andric                                                    _Quad rhs, int flag);
17150b57cec5SDimitry Andric char __kmpc_atomic_fixed1_div_cpt_rev_fp(ident_t *id_ref, int gtid, char *lhs,
17160b57cec5SDimitry Andric                                          _Quad rhs, int flag);
17170b57cec5SDimitry Andric unsigned char __kmpc_atomic_fixed1u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17180b57cec5SDimitry Andric                                                    unsigned char *lhs,
17190b57cec5SDimitry Andric                                                    _Quad rhs, int flag);
17200b57cec5SDimitry Andric short __kmpc_atomic_fixed2_sub_cpt_rev_fp(ident_t *id_ref, int gtid, short *lhs,
17210b57cec5SDimitry Andric                                           _Quad rhs, int flag);
17220b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17230b57cec5SDimitry Andric                                                     unsigned short *lhs,
17240b57cec5SDimitry Andric                                                     _Quad rhs, int flag);
17250b57cec5SDimitry Andric short __kmpc_atomic_fixed2_div_cpt_rev_fp(ident_t *id_ref, int gtid, short *lhs,
17260b57cec5SDimitry Andric                                           _Quad rhs, int flag);
17270b57cec5SDimitry Andric unsigned short __kmpc_atomic_fixed2u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17280b57cec5SDimitry Andric                                                     unsigned short *lhs,
17290b57cec5SDimitry Andric                                                     _Quad rhs, int flag);
17300b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17310b57cec5SDimitry Andric                                               kmp_int32 *lhs, _Quad rhs,
17320b57cec5SDimitry Andric                                               int flag);
17330b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17340b57cec5SDimitry Andric                                                 kmp_uint32 *lhs, _Quad rhs,
17350b57cec5SDimitry Andric                                                 int flag);
17360b57cec5SDimitry Andric kmp_int32 __kmpc_atomic_fixed4_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17370b57cec5SDimitry Andric                                               kmp_int32 *lhs, _Quad rhs,
17380b57cec5SDimitry Andric                                               int flag);
17390b57cec5SDimitry Andric kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17400b57cec5SDimitry Andric                                                 kmp_uint32 *lhs, _Quad rhs,
17410b57cec5SDimitry Andric                                                 int flag);
17420b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17430b57cec5SDimitry Andric                                               kmp_int64 *lhs, _Quad rhs,
17440b57cec5SDimitry Andric                                               int flag);
17450b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17460b57cec5SDimitry Andric                                                 kmp_uint64 *lhs, _Quad rhs,
17470b57cec5SDimitry Andric                                                 int flag);
17480b57cec5SDimitry Andric kmp_int64 __kmpc_atomic_fixed8_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17490b57cec5SDimitry Andric                                               kmp_int64 *lhs, _Quad rhs,
17500b57cec5SDimitry Andric                                               int flag);
17510b57cec5SDimitry Andric kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17520b57cec5SDimitry Andric                                                 kmp_uint64 *lhs, _Quad rhs,
17530b57cec5SDimitry Andric                                                 int flag);
17540b57cec5SDimitry Andric float __kmpc_atomic_float4_sub_cpt_rev_fp(ident_t *id_ref, int gtid, float *lhs,
17550b57cec5SDimitry Andric                                           _Quad rhs, int flag);
17560b57cec5SDimitry Andric float __kmpc_atomic_float4_div_cpt_rev_fp(ident_t *id_ref, int gtid, float *lhs,
17570b57cec5SDimitry Andric                                           _Quad rhs, int flag);
17580b57cec5SDimitry Andric double __kmpc_atomic_float8_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17590b57cec5SDimitry Andric                                            double *lhs, _Quad rhs, int flag);
17600b57cec5SDimitry Andric double __kmpc_atomic_float8_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17610b57cec5SDimitry Andric                                            double *lhs, _Quad rhs, int flag);
17620b57cec5SDimitry Andric long double __kmpc_atomic_float10_sub_cpt_rev_fp(ident_t *id_ref, int gtid,
17630b57cec5SDimitry Andric                                                  long double *lhs, _Quad rhs,
17640b57cec5SDimitry Andric                                                  int flag);
17650b57cec5SDimitry Andric long double __kmpc_atomic_float10_div_cpt_rev_fp(ident_t *id_ref, int gtid,
17660b57cec5SDimitry Andric                                                  long double *lhs, _Quad rhs,
17670b57cec5SDimitry Andric                                                  int flag);
17680b57cec5SDimitry Andric 
17690b57cec5SDimitry Andric #endif // KMP_HAVE_QUAD
17700b57cec5SDimitry Andric 
17710b57cec5SDimitry Andric // End of OpenMP 4.0 capture
17720b57cec5SDimitry Andric 
1773349cc55cSDimitry Andric // OpenMP 5.1 compare and swap
1774349cc55cSDimitry Andric /*
1775349cc55cSDimitry Andric     __kmpc_atomic_bool_1_cas
1776349cc55cSDimitry Andric     __kmpc_atomic_bool_2_cas
1777349cc55cSDimitry Andric     __kmpc_atomic_bool_4_cas
1778349cc55cSDimitry Andric     __kmpc_atomic_bool_8_cas
1779349cc55cSDimitry Andric     __kmpc_atomic_val_1_cas
1780349cc55cSDimitry Andric     __kmpc_atomic_val_2_cas
1781349cc55cSDimitry Andric     __kmpc_atomic_val_4_cas
1782349cc55cSDimitry Andric     __kmpc_atomic_val_8_cas
1783349cc55cSDimitry Andric     __kmpc_atomic_bool_1_cas_cpt
1784349cc55cSDimitry Andric     __kmpc_atomic_bool_2_cas_cpt
1785349cc55cSDimitry Andric     __kmpc_atomic_bool_4_cas_cpt
1786349cc55cSDimitry Andric     __kmpc_atomic_bool_8_cas_cpt
1787349cc55cSDimitry Andric     __kmpc_atomic_val_1_cas_cpt
1788349cc55cSDimitry Andric     __kmpc_atomic_val_2_cas_cpt
1789349cc55cSDimitry Andric     __kmpc_atomic_val_4_cas_cpt
1790349cc55cSDimitry Andric     __kmpc_atomic_val_8_cas_cpt
1791349cc55cSDimitry Andric */
1792349cc55cSDimitry Andric // In all interfaces of CAS (Compare And Swap):
1793349cc55cSDimitry Andric // r is the boolean result of comparison
1794349cc55cSDimitry Andric // x is memory location to operate on
1795349cc55cSDimitry Andric // e is expected (old) value
1796349cc55cSDimitry Andric // d is desired (new) value
1797349cc55cSDimitry Andric // pv is pointer to captured value v whose location may coincide with e
1798349cc55cSDimitry Andric 
1799349cc55cSDimitry Andric // { r = x == e; if(r) { x = d; } }
1800349cc55cSDimitry Andric // functions return result of comparison
1801349cc55cSDimitry Andric bool __kmpc_atomic_bool_1_cas(ident_t *loc, int gtid, char *x, char e, char d);
1802349cc55cSDimitry Andric bool __kmpc_atomic_bool_2_cas(ident_t *loc, int gtid, short *x, short e,
1803349cc55cSDimitry Andric                               short d);
1804349cc55cSDimitry Andric bool __kmpc_atomic_bool_4_cas(ident_t *loc, int gtid, kmp_int32 *x, kmp_int32 e,
1805349cc55cSDimitry Andric                               kmp_int32 d);
1806349cc55cSDimitry Andric bool __kmpc_atomic_bool_8_cas(ident_t *loc, int gtid, kmp_int64 *x, kmp_int64 e,
1807349cc55cSDimitry Andric                               kmp_int64 d);
1808349cc55cSDimitry Andric 
1809349cc55cSDimitry Andric // { v = x; if (x == e) { x = d; } }
1810349cc55cSDimitry Andric // functions return old value
1811349cc55cSDimitry Andric char __kmpc_atomic_val_1_cas(ident_t *loc, int gtid, char *x, char e, char d);
1812349cc55cSDimitry Andric short __kmpc_atomic_val_2_cas(ident_t *loc, int gtid, short *x, short e,
1813349cc55cSDimitry Andric                               short d);
1814349cc55cSDimitry Andric kmp_int32 __kmpc_atomic_val_4_cas(ident_t *loc, int gtid, kmp_int32 *x,
1815349cc55cSDimitry Andric                                   kmp_int32 e, kmp_int32 d);
1816349cc55cSDimitry Andric kmp_int64 __kmpc_atomic_val_8_cas(ident_t *loc, int gtid, kmp_int64 *x,
1817349cc55cSDimitry Andric                                   kmp_int64 e, kmp_int64 d);
1818349cc55cSDimitry Andric 
1819349cc55cSDimitry Andric // { r = x == e; if(r) { x = d; } else { v = x; } }
1820349cc55cSDimitry Andric // v gets old value if comparison failed, untouched otherwise
1821349cc55cSDimitry Andric // functions return result of comparison
1822349cc55cSDimitry Andric bool __kmpc_atomic_bool_1_cas_cpt(ident_t *loc, int gtid, char *x, char e,
1823349cc55cSDimitry Andric                                   char d, char *pv);
1824349cc55cSDimitry Andric bool __kmpc_atomic_bool_2_cas_cpt(ident_t *loc, int gtid, short *x, short e,
1825349cc55cSDimitry Andric                                   short d, short *pv);
1826349cc55cSDimitry Andric bool __kmpc_atomic_bool_4_cas_cpt(ident_t *loc, int gtid, kmp_int32 *x,
1827349cc55cSDimitry Andric                                   kmp_int32 e, kmp_int32 d, kmp_int32 *pv);
1828349cc55cSDimitry Andric bool __kmpc_atomic_bool_8_cas_cpt(ident_t *loc, int gtid, kmp_int64 *x,
1829349cc55cSDimitry Andric                                   kmp_int64 e, kmp_int64 d, kmp_int64 *pv);
1830349cc55cSDimitry Andric 
1831349cc55cSDimitry Andric // { if (x == e) { x = d; }; v = x; }
1832349cc55cSDimitry Andric // v gets old value if comparison failed, new value otherwise
1833349cc55cSDimitry Andric // functions return old value
1834349cc55cSDimitry Andric char __kmpc_atomic_val_1_cas_cpt(ident_t *loc, int gtid, char *x, char e,
1835349cc55cSDimitry Andric                                  char d, char *pv);
1836349cc55cSDimitry Andric short __kmpc_atomic_val_2_cas_cpt(ident_t *loc, int gtid, short *x, short e,
1837349cc55cSDimitry Andric                                   short d, short *pv);
1838349cc55cSDimitry Andric kmp_int32 __kmpc_atomic_val_4_cas_cpt(ident_t *loc, int gtid, kmp_int32 *x,
1839349cc55cSDimitry Andric                                       kmp_int32 e, kmp_int32 d, kmp_int32 *pv);
1840349cc55cSDimitry Andric kmp_int64 __kmpc_atomic_val_8_cas_cpt(ident_t *loc, int gtid, kmp_int64 *x,
1841349cc55cSDimitry Andric                                       kmp_int64 e, kmp_int64 d, kmp_int64 *pv);
1842349cc55cSDimitry Andric 
1843349cc55cSDimitry Andric // End OpenMP 5.1 compare + capture
1844349cc55cSDimitry Andric 
18450b57cec5SDimitry Andric #endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
18460b57cec5SDimitry Andric 
18470b57cec5SDimitry Andric /* ------------------------------------------------------------------------ */
18480b57cec5SDimitry Andric 
18490b57cec5SDimitry Andric #ifdef __cplusplus
18500b57cec5SDimitry Andric } // extern "C"
18510b57cec5SDimitry Andric #endif
18520b57cec5SDimitry Andric 
18530b57cec5SDimitry Andric #endif /* KMP_ATOMIC_H */
18540b57cec5SDimitry Andric 
18550b57cec5SDimitry Andric // end of file
1856