kmp_atomic.h 95 KB

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