Skip to content

Commit d4be138

Browse files
committed
asm/ppc: work around apparent PGI 16.9 bug
The add_64, sub_64, and cmpset_64 atomics used "+m" (*addr) to indicate the asm also writes the memory location. This is better than using a memory clobber. PGI 16.9 introduced a bug that causes a compiler failure on the "+m" constraint (input/output). It seems to work with "=m" (output) which matches the 32-bit atomics. Fixes #2086 Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from commit 2edc77b)
1 parent 53bf15e commit d4be138

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

opal/include/opal/sys/powerpc/atomic.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static inline int64_t opal_atomic_add_64 (volatile int64_t* v, int64_t inc)
231231
" add %0, %2, %0 \n\t"
232232
" stdcx. %0, 0, %3 \n\t"
233233
" bne- 1b \n\t"
234-
: "=&r" (t), "+m" (*v)
234+
: "=&r" (t), "=m" (*v)
235235
: "r" (OPAL_ASM_VALUE64(inc)), "r" OPAL_ASM_ADDR(v)
236236
: "cc");
237237

@@ -248,7 +248,7 @@ static inline int64_t opal_atomic_sub_64 (volatile int64_t* v, int64_t dec)
248248
" subf %0,%2,%0 \n\t"
249249
" stdcx. %0,0,%3 \n\t"
250250
" bne- 1b \n\t"
251-
: "=&r" (t), "+m" (*v)
251+
: "=&r" (t), "=m" (*v)
252252
: "r" (OPAL_ASM_VALUE64(dec)), "r" OPAL_ASM_ADDR(v)
253253
: "cc");
254254

@@ -267,7 +267,7 @@ static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
267267
" stdcx. %4, 0, %2 \n\t"
268268
" bne- 1b \n\t"
269269
"2:"
270-
: "=&r" (ret), "+m" (*addr)
270+
: "=&r" (ret), "=m" (*addr)
271271
: "r" (addr), "r" (OPAL_ASM_VALUE64(oldval)), "r" (OPAL_ASM_VALUE64(newval))
272272
: "cc", "memory");
273273

0 commit comments

Comments
 (0)