summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibuv/src/unix/atomic-ops.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-22 18:10:43 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-27 13:50:16 (GMT)
commitff82df301c6db009200cbe3869fa03b86a573253 (patch)
treedf3700f506d1f03ce8176bc3fd3e8aa872630cce /Utilities/cmlibuv/src/unix/atomic-ops.h
parentcfe8fd64217d42c7a5c8a12c65feddbace86ce21 (diff)
parenta23da1559648995998343f3ae63076db736b55a5 (diff)
downloadCMake-ff82df301c6db009200cbe3869fa03b86a573253.zip
CMake-ff82df301c6db009200cbe3869fa03b86a573253.tar.gz
CMake-ff82df301c6db009200cbe3869fa03b86a573253.tar.bz2
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv: libuv 2022-07-12 (0c1fa696)
Diffstat (limited to 'Utilities/cmlibuv/src/unix/atomic-ops.h')
-rw-r--r--Utilities/cmlibuv/src/unix/atomic-ops.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/Utilities/cmlibuv/src/unix/atomic-ops.h b/Utilities/cmlibuv/src/unix/atomic-ops.h
index 63d8268..2b58162 100644
--- a/Utilities/cmlibuv/src/unix/atomic-ops.h
+++ b/Utilities/cmlibuv/src/unix/atomic-ops.h
@@ -43,12 +43,11 @@ UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) {
__compare_and_swap((volatile int*)ptr, &oldval, newval);
return oldval;
#elif defined(__MVS__)
- unsigned int op4;
- if (__plo_CSST(ptr, (unsigned int*) &oldval, newval,
- (unsigned int*) ptr, *ptr, &op4))
- return oldval;
- else
- return op4;
+ /* Use hand-rolled assembly because codegen from builtin __plo_CSST results in
+ * a runtime bug.
+ */
+ __asm(" cs %0,%2,%1 \n " : "+r"(oldval), "+m"(*ptr) : "r"(newval) :);
+ return oldval;
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
return atomic_cas_uint((uint_t *)ptr, (uint_t)oldval, (uint_t)newval);
#else
@@ -61,7 +60,9 @@ UV_UNUSED(static void cpu_relax(void)) {
__asm__ __volatile__ ("rep; nop" ::: "memory"); /* a.k.a. PAUSE */
#elif (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
__asm__ __volatile__ ("yield" ::: "memory");
-#elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__)
+#elif (defined(__ppc__) || defined(__ppc64__)) && defined(__APPLE__)
+ __asm volatile ("" : : : "memory");
+#elif !defined(__APPLE__) && (defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__))
__asm__ __volatile__ ("or 1,1,1; or 2,2,2" ::: "memory");
#endif
}