Define the same kmpc_atomic functions for arm and arm64 that are defined for x86 and x64.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D139139
%endif
- # These are specific to x86 and x64
- %ifdef IS_IA_ARCH
-
- # ATOMIC extensions for OpenMP 3.1 spec (x86 and x64 only)
+ # ATOMIC extensions for OpenMP 3.1 spec
__kmpc_atomic_fixed1_rd 2265
__kmpc_atomic_fixed2_rd 2266
__kmpc_atomic_float10_div_cpt_fp
%endif
+ # These are specific to x86 and x64
+ %ifdef IS_IA_ARCH
+
# ATOMIC extensions for OpenMP 4.0 spec (x86 and x64 only)
__kmpc_atomic_fixed1_swp 2412
ATOMIC_CMPXCHG_CMPLX(cmplx4, kmp_cmplx32, div, 64, /, cmplx8, kmp_cmplx64, 8c,
7, KMP_ARCH_X86) // __kmpc_atomic_cmplx4_div_cmplx8
-// READ, WRITE, CAPTURE are supported only on IA-32 architecture and Intel(R) 64
-#if KMP_ARCH_X86 || KMP_ARCH_X86_64
+// READ, WRITE, CAPTURE
// ------------------------------------------------------------------------
// Atomic READ routines
// binop x; v = x; } for non-commutative operations.
// Supported only on IA-32 architecture and Intel(R) 64
+#if KMP_ARCH_X86 || KMP_ARCH_X86_64
// -------------------------------------------------------------------------
// Operation on *lhs, rhs bound by critical section
// OP - operator (it's supposed to contain an assignment)
void __kmpc_atomic_32(ident_t *id_ref, int gtid, void *lhs, void *rhs,
void (*f)(void *, void *, void *));
-// READ, WRITE, CAPTURE are supported only on IA-32 architecture and Intel(R) 64
-#if KMP_ARCH_X86 || KMP_ARCH_X86_64
+// READ, WRITE, CAPTURE
// Below routines for atomic READ are listed
char __kmpc_atomic_fixed1_rd(ident_t *id_ref, int gtid, char *loc);
kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
void __kmpc_atomic_cmplx4_div_cpt(ident_t *id_ref, int gtid, kmp_cmplx32 *lhs,
kmp_cmplx32 rhs, kmp_cmplx32 *out, int flag);
-
kmp_cmplx64 __kmpc_atomic_cmplx8_add_cpt(ident_t *id_ref, int gtid,
kmp_cmplx64 *lhs, kmp_cmplx64 rhs,
int flag);
// OpenMP 4.0: v = x = expr binop x; { v = x; x = expr binop x; } { x = expr
// binop x; v = x; } for non-commutative operations.
-
+#if KMP_ARCH_X86 || KMP_ARCH_X86_64
char __kmpc_atomic_fixed1_sub_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
char rhs, int flag);
char __kmpc_atomic_fixed1_div_cpt_rev(ident_t *id_ref, int gtid, char *lhs,
}
// The _RET versions return the value instead of a bool
-/*
+
#define KMP_COMPARE_AND_STORE_RET8(p, cv, sv) \
_InterlockedCompareExchange8((p), (sv), (cv))
#define KMP_COMPARE_AND_STORE_RET16(p, cv, sv) \
_InterlockedCompareExchange16((p), (sv), (cv))
-*/
+
#define KMP_COMPARE_AND_STORE_RET64(p, cv, sv) \
_InterlockedCompareExchange64((volatile kmp_int64 *)(p), (kmp_int64)(sv), \
(kmp_int64)(cv))
-/*
+
#define KMP_XCHG_FIXED8(p, v) \
_InterlockedExchange8((volatile kmp_int8 *)(p), (kmp_int8)(v));
-*/
-// #define KMP_XCHG_FIXED16(p, v) _InterlockedExchange16((p), (v));
-// #define KMP_XCHG_REAL64(p, v) __kmp_xchg_real64((p), (v)));
+#define KMP_XCHG_FIXED16(p, v) _InterlockedExchange16((p), (v));
+#define KMP_XCHG_REAL64(p, v) __kmp_xchg_real64((p), (v)));
-// inline kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v) {
-// kmp_int64 tmp = _InterlockedExchange64((volatile kmp_int64 *)p, *(kmp_int64
-// *)&v); return *(kmp_real64 *)&tmp;
-// }
+inline kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v) {
+ kmp_int64 tmp = _InterlockedExchange64((volatile kmp_int64 *)p, *(kmp_int64
+ *)&v); return *(kmp_real64 *)&tmp;
+}
#else // !KMP_ARCH_AARCH64