61 lines
1.9 KiB
Diff
61 lines
1.9 KiB
Diff
--- openmpi-v1.8.4-134-g9ad2aa8/opal/include/opal/sys/ia32/atomic.h.orig 2015-03-24 19:21:55.000000000 -0600
|
|
+++ openmpi-v1.8.4-134-g9ad2aa8/opal/include/opal/sys/ia32/atomic.h 2015-03-27 08:09:41.140745019 -0600
|
|
@@ -1,3 +1,4 @@
|
|
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
@@ -10,6 +11,8 @@
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* Copyright (c) 2007-2010 Oracle and/or its affiliates. All rights reserved.
|
|
+ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
|
+ * reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
@@ -155,6 +158,25 @@
|
|
|
|
#if OMPI_GCC_INLINE_ASSEMBLY
|
|
|
|
+#define OPAL_HAVE_ATOMIC_SWAP_32 1
|
|
+
|
|
+static inline int32_t opal_atomic_swap_32( volatile int32_t *addr,
|
|
+ int32_t newval)
|
|
+{
|
|
+ int32_t oldval;
|
|
+
|
|
+ __asm__ __volatile__("xchg %1, %0" :
|
|
+ "=r" (oldval), "=m" (*addr) :
|
|
+ "0" (newval), "m" (*addr) :
|
|
+ "memory");
|
|
+ return oldval;
|
|
+}
|
|
+
|
|
+#endif /* OPAL_GCC_INLINE_ASSEMBLY */
|
|
+
|
|
+
|
|
+#if OPAL_GCC_INLINE_ASSEMBLY
|
|
+
|
|
/**
|
|
* atomic_add - add integer to atomic variable
|
|
* @i: integer value to add
|
|
@@ -167,7 +189,7 @@
|
|
int ret = i;
|
|
__asm__ __volatile__(
|
|
SMPLOCK "xaddl %1,%0"
|
|
- :"=m" (*v), "+r" (ret)
|
|
+ :"+m" (*v), "+r" (ret)
|
|
:"m" (*v)
|
|
:"memory", "cc"
|
|
);
|
|
@@ -187,7 +209,7 @@
|
|
int ret = -i;
|
|
__asm__ __volatile__(
|
|
SMPLOCK "xaddl %1,%0"
|
|
- :"=m" (*v), "+r" (ret)
|
|
+ :"+m" (*v), "+r" (ret)
|
|
:"m" (*v)
|
|
:"memory", "cc"
|
|
);
|