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