blob: 90965517c143f835899d0c07f2551d9271a1d475 [file] [log] [blame]
Jim Cownie5e8470a2013-09-27 10:38:44 +00001/*
2 * kmp_atomic.h - ATOMIC header file
Jim Cownie5e8470a2013-09-27 10:38:44 +00003 */
4
5
6//===----------------------------------------------------------------------===//
7//
8// The LLVM Compiler Infrastructure
9//
10// This file is dual licensed under the MIT and the University of Illinois Open
11// Source Licenses. See LICENSE.txt for details.
12//
13//===----------------------------------------------------------------------===//
14
15
16#ifndef KMP_ATOMIC_H
17#define KMP_ATOMIC_H
18
19#include "kmp_os.h"
20#include "kmp_lock.h"
21
22// C++ build port.
23// Intel compiler does not support _Complex datatype on win.
24// Intel compiler supports _Complex datatype on lin and mac.
25// On the other side, there is a problem of stack alignment on lin_32 and mac_32
26// if the rhs is cmplx80 or cmplx128 typedef'ed datatype.
27// The decision is: to use compiler supported _Complex type on lin and mac,
28// to use typedef'ed types on win.
29// Condition for WIN64 was modified in anticipation of 10.1 build compiler.
30
Jim Cownie5e8470a2013-09-27 10:38:44 +000031#if defined( __cplusplus ) && ( KMP_OS_WINDOWS )
32 // create shortcuts for c99 complex types
33
Jim Cownie4cc4bb42014-10-07 16:25:50 +000034 #if (_MSC_VER < 1600) && defined(_DEBUG)
Jim Cownie5e8470a2013-09-27 10:38:44 +000035 // 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
42 #include <complex>
43
44 template< typename type_lhs, typename type_rhs >
45 std::complex< type_lhs > __kmp_lhs_div_rhs(
46 const std::complex< type_lhs >& lhs,
47 const std::complex< type_rhs >& rhs ) {
48 type_lhs a = lhs.real();
49 type_lhs b = lhs.imag();
50 type_rhs c = rhs.real();
51 type_rhs d = rhs.imag();
52 type_rhs den = c*c + d*d;
53 type_rhs r = ( a*c + b*d );
54 type_rhs i = ( b*c - a*d );
55 std::complex< type_lhs > ret( r/den, i/den );
56 return ret;
57 }
58
59 // complex8
60 struct __kmp_cmplx64_t : std::complex< double > {
61
62 __kmp_cmplx64_t() : std::complex< double > () {}
63
64 __kmp_cmplx64_t( const std::complex< double >& cd )
65 : std::complex< double > ( cd ) {}
66
67 void operator /= ( const __kmp_cmplx64_t& rhs ) {
68 std::complex< double > lhs = *this;
69 *this = __kmp_lhs_div_rhs( lhs, rhs );
70 }
71
72 __kmp_cmplx64_t operator / ( const __kmp_cmplx64_t& rhs ) {
73 std::complex< double > lhs = *this;
74 return __kmp_lhs_div_rhs( lhs, rhs );
75 }
76
77 };
78 typedef struct __kmp_cmplx64_t kmp_cmplx64;
79
80 // complex4
81 struct __kmp_cmplx32_t : std::complex< float > {
82
83 __kmp_cmplx32_t() : std::complex< float > () {}
84
85 __kmp_cmplx32_t( const std::complex<float>& cf )
86 : std::complex< float > ( cf ) {}
87
88 __kmp_cmplx32_t operator + ( const __kmp_cmplx32_t& b ) {
89 std::complex< float > lhs = *this;
90 std::complex< float > rhs = b;
91 return ( lhs + rhs );
92 }
93 __kmp_cmplx32_t operator - ( const __kmp_cmplx32_t& b ) {
94 std::complex< float > lhs = *this;
95 std::complex< float > rhs = b;
96 return ( lhs - rhs );
97 }
98 __kmp_cmplx32_t operator * ( const __kmp_cmplx32_t& b ) {
99 std::complex< float > lhs = *this;
100 std::complex< float > rhs = b;
101 return ( lhs * rhs );
102 }
103
104 __kmp_cmplx32_t operator + ( const kmp_cmplx64& b ) {
105 kmp_cmplx64 t = kmp_cmplx64( *this ) + b;
106 std::complex< double > d( t );
107 std::complex< float > f( d );
108 __kmp_cmplx32_t r( f );
109 return r;
110 }
111 __kmp_cmplx32_t operator - ( const kmp_cmplx64& b ) {
112 kmp_cmplx64 t = kmp_cmplx64( *this ) - b;
113 std::complex< double > d( t );
114 std::complex< float > f( d );
115 __kmp_cmplx32_t r( f );
116 return r;
117 }
118 __kmp_cmplx32_t operator * ( const kmp_cmplx64& b ) {
119 kmp_cmplx64 t = kmp_cmplx64( *this ) * b;
120 std::complex< double > d( t );
121 std::complex< float > f( d );
122 __kmp_cmplx32_t r( f );
123 return r;
124 }
125
126 void operator /= ( const __kmp_cmplx32_t& rhs ) {
127 std::complex< float > lhs = *this;
128 *this = __kmp_lhs_div_rhs( lhs, rhs );
129 }
130
131 __kmp_cmplx32_t operator / ( const __kmp_cmplx32_t& rhs ) {
132 std::complex< float > lhs = *this;
133 return __kmp_lhs_div_rhs( lhs, rhs );
134 }
135
136 void operator /= ( const kmp_cmplx64& rhs ) {
137 std::complex< float > lhs = *this;
138 *this = __kmp_lhs_div_rhs( lhs, rhs );
139 }
140
141 __kmp_cmplx32_t operator / ( const kmp_cmplx64& rhs ) {
142 std::complex< float > lhs = *this;
143 return __kmp_lhs_div_rhs( lhs, rhs );
144 }
145 };
146 typedef struct __kmp_cmplx32_t kmp_cmplx32;
147
148 // complex10
149 struct KMP_DO_ALIGN( 16 ) __kmp_cmplx80_t : std::complex< long double > {
150
151 __kmp_cmplx80_t() : std::complex< long double > () {}
152
153 __kmp_cmplx80_t( const std::complex< long double >& cld )
154 : std::complex< long double > ( cld ) {}
155
156 void operator /= ( const __kmp_cmplx80_t& rhs ) {
157 std::complex< long double > lhs = *this;
158 *this = __kmp_lhs_div_rhs( lhs, rhs );
159 }
160
161 __kmp_cmplx80_t operator / ( const __kmp_cmplx80_t& rhs ) {
162 std::complex< long double > lhs = *this;
163 return __kmp_lhs_div_rhs( lhs, rhs );
164 }
165
166 };
167 typedef KMP_DO_ALIGN( 16 ) struct __kmp_cmplx80_t kmp_cmplx80;
168
169 // complex16
Jim Cownie181b4bb2013-12-23 17:28:57 +0000170 #if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000171 struct __kmp_cmplx128_t : std::complex< _Quad > {
172
173 __kmp_cmplx128_t() : std::complex< _Quad > () {}
174
175 __kmp_cmplx128_t( const std::complex< _Quad >& cq )
176 : std::complex< _Quad > ( cq ) {}
177
178 void operator /= ( const __kmp_cmplx128_t& rhs ) {
179 std::complex< _Quad > lhs = *this;
180 *this = __kmp_lhs_div_rhs( lhs, rhs );
181 }
182
183 __kmp_cmplx128_t operator / ( const __kmp_cmplx128_t& rhs ) {
184 std::complex< _Quad > lhs = *this;
185 return __kmp_lhs_div_rhs( lhs, rhs );
186 }
187
188 };
189 typedef struct __kmp_cmplx128_t kmp_cmplx128;
Jim Cownie181b4bb2013-12-23 17:28:57 +0000190 #endif /* KMP_HAVE_QUAD */
Jim Cownie5e8470a2013-09-27 10:38:44 +0000191
192 #ifdef _DEBUG_TEMPORARILY_UNSET_
193 #undef _DEBUG_TEMPORARILY_UNSET_
194 // Set it back now
195 #define _DEBUG 1
196 #endif
197
198#else
199 // create shortcuts for c99 complex types
200 typedef float _Complex kmp_cmplx32;
201 typedef double _Complex kmp_cmplx64;
202 typedef long double _Complex kmp_cmplx80;
Jim Cownie181b4bb2013-12-23 17:28:57 +0000203 #if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000204 typedef _Quad _Complex kmp_cmplx128;
Jim Cownie181b4bb2013-12-23 17:28:57 +0000205 #endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000206#endif
207
208// Compiler 12.0 changed alignment of 16 and 32-byte arguments (like _Quad
209// and kmp_cmplx128) on IA-32 architecture. The following aligned structures
210// are implemented to support the old alignment in 10.1, 11.0, 11.1 and
211// introduce the new alignment in 12.0. See CQ88405.
Jim Cownie181b4bb2013-12-23 17:28:57 +0000212#if KMP_ARCH_X86 && KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000213
214 // 4-byte aligned structures for backward compatibility.
215
216 #pragma pack( push, 4 )
217
Jim Cownie181b4bb2013-12-23 17:28:57 +0000218
Jim Cownie5e8470a2013-09-27 10:38:44 +0000219 struct KMP_DO_ALIGN( 4 ) Quad_a4_t {
220 _Quad q;
221
222 Quad_a4_t( ) : q( ) {}
223 Quad_a4_t( const _Quad & cq ) : q ( cq ) {}
224
225 Quad_a4_t operator + ( const Quad_a4_t& b ) {
226 _Quad lhs = (*this).q;
227 _Quad rhs = b.q;
228 return (Quad_a4_t)( lhs + rhs );
229 }
230
231 Quad_a4_t operator - ( const Quad_a4_t& b ) {
232 _Quad lhs = (*this).q;
233 _Quad rhs = b.q;
234 return (Quad_a4_t)( lhs - rhs );
235 }
236 Quad_a4_t operator * ( const Quad_a4_t& b ) {
237 _Quad lhs = (*this).q;
238 _Quad rhs = b.q;
239 return (Quad_a4_t)( lhs * rhs );
240 }
241
242 Quad_a4_t operator / ( const Quad_a4_t& b ) {
243 _Quad lhs = (*this).q;
244 _Quad rhs = b.q;
245 return (Quad_a4_t)( lhs / rhs );
246 }
247
248 };
249
250 struct KMP_DO_ALIGN( 4 ) kmp_cmplx128_a4_t {
251 kmp_cmplx128 q;
252
253 kmp_cmplx128_a4_t() : q () {}
254
255 kmp_cmplx128_a4_t( const kmp_cmplx128 & c128 ) : q ( c128 ) {}
256
257 kmp_cmplx128_a4_t operator + ( const kmp_cmplx128_a4_t& b ) {
258 kmp_cmplx128 lhs = (*this).q;
259 kmp_cmplx128 rhs = b.q;
260 return (kmp_cmplx128_a4_t)( lhs + rhs );
261 }
262 kmp_cmplx128_a4_t operator - ( const kmp_cmplx128_a4_t& b ) {
263 kmp_cmplx128 lhs = (*this).q;
264 kmp_cmplx128 rhs = b.q;
265 return (kmp_cmplx128_a4_t)( lhs - rhs );
266 }
267 kmp_cmplx128_a4_t operator * ( const kmp_cmplx128_a4_t& b ) {
268 kmp_cmplx128 lhs = (*this).q;
269 kmp_cmplx128 rhs = b.q;
270 return (kmp_cmplx128_a4_t)( lhs * rhs );
271 }
272
273 kmp_cmplx128_a4_t operator / ( const kmp_cmplx128_a4_t& b ) {
274 kmp_cmplx128 lhs = (*this).q;
275 kmp_cmplx128 rhs = b.q;
276 return (kmp_cmplx128_a4_t)( lhs / rhs );
277 }
278
279 };
280
281 #pragma pack( pop )
282
283 // New 16-byte aligned structures for 12.0 compiler.
284 struct KMP_DO_ALIGN( 16 ) Quad_a16_t {
285 _Quad q;
286
287 Quad_a16_t( ) : q( ) {}
288 Quad_a16_t( const _Quad & cq ) : q ( cq ) {}
289
290 Quad_a16_t operator + ( const Quad_a16_t& b ) {
291 _Quad lhs = (*this).q;
292 _Quad rhs = b.q;
293 return (Quad_a16_t)( lhs + rhs );
294 }
295
296 Quad_a16_t operator - ( const Quad_a16_t& b ) {
297 _Quad lhs = (*this).q;
298 _Quad rhs = b.q;
299 return (Quad_a16_t)( lhs - rhs );
300 }
301 Quad_a16_t operator * ( const Quad_a16_t& b ) {
302 _Quad lhs = (*this).q;
303 _Quad rhs = b.q;
304 return (Quad_a16_t)( lhs * rhs );
305 }
306
307 Quad_a16_t operator / ( const Quad_a16_t& b ) {
308 _Quad lhs = (*this).q;
309 _Quad rhs = b.q;
310 return (Quad_a16_t)( lhs / rhs );
311 }
312 };
313
314 struct KMP_DO_ALIGN( 16 ) kmp_cmplx128_a16_t {
315 kmp_cmplx128 q;
316
317 kmp_cmplx128_a16_t() : q () {}
318
319 kmp_cmplx128_a16_t( const kmp_cmplx128 & c128 ) : q ( c128 ) {}
320
321 kmp_cmplx128_a16_t operator + ( const kmp_cmplx128_a16_t& b ) {
322 kmp_cmplx128 lhs = (*this).q;
323 kmp_cmplx128 rhs = b.q;
324 return (kmp_cmplx128_a16_t)( lhs + rhs );
325 }
326 kmp_cmplx128_a16_t operator - ( const kmp_cmplx128_a16_t& b ) {
327 kmp_cmplx128 lhs = (*this).q;
328 kmp_cmplx128 rhs = b.q;
329 return (kmp_cmplx128_a16_t)( lhs - rhs );
330 }
331 kmp_cmplx128_a16_t operator * ( const kmp_cmplx128_a16_t& b ) {
332 kmp_cmplx128 lhs = (*this).q;
333 kmp_cmplx128 rhs = b.q;
334 return (kmp_cmplx128_a16_t)( lhs * rhs );
335 }
336
337 kmp_cmplx128_a16_t operator / ( const kmp_cmplx128_a16_t& b ) {
338 kmp_cmplx128 lhs = (*this).q;
339 kmp_cmplx128 rhs = b.q;
340 return (kmp_cmplx128_a16_t)( lhs / rhs );
341 }
342 };
343
344#endif
345
346#if ( KMP_ARCH_X86 )
347 #define QUAD_LEGACY Quad_a4_t
348 #define CPLX128_LEG kmp_cmplx128_a4_t
349#else
350 #define QUAD_LEGACY _Quad
351 #define CPLX128_LEG kmp_cmplx128
352#endif
353
354#ifdef __cplusplus
355 extern "C" {
356#endif
357
358extern int __kmp_atomic_mode;
359
360//
361// Atomic locks can easily become contended, so we use queuing locks for them.
362//
363
364typedef kmp_queuing_lock_t kmp_atomic_lock_t;
365
Jim Cownie181b4bb2013-12-23 17:28:57 +0000366static inline void
Jim Cownie5e8470a2013-09-27 10:38:44 +0000367__kmp_acquire_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid )
368{
369 __kmp_acquire_queuing_lock( lck, gtid );
370}
371
Jim Cownie181b4bb2013-12-23 17:28:57 +0000372static inline int
Jim Cownie5e8470a2013-09-27 10:38:44 +0000373__kmp_test_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid )
374{
375 return __kmp_test_queuing_lock( lck, gtid );
376}
377
Jim Cownie181b4bb2013-12-23 17:28:57 +0000378static inline void
Jim Cownie5e8470a2013-09-27 10:38:44 +0000379__kmp_release_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid )
380{
381 __kmp_release_queuing_lock( lck, gtid );
382}
383
Jim Cownie181b4bb2013-12-23 17:28:57 +0000384static inline void
Jim Cownie5e8470a2013-09-27 10:38:44 +0000385__kmp_init_atomic_lock( kmp_atomic_lock_t *lck )
386{
387 __kmp_init_queuing_lock( lck );
388}
389
Jim Cownie181b4bb2013-12-23 17:28:57 +0000390static inline void
Jim Cownie5e8470a2013-09-27 10:38:44 +0000391__kmp_destroy_atomic_lock( kmp_atomic_lock_t *lck )
392{
393 __kmp_destroy_queuing_lock( lck );
394}
395
396// Global Locks
397
398extern kmp_atomic_lock_t __kmp_atomic_lock; /* Control access to all user coded atomics in Gnu compat mode */
399extern kmp_atomic_lock_t __kmp_atomic_lock_1i; /* Control access to all user coded atomics for 1-byte fixed data types */
400extern kmp_atomic_lock_t __kmp_atomic_lock_2i; /* Control access to all user coded atomics for 2-byte fixed data types */
401extern kmp_atomic_lock_t __kmp_atomic_lock_4i; /* Control access to all user coded atomics for 4-byte fixed data types */
402extern kmp_atomic_lock_t __kmp_atomic_lock_4r; /* Control access to all user coded atomics for kmp_real32 data type */
403extern kmp_atomic_lock_t __kmp_atomic_lock_8i; /* Control access to all user coded atomics for 8-byte fixed data types */
404extern kmp_atomic_lock_t __kmp_atomic_lock_8r; /* Control access to all user coded atomics for kmp_real64 data type */
405extern kmp_atomic_lock_t __kmp_atomic_lock_8c; /* Control access to all user coded atomics for complex byte data type */
406extern kmp_atomic_lock_t __kmp_atomic_lock_10r; /* Control access to all user coded atomics for long double data type */
407extern kmp_atomic_lock_t __kmp_atomic_lock_16r; /* Control access to all user coded atomics for _Quad data type */
408extern kmp_atomic_lock_t __kmp_atomic_lock_16c; /* Control access to all user coded atomics for double complex data type*/
409extern kmp_atomic_lock_t __kmp_atomic_lock_20c; /* Control access to all user coded atomics for long double complex type*/
410extern kmp_atomic_lock_t __kmp_atomic_lock_32c; /* Control access to all user coded atomics for _Quad complex data type */
411
412//
413// Below routines for atomic UPDATE are listed
414//
415
416// 1-byte
417void __kmpc_atomic_fixed1_add( ident_t *id_ref, int gtid, char * lhs, char rhs );
418void __kmpc_atomic_fixed1_andb( ident_t *id_ref, int gtid, char * lhs, char rhs );
419void __kmpc_atomic_fixed1_div( ident_t *id_ref, int gtid, char * lhs, char rhs );
420void __kmpc_atomic_fixed1u_div( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs );
421void __kmpc_atomic_fixed1_mul( ident_t *id_ref, int gtid, char * lhs, char rhs );
422void __kmpc_atomic_fixed1_orb( ident_t *id_ref, int gtid, char * lhs, char rhs );
423void __kmpc_atomic_fixed1_shl( ident_t *id_ref, int gtid, char * lhs, char rhs );
424void __kmpc_atomic_fixed1_shr( ident_t *id_ref, int gtid, char * lhs, char rhs );
425void __kmpc_atomic_fixed1u_shr( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs );
426void __kmpc_atomic_fixed1_sub( ident_t *id_ref, int gtid, char * lhs, char rhs );
427void __kmpc_atomic_fixed1_xor( ident_t *id_ref, int gtid, char * lhs, char rhs );
428// 2-byte
429void __kmpc_atomic_fixed2_add( ident_t *id_ref, int gtid, short * lhs, short rhs );
430void __kmpc_atomic_fixed2_andb( ident_t *id_ref, int gtid, short * lhs, short rhs );
431void __kmpc_atomic_fixed2_div( ident_t *id_ref, int gtid, short * lhs, short rhs );
432void __kmpc_atomic_fixed2u_div( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs );
433void __kmpc_atomic_fixed2_mul( ident_t *id_ref, int gtid, short * lhs, short rhs );
434void __kmpc_atomic_fixed2_orb( ident_t *id_ref, int gtid, short * lhs, short rhs );
435void __kmpc_atomic_fixed2_shl( ident_t *id_ref, int gtid, short * lhs, short rhs );
436void __kmpc_atomic_fixed2_shr( ident_t *id_ref, int gtid, short * lhs, short rhs );
437void __kmpc_atomic_fixed2u_shr( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs );
438void __kmpc_atomic_fixed2_sub( ident_t *id_ref, int gtid, short * lhs, short rhs );
439void __kmpc_atomic_fixed2_xor( ident_t *id_ref, int gtid, short * lhs, short rhs );
440// 4-byte add / sub fixed
441void __kmpc_atomic_fixed4_add( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
442void __kmpc_atomic_fixed4_sub( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
443// 4-byte add / sub float
444void __kmpc_atomic_float4_add( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
445void __kmpc_atomic_float4_sub( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
446// 8-byte add / sub fixed
447void __kmpc_atomic_fixed8_add( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
448void __kmpc_atomic_fixed8_sub( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
449// 8-byte add / sub float
450void __kmpc_atomic_float8_add( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
451void __kmpc_atomic_float8_sub( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
452// 4-byte fixed
453void __kmpc_atomic_fixed4_andb( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
454void __kmpc_atomic_fixed4_div( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
455void __kmpc_atomic_fixed4u_div( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs );
456void __kmpc_atomic_fixed4_mul( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
457void __kmpc_atomic_fixed4_orb( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
458void __kmpc_atomic_fixed4_shl( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
459void __kmpc_atomic_fixed4_shr( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
460void __kmpc_atomic_fixed4u_shr( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs );
461void __kmpc_atomic_fixed4_xor( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
462// 8-byte fixed
463void __kmpc_atomic_fixed8_andb( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
464void __kmpc_atomic_fixed8_div( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
465void __kmpc_atomic_fixed8u_div( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs );
466void __kmpc_atomic_fixed8_mul( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
467void __kmpc_atomic_fixed8_orb( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
468void __kmpc_atomic_fixed8_shl( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
469void __kmpc_atomic_fixed8_shr( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
470void __kmpc_atomic_fixed8u_shr( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs );
471void __kmpc_atomic_fixed8_xor( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
472// 4-byte float
473void __kmpc_atomic_float4_div( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
474void __kmpc_atomic_float4_mul( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
475// 8-byte float
476void __kmpc_atomic_float8_div( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
477void __kmpc_atomic_float8_mul( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
478// 1-, 2-, 4-, 8-byte logical (&&, ||)
479void __kmpc_atomic_fixed1_andl( ident_t *id_ref, int gtid, char * lhs, char rhs );
480void __kmpc_atomic_fixed1_orl( ident_t *id_ref, int gtid, char * lhs, char rhs );
481void __kmpc_atomic_fixed2_andl( ident_t *id_ref, int gtid, short * lhs, short rhs );
482void __kmpc_atomic_fixed2_orl( ident_t *id_ref, int gtid, short * lhs, short rhs );
483void __kmpc_atomic_fixed4_andl( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
484void __kmpc_atomic_fixed4_orl( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
485void __kmpc_atomic_fixed8_andl( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
486void __kmpc_atomic_fixed8_orl( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
487// MIN / MAX
488void __kmpc_atomic_fixed1_max( ident_t *id_ref, int gtid, char * lhs, char rhs );
489void __kmpc_atomic_fixed1_min( ident_t *id_ref, int gtid, char * lhs, char rhs );
490void __kmpc_atomic_fixed2_max( ident_t *id_ref, int gtid, short * lhs, short rhs );
491void __kmpc_atomic_fixed2_min( ident_t *id_ref, int gtid, short * lhs, short rhs );
492void __kmpc_atomic_fixed4_max( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
493void __kmpc_atomic_fixed4_min( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
494void __kmpc_atomic_fixed8_max( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
495void __kmpc_atomic_fixed8_min( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
496void __kmpc_atomic_float4_max( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
497void __kmpc_atomic_float4_min( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
498void __kmpc_atomic_float8_max( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
499void __kmpc_atomic_float8_min( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000500#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000501void __kmpc_atomic_float16_max( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
502void __kmpc_atomic_float16_min( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
503#if ( KMP_ARCH_X86 )
504 // Routines with 16-byte arguments aligned to 16-byte boundary; IA-32 architecture only
505 void __kmpc_atomic_float16_max_a16( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
506 void __kmpc_atomic_float16_min_a16( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
507#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000508#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000509// .NEQV. (same as xor)
510void __kmpc_atomic_fixed1_neqv( ident_t *id_ref, int gtid, char * lhs, char rhs );
511void __kmpc_atomic_fixed2_neqv( ident_t *id_ref, int gtid, short * lhs, short rhs );
512void __kmpc_atomic_fixed4_neqv( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
513void __kmpc_atomic_fixed8_neqv( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
514// .EQV. (same as ~xor)
515void __kmpc_atomic_fixed1_eqv( ident_t *id_ref, int gtid, char * lhs, char rhs );
516void __kmpc_atomic_fixed2_eqv( ident_t *id_ref, int gtid, short * lhs, short rhs );
517void __kmpc_atomic_fixed4_eqv( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
518void __kmpc_atomic_fixed8_eqv( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
519// long double type
520void __kmpc_atomic_float10_add( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
521void __kmpc_atomic_float10_sub( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
522void __kmpc_atomic_float10_mul( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
523void __kmpc_atomic_float10_div( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
524// _Quad type
Jim Cownie181b4bb2013-12-23 17:28:57 +0000525#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000526void __kmpc_atomic_float16_add( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
527void __kmpc_atomic_float16_sub( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
528void __kmpc_atomic_float16_mul( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
529void __kmpc_atomic_float16_div( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
530#if ( KMP_ARCH_X86 )
531 // Routines with 16-byte arguments aligned to 16-byte boundary
532 void __kmpc_atomic_float16_add_a16( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
533 void __kmpc_atomic_float16_sub_a16( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
534 void __kmpc_atomic_float16_mul_a16( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
535 void __kmpc_atomic_float16_div_a16( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
536#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000537#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000538// routines for complex types
539void __kmpc_atomic_cmplx4_add( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
540void __kmpc_atomic_cmplx4_sub( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
541void __kmpc_atomic_cmplx4_mul( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
542void __kmpc_atomic_cmplx4_div( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
543void __kmpc_atomic_cmplx8_add( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
544void __kmpc_atomic_cmplx8_sub( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
545void __kmpc_atomic_cmplx8_mul( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
546void __kmpc_atomic_cmplx8_div( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
547void __kmpc_atomic_cmplx10_add( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
548void __kmpc_atomic_cmplx10_sub( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
549void __kmpc_atomic_cmplx10_mul( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
550void __kmpc_atomic_cmplx10_div( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000551#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000552void __kmpc_atomic_cmplx16_add( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
553void __kmpc_atomic_cmplx16_sub( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
554void __kmpc_atomic_cmplx16_mul( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
555void __kmpc_atomic_cmplx16_div( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
556#if ( KMP_ARCH_X86 )
557 // Routines with 16-byte arguments aligned to 16-byte boundary
558 void __kmpc_atomic_cmplx16_add_a16( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
559 void __kmpc_atomic_cmplx16_sub_a16( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
560 void __kmpc_atomic_cmplx16_mul_a16( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
561 void __kmpc_atomic_cmplx16_div_a16( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
562#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000563#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000564
565#if OMP_40_ENABLED
566
567// OpenMP 4.0: x = expr binop x for non-commutative operations.
568// Supported only on IA-32 architecture and Intel(R) 64
569#if KMP_ARCH_X86 || KMP_ARCH_X86_64
570
571void __kmpc_atomic_fixed1_sub_rev( ident_t *id_ref, int gtid, char * lhs, char rhs );
572void __kmpc_atomic_fixed1_div_rev( ident_t *id_ref, int gtid, char * lhs, char rhs );
573void __kmpc_atomic_fixed1u_div_rev( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs );
574void __kmpc_atomic_fixed1_shl_rev( ident_t *id_ref, int gtid, char * lhs, char rhs );
575void __kmpc_atomic_fixed1_shr_rev( ident_t *id_ref, int gtid, char * lhs, char rhs );
576void __kmpc_atomic_fixed1u_shr_rev( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs );
577void __kmpc_atomic_fixed2_sub_rev( ident_t *id_ref, int gtid, short * lhs, short rhs );
578void __kmpc_atomic_fixed2_div_rev( ident_t *id_ref, int gtid, short * lhs, short rhs );
579void __kmpc_atomic_fixed2u_div_rev( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs );
580void __kmpc_atomic_fixed2_shl_rev( ident_t *id_ref, int gtid, short * lhs, short rhs );
581void __kmpc_atomic_fixed2_shr_rev( ident_t *id_ref, int gtid, short * lhs, short rhs );
582void __kmpc_atomic_fixed2u_shr_rev( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs );
583void __kmpc_atomic_fixed4_sub_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
584void __kmpc_atomic_fixed4_div_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
585void __kmpc_atomic_fixed4u_div_rev( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs );
586void __kmpc_atomic_fixed4_shl_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
587void __kmpc_atomic_fixed4_shr_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
588void __kmpc_atomic_fixed4u_shr_rev( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs );
589void __kmpc_atomic_fixed8_sub_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
590void __kmpc_atomic_fixed8_div_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
591void __kmpc_atomic_fixed8u_div_rev( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs );
592void __kmpc_atomic_fixed8_shl_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
593void __kmpc_atomic_fixed8_shr_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
594void __kmpc_atomic_fixed8u_shr_rev( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs );
595void __kmpc_atomic_float4_sub_rev( ident_t *id_ref, int gtid, float * lhs, float rhs );
596void __kmpc_atomic_float4_div_rev( ident_t *id_ref, int gtid, float * lhs, float rhs );
597void __kmpc_atomic_float8_sub_rev( ident_t *id_ref, int gtid, double * lhs, double rhs );
598void __kmpc_atomic_float8_div_rev( ident_t *id_ref, int gtid, double * lhs, double rhs );
599void __kmpc_atomic_float10_sub_rev( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
600void __kmpc_atomic_float10_div_rev( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000601#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000602void __kmpc_atomic_float16_sub_rev( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
603void __kmpc_atomic_float16_div_rev( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000604#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000605void __kmpc_atomic_cmplx4_sub_rev( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
606void __kmpc_atomic_cmplx4_div_rev( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
607void __kmpc_atomic_cmplx8_sub_rev( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
608void __kmpc_atomic_cmplx8_div_rev( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
609void __kmpc_atomic_cmplx10_sub_rev( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
610void __kmpc_atomic_cmplx10_div_rev( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000611#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000612void __kmpc_atomic_cmplx16_sub_rev( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
613void __kmpc_atomic_cmplx16_div_rev( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
614#if ( KMP_ARCH_X86 )
615 // Routines with 16-byte arguments aligned to 16-byte boundary
616 void __kmpc_atomic_float16_sub_a16_rev( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
617 void __kmpc_atomic_float16_div_a16_rev( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
618 void __kmpc_atomic_cmplx16_sub_a16_rev( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
619 void __kmpc_atomic_cmplx16_div_a16_rev( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
620#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000621#endif // KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000622
623#endif //KMP_ARCH_X86 || KMP_ARCH_X86_64
624
625#endif //OMP_40_ENABLED
626
627// routines for mixed types
628
629// RHS=float8
630void __kmpc_atomic_fixed1_mul_float8( ident_t *id_ref, int gtid, char * lhs, kmp_real64 rhs );
631void __kmpc_atomic_fixed1_div_float8( ident_t *id_ref, int gtid, char * lhs, kmp_real64 rhs );
632void __kmpc_atomic_fixed2_mul_float8( ident_t *id_ref, int gtid, short * lhs, kmp_real64 rhs );
633void __kmpc_atomic_fixed2_div_float8( ident_t *id_ref, int gtid, short * lhs, kmp_real64 rhs );
634void __kmpc_atomic_fixed4_mul_float8( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_real64 rhs );
635void __kmpc_atomic_fixed4_div_float8( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_real64 rhs );
636void __kmpc_atomic_fixed8_mul_float8( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_real64 rhs );
637void __kmpc_atomic_fixed8_div_float8( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_real64 rhs );
638void __kmpc_atomic_float4_add_float8( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real64 rhs );
639void __kmpc_atomic_float4_sub_float8( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real64 rhs );
640void __kmpc_atomic_float4_mul_float8( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real64 rhs );
641void __kmpc_atomic_float4_div_float8( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real64 rhs );
642
643// RHS=float16 (deprecated, to be removed when we are sure the compiler does not use them)
Jim Cownie181b4bb2013-12-23 17:28:57 +0000644#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000645void __kmpc_atomic_fixed1_add_fp( ident_t *id_ref, int gtid, char * lhs, _Quad rhs );
646void __kmpc_atomic_fixed1_sub_fp( ident_t *id_ref, int gtid, char * lhs, _Quad rhs );
647void __kmpc_atomic_fixed1_mul_fp( ident_t *id_ref, int gtid, char * lhs, _Quad rhs );
648void __kmpc_atomic_fixed1_div_fp( ident_t *id_ref, int gtid, char * lhs, _Quad rhs );
649void __kmpc_atomic_fixed1u_div_fp( ident_t *id_ref, int gtid, unsigned char * lhs, _Quad rhs );
650
651void __kmpc_atomic_fixed2_add_fp( ident_t *id_ref, int gtid, short * lhs, _Quad rhs );
652void __kmpc_atomic_fixed2_sub_fp( ident_t *id_ref, int gtid, short * lhs, _Quad rhs );
653void __kmpc_atomic_fixed2_mul_fp( ident_t *id_ref, int gtid, short * lhs, _Quad rhs );
654void __kmpc_atomic_fixed2_div_fp( ident_t *id_ref, int gtid, short * lhs, _Quad rhs );
655void __kmpc_atomic_fixed2u_div_fp( ident_t *id_ref, int gtid, unsigned short * lhs, _Quad rhs );
656
657void __kmpc_atomic_fixed4_add_fp( ident_t *id_ref, int gtid, kmp_int32 * lhs, _Quad rhs );
658void __kmpc_atomic_fixed4_sub_fp( ident_t *id_ref, int gtid, kmp_int32 * lhs, _Quad rhs );
659void __kmpc_atomic_fixed4_mul_fp( ident_t *id_ref, int gtid, kmp_int32 * lhs, _Quad rhs );
660void __kmpc_atomic_fixed4_div_fp( ident_t *id_ref, int gtid, kmp_int32 * lhs, _Quad rhs );
661void __kmpc_atomic_fixed4u_div_fp( ident_t *id_ref, int gtid, kmp_uint32 * lhs, _Quad rhs );
662
663void __kmpc_atomic_fixed8_add_fp( ident_t *id_ref, int gtid, kmp_int64 * lhs, _Quad rhs );
664void __kmpc_atomic_fixed8_sub_fp( ident_t *id_ref, int gtid, kmp_int64 * lhs, _Quad rhs );
665void __kmpc_atomic_fixed8_mul_fp( ident_t *id_ref, int gtid, kmp_int64 * lhs, _Quad rhs );
666void __kmpc_atomic_fixed8_div_fp( ident_t *id_ref, int gtid, kmp_int64 * lhs, _Quad rhs );
667void __kmpc_atomic_fixed8u_div_fp( ident_t *id_ref, int gtid, kmp_uint64 * lhs, _Quad rhs );
668
669void __kmpc_atomic_float4_add_fp( ident_t *id_ref, int gtid, kmp_real32 * lhs, _Quad rhs );
670void __kmpc_atomic_float4_sub_fp( ident_t *id_ref, int gtid, kmp_real32 * lhs, _Quad rhs );
671void __kmpc_atomic_float4_mul_fp( ident_t *id_ref, int gtid, kmp_real32 * lhs, _Quad rhs );
672void __kmpc_atomic_float4_div_fp( ident_t *id_ref, int gtid, kmp_real32 * lhs, _Quad rhs );
673
674void __kmpc_atomic_float8_add_fp( ident_t *id_ref, int gtid, kmp_real64 * lhs, _Quad rhs );
675void __kmpc_atomic_float8_sub_fp( ident_t *id_ref, int gtid, kmp_real64 * lhs, _Quad rhs );
676void __kmpc_atomic_float8_mul_fp( ident_t *id_ref, int gtid, kmp_real64 * lhs, _Quad rhs );
677void __kmpc_atomic_float8_div_fp( ident_t *id_ref, int gtid, kmp_real64 * lhs, _Quad rhs );
678
679void __kmpc_atomic_float10_add_fp( ident_t *id_ref, int gtid, long double * lhs, _Quad rhs );
680void __kmpc_atomic_float10_sub_fp( ident_t *id_ref, int gtid, long double * lhs, _Quad rhs );
681void __kmpc_atomic_float10_mul_fp( ident_t *id_ref, int gtid, long double * lhs, _Quad rhs );
682void __kmpc_atomic_float10_div_fp( ident_t *id_ref, int gtid, long double * lhs, _Quad rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000683#endif // KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000684
685// RHS=cmplx8
686void __kmpc_atomic_cmplx4_add_cmplx8( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx64 rhs );
687void __kmpc_atomic_cmplx4_sub_cmplx8( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx64 rhs );
688void __kmpc_atomic_cmplx4_mul_cmplx8( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx64 rhs );
689void __kmpc_atomic_cmplx4_div_cmplx8( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx64 rhs );
690
691// generic atomic routines
692void __kmpc_atomic_1( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
693void __kmpc_atomic_2( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
694void __kmpc_atomic_4( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
695void __kmpc_atomic_8( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
696void __kmpc_atomic_10( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
697void __kmpc_atomic_16( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
698void __kmpc_atomic_20( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
699void __kmpc_atomic_32( ident_t *id_ref, int gtid, void* lhs, void* rhs, void (*f)( void *, void *, void * ) );
700
701// READ, WRITE, CAPTURE are supported only on IA-32 architecture and Intel(R) 64
702#if KMP_ARCH_X86 || KMP_ARCH_X86_64
703
704//
705// Below routines for atomic READ are listed
706//
707
708char __kmpc_atomic_fixed1_rd( ident_t *id_ref, int gtid, char * loc );
709short __kmpc_atomic_fixed2_rd( ident_t *id_ref, int gtid, short * loc );
710kmp_int32 __kmpc_atomic_fixed4_rd( ident_t *id_ref, int gtid, kmp_int32 * loc );
711kmp_int64 __kmpc_atomic_fixed8_rd( ident_t *id_ref, int gtid, kmp_int64 * loc );
712kmp_real32 __kmpc_atomic_float4_rd( ident_t *id_ref, int gtid, kmp_real32 * loc );
713kmp_real64 __kmpc_atomic_float8_rd( ident_t *id_ref, int gtid, kmp_real64 * loc );
714long double __kmpc_atomic_float10_rd( ident_t *id_ref, int gtid, long double * loc );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000715#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000716QUAD_LEGACY __kmpc_atomic_float16_rd( ident_t *id_ref, int gtid, QUAD_LEGACY * loc );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000717#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000718// Fix for CQ220361: cmplx4 READ will return void on Windows* OS; read value will be
719// returned through an additional parameter
720#if ( KMP_OS_WINDOWS )
721 void __kmpc_atomic_cmplx4_rd( kmp_cmplx32 * out, ident_t *id_ref, int gtid, kmp_cmplx32 * loc );
722#else
723 kmp_cmplx32 __kmpc_atomic_cmplx4_rd( ident_t *id_ref, int gtid, kmp_cmplx32 * loc );
724#endif
725kmp_cmplx64 __kmpc_atomic_cmplx8_rd( ident_t *id_ref, int gtid, kmp_cmplx64 * loc );
726kmp_cmplx80 __kmpc_atomic_cmplx10_rd( ident_t *id_ref, int gtid, kmp_cmplx80 * loc );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000727#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000728CPLX128_LEG __kmpc_atomic_cmplx16_rd( ident_t *id_ref, int gtid, CPLX128_LEG * loc );
729#if ( KMP_ARCH_X86 )
730 // Routines with 16-byte arguments aligned to 16-byte boundary
731 Quad_a16_t __kmpc_atomic_float16_a16_rd( ident_t * id_ref, int gtid, Quad_a16_t * loc );
732 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_rd( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * loc );
733#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000734#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000735
736
737//
738// Below routines for atomic WRITE are listed
739//
740
741void __kmpc_atomic_fixed1_wr( ident_t *id_ref, int gtid, char * lhs, char rhs );
742void __kmpc_atomic_fixed2_wr( ident_t *id_ref, int gtid, short * lhs, short rhs );
743void __kmpc_atomic_fixed4_wr( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
744void __kmpc_atomic_fixed8_wr( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
745void __kmpc_atomic_float4_wr( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs );
746void __kmpc_atomic_float8_wr( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs );
747void __kmpc_atomic_float10_wr( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000748#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000749void __kmpc_atomic_float16_wr( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000750#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000751void __kmpc_atomic_cmplx4_wr( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
752void __kmpc_atomic_cmplx8_wr( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
753void __kmpc_atomic_cmplx10_wr( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000754#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000755void __kmpc_atomic_cmplx16_wr( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
756#if ( KMP_ARCH_X86 )
757 // Routines with 16-byte arguments aligned to 16-byte boundary
758 void __kmpc_atomic_float16_a16_wr( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
759 void __kmpc_atomic_cmplx16_a16_wr( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
760#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000761#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000762
763//
764// Below routines for atomic CAPTURE are listed
765//
766
767// 1-byte
768char __kmpc_atomic_fixed1_add_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
769char __kmpc_atomic_fixed1_andb_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
770char __kmpc_atomic_fixed1_div_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
771unsigned char __kmpc_atomic_fixed1u_div_cpt( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs, int flag);
772char __kmpc_atomic_fixed1_mul_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
773char __kmpc_atomic_fixed1_orb_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
774char __kmpc_atomic_fixed1_shl_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
775char __kmpc_atomic_fixed1_shr_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
776unsigned char __kmpc_atomic_fixed1u_shr_cpt( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs, int flag);
777char __kmpc_atomic_fixed1_sub_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
778char __kmpc_atomic_fixed1_xor_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
779// 2-byte
780short __kmpc_atomic_fixed2_add_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
781short __kmpc_atomic_fixed2_andb_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
782short __kmpc_atomic_fixed2_div_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
783unsigned short __kmpc_atomic_fixed2u_div_cpt( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs, int flag);
784short __kmpc_atomic_fixed2_mul_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
785short __kmpc_atomic_fixed2_orb_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
786short __kmpc_atomic_fixed2_shl_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
787short __kmpc_atomic_fixed2_shr_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
788unsigned short __kmpc_atomic_fixed2u_shr_cpt( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs, int flag);
789short __kmpc_atomic_fixed2_sub_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
790short __kmpc_atomic_fixed2_xor_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
791// 4-byte add / sub fixed
792kmp_int32 __kmpc_atomic_fixed4_add_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
793kmp_int32 __kmpc_atomic_fixed4_sub_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
794// 4-byte add / sub float
795kmp_real32 __kmpc_atomic_float4_add_cpt( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs, int flag);
796kmp_real32 __kmpc_atomic_float4_sub_cpt( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs, int flag);
797// 8-byte add / sub fixed
798kmp_int64 __kmpc_atomic_fixed8_add_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
799kmp_int64 __kmpc_atomic_fixed8_sub_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
800// 8-byte add / sub float
801kmp_real64 __kmpc_atomic_float8_add_cpt( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs, int flag);
802kmp_real64 __kmpc_atomic_float8_sub_cpt( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs, int flag);
803// 4-byte fixed
804kmp_int32 __kmpc_atomic_fixed4_andb_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
805kmp_int32 __kmpc_atomic_fixed4_div_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
806kmp_uint32 __kmpc_atomic_fixed4u_div_cpt( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs, int flag);
807kmp_int32 __kmpc_atomic_fixed4_mul_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
808kmp_int32 __kmpc_atomic_fixed4_orb_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
809kmp_int32 __kmpc_atomic_fixed4_shl_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
810kmp_int32 __kmpc_atomic_fixed4_shr_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
811kmp_uint32 __kmpc_atomic_fixed4u_shr_cpt( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs, int flag);
812kmp_int32 __kmpc_atomic_fixed4_xor_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
813// 8-byte fixed
814kmp_int64 __kmpc_atomic_fixed8_andb_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
815kmp_int64 __kmpc_atomic_fixed8_div_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
816kmp_uint64 __kmpc_atomic_fixed8u_div_cpt( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs, int flag);
817kmp_int64 __kmpc_atomic_fixed8_mul_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
818kmp_int64 __kmpc_atomic_fixed8_orb_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
819kmp_int64 __kmpc_atomic_fixed8_shl_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
820kmp_int64 __kmpc_atomic_fixed8_shr_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
821kmp_uint64 __kmpc_atomic_fixed8u_shr_cpt( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs, int flag);
822kmp_int64 __kmpc_atomic_fixed8_xor_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
823// 4-byte float
824kmp_real32 __kmpc_atomic_float4_div_cpt( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs, int flag);
825kmp_real32 __kmpc_atomic_float4_mul_cpt( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs, int flag);
826// 8-byte float
827kmp_real64 __kmpc_atomic_float8_div_cpt( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs, int flag);
828kmp_real64 __kmpc_atomic_float8_mul_cpt( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs, int flag);
829// 1-, 2-, 4-, 8-byte logical (&&, ||)
830char __kmpc_atomic_fixed1_andl_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
831char __kmpc_atomic_fixed1_orl_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
832short __kmpc_atomic_fixed2_andl_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
833short __kmpc_atomic_fixed2_orl_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
834kmp_int32 __kmpc_atomic_fixed4_andl_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
835kmp_int32 __kmpc_atomic_fixed4_orl_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
836kmp_int64 __kmpc_atomic_fixed8_andl_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
837kmp_int64 __kmpc_atomic_fixed8_orl_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
838// MIN / MAX
839char __kmpc_atomic_fixed1_max_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
840char __kmpc_atomic_fixed1_min_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
841short __kmpc_atomic_fixed2_max_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
842short __kmpc_atomic_fixed2_min_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
843kmp_int32 __kmpc_atomic_fixed4_max_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
844kmp_int32 __kmpc_atomic_fixed4_min_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
845kmp_int64 __kmpc_atomic_fixed8_max_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
846kmp_int64 __kmpc_atomic_fixed8_min_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
847kmp_real32 __kmpc_atomic_float4_max_cpt( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs, int flag);
848kmp_real32 __kmpc_atomic_float4_min_cpt( ident_t *id_ref, int gtid, kmp_real32 * lhs, kmp_real32 rhs, int flag);
849kmp_real64 __kmpc_atomic_float8_max_cpt( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs, int flag);
850kmp_real64 __kmpc_atomic_float8_min_cpt( ident_t *id_ref, int gtid, kmp_real64 * lhs, kmp_real64 rhs, int flag);
Jim Cownie181b4bb2013-12-23 17:28:57 +0000851#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000852QUAD_LEGACY __kmpc_atomic_float16_max_cpt( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag);
853QUAD_LEGACY __kmpc_atomic_float16_min_cpt( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag);
Jim Cownie181b4bb2013-12-23 17:28:57 +0000854#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000855// .NEQV. (same as xor)
856char __kmpc_atomic_fixed1_neqv_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
857short __kmpc_atomic_fixed2_neqv_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
858kmp_int32 __kmpc_atomic_fixed4_neqv_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
859kmp_int64 __kmpc_atomic_fixed8_neqv_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
860// .EQV. (same as ~xor)
861char __kmpc_atomic_fixed1_eqv_cpt( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag);
862short __kmpc_atomic_fixed2_eqv_cpt( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag);
863kmp_int32 __kmpc_atomic_fixed4_eqv_cpt( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag);
864kmp_int64 __kmpc_atomic_fixed8_eqv_cpt( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag);
865// long double type
866long double __kmpc_atomic_float10_add_cpt( ident_t *id_ref, int gtid, long double * lhs, long double rhs, int flag);
867long double __kmpc_atomic_float10_sub_cpt( ident_t *id_ref, int gtid, long double * lhs, long double rhs, int flag);
868long double __kmpc_atomic_float10_mul_cpt( ident_t *id_ref, int gtid, long double * lhs, long double rhs, int flag);
869long double __kmpc_atomic_float10_div_cpt( ident_t *id_ref, int gtid, long double * lhs, long double rhs, int flag);
Jim Cownie181b4bb2013-12-23 17:28:57 +0000870#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000871// _Quad type
872QUAD_LEGACY __kmpc_atomic_float16_add_cpt( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag);
873QUAD_LEGACY __kmpc_atomic_float16_sub_cpt( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag);
874QUAD_LEGACY __kmpc_atomic_float16_mul_cpt( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag);
875QUAD_LEGACY __kmpc_atomic_float16_div_cpt( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag);
Jim Cownie181b4bb2013-12-23 17:28:57 +0000876#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000877// routines for complex types
878// Workaround for cmplx4 routines - return void; captured value is returned via the argument
879void __kmpc_atomic_cmplx4_add_cpt( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out, int flag);
880void __kmpc_atomic_cmplx4_sub_cpt( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out, int flag);
881void __kmpc_atomic_cmplx4_mul_cpt( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out, int flag);
882void __kmpc_atomic_cmplx4_div_cpt( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out, int flag);
883
884kmp_cmplx64 __kmpc_atomic_cmplx8_add_cpt( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs, int flag);
885kmp_cmplx64 __kmpc_atomic_cmplx8_sub_cpt( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs, int flag);
886kmp_cmplx64 __kmpc_atomic_cmplx8_mul_cpt( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs, int flag);
887kmp_cmplx64 __kmpc_atomic_cmplx8_div_cpt( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs, int flag);
888kmp_cmplx80 __kmpc_atomic_cmplx10_add_cpt( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs, int flag);
889kmp_cmplx80 __kmpc_atomic_cmplx10_sub_cpt( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs, int flag);
890kmp_cmplx80 __kmpc_atomic_cmplx10_mul_cpt( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs, int flag);
891kmp_cmplx80 __kmpc_atomic_cmplx10_div_cpt( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs, int flag);
Jim Cownie181b4bb2013-12-23 17:28:57 +0000892#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000893CPLX128_LEG __kmpc_atomic_cmplx16_add_cpt( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs, int flag);
894CPLX128_LEG __kmpc_atomic_cmplx16_sub_cpt( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs, int flag);
895CPLX128_LEG __kmpc_atomic_cmplx16_mul_cpt( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs, int flag);
896CPLX128_LEG __kmpc_atomic_cmplx16_div_cpt( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs, int flag);
897#if ( KMP_ARCH_X86 )
898 // Routines with 16-byte arguments aligned to 16-byte boundary
899 Quad_a16_t __kmpc_atomic_float16_add_a16_cpt( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag);
900 Quad_a16_t __kmpc_atomic_float16_sub_a16_cpt( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag);
901 Quad_a16_t __kmpc_atomic_float16_mul_a16_cpt( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag);
902 Quad_a16_t __kmpc_atomic_float16_div_a16_cpt( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag);
903 Quad_a16_t __kmpc_atomic_float16_max_a16_cpt( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag);
904 Quad_a16_t __kmpc_atomic_float16_min_a16_cpt( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag);
905 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_add_a16_cpt( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs, int flag);
906 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_sub_a16_cpt( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs, int flag);
907 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_mul_a16_cpt( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs, int flag);
908 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_div_a16_cpt( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs, int flag);
909#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000910#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000911
912void __kmpc_atomic_start(void);
913void __kmpc_atomic_end(void);
914
915#if OMP_40_ENABLED
916
917// OpenMP 4.0: v = x = expr binop x; { v = x; x = expr binop x; } { x = expr binop x; v = x; } for non-commutative operations.
918
919char __kmpc_atomic_fixed1_sub_cpt_rev( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag );
920char __kmpc_atomic_fixed1_div_cpt_rev( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag );
921unsigned char __kmpc_atomic_fixed1u_div_cpt_rev( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs, int flag );
922char __kmpc_atomic_fixed1_shl_cpt_rev( ident_t *id_ref, int gtid, char * lhs, char rhs , int flag);
923char __kmpc_atomic_fixed1_shr_cpt_rev( ident_t *id_ref, int gtid, char * lhs, char rhs, int flag );
924unsigned char __kmpc_atomic_fixed1u_shr_cpt_rev( ident_t *id_ref, int gtid, unsigned char * lhs, unsigned char rhs, int flag );
925short __kmpc_atomic_fixed2_sub_cpt_rev( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag );
926short __kmpc_atomic_fixed2_div_cpt_rev( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag );
927unsigned short __kmpc_atomic_fixed2u_div_cpt_rev( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs, int flag );
928short __kmpc_atomic_fixed2_shl_cpt_rev( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag );
929short __kmpc_atomic_fixed2_shr_cpt_rev( ident_t *id_ref, int gtid, short * lhs, short rhs, int flag );
930unsigned short __kmpc_atomic_fixed2u_shr_cpt_rev( ident_t *id_ref, int gtid, unsigned short * lhs, unsigned short rhs, int flag );
931kmp_int32 __kmpc_atomic_fixed4_sub_cpt_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag );
932kmp_int32 __kmpc_atomic_fixed4_div_cpt_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag );
933kmp_uint32 __kmpc_atomic_fixed4u_div_cpt_rev( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs, int flag );
934kmp_int32 __kmpc_atomic_fixed4_shl_cpt_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag );
935kmp_int32 __kmpc_atomic_fixed4_shr_cpt_rev( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs, int flag );
936kmp_uint32 __kmpc_atomic_fixed4u_shr_cpt_rev( ident_t *id_ref, int gtid, kmp_uint32 * lhs, kmp_uint32 rhs, int flag );
937kmp_int64 __kmpc_atomic_fixed8_sub_cpt_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag );
938kmp_int64 __kmpc_atomic_fixed8_div_cpt_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag );
939kmp_uint64 __kmpc_atomic_fixed8u_div_cpt_rev( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs, int flag );
940kmp_int64 __kmpc_atomic_fixed8_shl_cpt_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag );
941kmp_int64 __kmpc_atomic_fixed8_shr_cpt_rev( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs, int flag );
942kmp_uint64 __kmpc_atomic_fixed8u_shr_cpt_rev( ident_t *id_ref, int gtid, kmp_uint64 * lhs, kmp_uint64 rhs, int flag );
943float __kmpc_atomic_float4_sub_cpt_rev( ident_t *id_ref, int gtid, float * lhs, float rhs, int flag );
944float __kmpc_atomic_float4_div_cpt_rev( ident_t *id_ref, int gtid, float * lhs, float rhs, int flag );
945double __kmpc_atomic_float8_sub_cpt_rev( ident_t *id_ref, int gtid, double * lhs, double rhs, int flag );
946double __kmpc_atomic_float8_div_cpt_rev( ident_t *id_ref, int gtid, double * lhs, double rhs, int flag );
947long double __kmpc_atomic_float10_sub_cpt_rev( ident_t *id_ref, int gtid, long double * lhs, long double rhs, int flag );
948long double __kmpc_atomic_float10_div_cpt_rev( ident_t *id_ref, int gtid, long double * lhs, long double rhs, int flag );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000949#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000950QUAD_LEGACY __kmpc_atomic_float16_sub_cpt_rev( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag );
951QUAD_LEGACY __kmpc_atomic_float16_div_cpt_rev( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs, int flag );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000952#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000953// Workaround for cmplx4 routines - return void; captured value is returned via the argument
954void __kmpc_atomic_cmplx4_sub_cpt_rev( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out, int flag );
955void __kmpc_atomic_cmplx4_div_cpt_rev( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out, int flag );
956kmp_cmplx64 __kmpc_atomic_cmplx8_sub_cpt_rev( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs, int flag );
957kmp_cmplx64 __kmpc_atomic_cmplx8_div_cpt_rev( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs, int flag );
958kmp_cmplx80 __kmpc_atomic_cmplx10_sub_cpt_rev( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs, int flag );
959kmp_cmplx80 __kmpc_atomic_cmplx10_div_cpt_rev( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs, int flag );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000960#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000961CPLX128_LEG __kmpc_atomic_cmplx16_sub_cpt_rev( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs, int flag );
962CPLX128_LEG __kmpc_atomic_cmplx16_div_cpt_rev( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs, int flag );
963#if ( KMP_ARCH_X86 )
964 Quad_a16_t __kmpc_atomic_float16_sub_a16_cpt_rev( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag );
965 Quad_a16_t __kmpc_atomic_float16_div_a16_cpt_rev( ident_t * id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs, int flag );
966 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_sub_a16_cpt_rev( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs, int flag );
967 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_div_a16_cpt_rev( ident_t * id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs, int flag );
968#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000969#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000970
971// OpenMP 4.0 Capture-write (swap): {v = x; x = expr;}
972char __kmpc_atomic_fixed1_swp( ident_t *id_ref, int gtid, char * lhs, char rhs );
973short __kmpc_atomic_fixed2_swp( ident_t *id_ref, int gtid, short * lhs, short rhs );
974kmp_int32 __kmpc_atomic_fixed4_swp( ident_t *id_ref, int gtid, kmp_int32 * lhs, kmp_int32 rhs );
975kmp_int64 __kmpc_atomic_fixed8_swp( ident_t *id_ref, int gtid, kmp_int64 * lhs, kmp_int64 rhs );
976float __kmpc_atomic_float4_swp( ident_t *id_ref, int gtid, float * lhs, float rhs );
977double __kmpc_atomic_float8_swp( ident_t *id_ref, int gtid, double * lhs, double rhs );
978long double __kmpc_atomic_float10_swp( ident_t *id_ref, int gtid, long double * lhs, long double rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000979#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000980QUAD_LEGACY __kmpc_atomic_float16_swp( ident_t *id_ref, int gtid, QUAD_LEGACY * lhs, QUAD_LEGACY rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000981#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000982// !!! TODO: check if we need a workaround here
983void __kmpc_atomic_cmplx4_swp( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs, kmp_cmplx32 * out );
984//kmp_cmplx32 __kmpc_atomic_cmplx4_swp( ident_t *id_ref, int gtid, kmp_cmplx32 * lhs, kmp_cmplx32 rhs );
985
986kmp_cmplx64 __kmpc_atomic_cmplx8_swp( ident_t *id_ref, int gtid, kmp_cmplx64 * lhs, kmp_cmplx64 rhs );
987kmp_cmplx80 __kmpc_atomic_cmplx10_swp( ident_t *id_ref, int gtid, kmp_cmplx80 * lhs, kmp_cmplx80 rhs );
Jim Cownie181b4bb2013-12-23 17:28:57 +0000988#if KMP_HAVE_QUAD
Jim Cownie5e8470a2013-09-27 10:38:44 +0000989CPLX128_LEG __kmpc_atomic_cmplx16_swp( ident_t *id_ref, int gtid, CPLX128_LEG * lhs, CPLX128_LEG rhs );
990#if ( KMP_ARCH_X86 )
991 Quad_a16_t __kmpc_atomic_float16_a16_swp( ident_t *id_ref, int gtid, Quad_a16_t * lhs, Quad_a16_t rhs );
992 kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_a16_swp( ident_t *id_ref, int gtid, kmp_cmplx128_a16_t * lhs, kmp_cmplx128_a16_t rhs );
993#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +0000994#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000995
996// End of OpenMP 4.0 capture
997
998#endif //OMP_40_ENABLED
999
1000#endif //KMP_ARCH_X86 || KMP_ARCH_X86_64
1001
1002/* ------------------------------------------------------------------------ */
1003/* ------------------------------------------------------------------------ */
1004
1005#ifdef __cplusplus
1006 } // extern "C"
1007#endif
1008
1009#endif /* KMP_ATOMIC_H */
1010
1011// end of file