@@ -223,6 +223,7 @@ static inline int32_t opal_atomic_swap_32(volatile int32_t *addr, int32_t newval
223223#if  (OPAL_ASSEMBLY_ARCH  ==  OPAL_POWERPC64 )
224224
225225#if   OPAL_GCC_INLINE_ASSEMBLY 
226+ 
226227static  inline  int64_t  opal_atomic_add_64  (volatile  int64_t *  v , int64_t  inc )
227228{
228229   int64_t  t ;
@@ -232,7 +233,7 @@ static inline int64_t opal_atomic_add_64 (volatile int64_t* v, int64_t inc)
232233                        "     stdcx.  %0, 0, %3    \n\t" 
233234                        "     bne-    1b           \n\t" 
234235                        : "=&r"  (t ), "=m"  (* v )
235-                         : "r"  (OPAL_ASM_VALUE64 (inc )), "r"  OPAL_ASM_ADDR (v )
236+                         : "r"  (OPAL_ASM_VALUE64 (inc )), "r"  OPAL_ASM_ADDR (v ),  "m"  ( * v ) 
236237                        : "cc ");
237238
238239   return  t ;
@@ -249,7 +250,7 @@ static inline int64_t opal_atomic_sub_64 (volatile int64_t* v, int64_t dec)
249250                        "     stdcx.  %0,0,%3      \n\t" 
250251                        "     bne-    1b           \n\t" 
251252                        : "=&r"  (t ), "=m"  (* v )
252-                         : "r"  (OPAL_ASM_VALUE64 (dec )), "r"  OPAL_ASM_ADDR (v )
253+                         : "r"  (OPAL_ASM_VALUE64 (dec )), "r"  OPAL_ASM_ADDR (v ),  "m"  ( * v ) 
253254                        : "cc ");
254255
255256   return  t ;
@@ -268,7 +269,7 @@ static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
268269                         "   bne-    1b         \n\t" 
269270                         "2:" 
270271                         : "=&r"  (ret ), "=m"  (* addr )
271-                          : "r"  (addr ), "r"  (OPAL_ASM_VALUE64 (oldval )), "r"  (OPAL_ASM_VALUE64 (newval ))
272+                          : "r"  (addr ), "r"  (OPAL_ASM_VALUE64 (oldval )), "r"  (OPAL_ASM_VALUE64 (newval )),  "m"  ( * addr ) 
272273                         : "cc" , "memory" );
273274
274275   return  (ret  ==  oldval );
0 commit comments