summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/cmpxchg.h
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2021-04-13 16:30:32 +0300
committerHeiko Carstens <hca@linux.ibm.com>2021-04-15 18:47:42 +0300
commit3e5ee32392efd00399d038cdad07478237d9a9f1 (patch)
tree0b7eea217a639bf14d28cb3966fd9c303b836809 /arch/s390/include/asm/cmpxchg.h
parent5d8da6951ee2b2f7785ead62f785f3b3dd254104 (diff)
downloadlinux-3e5ee32392efd00399d038cdad07478237d9a9f1.tar.xz
s390/atomic,cmpxchg: make constraints work with old compilers
Old gcc versions may fail with an internal compiler error if only the T or S constraint is specified for an operand, and no displacement is needed at all. To fix this use RT and QS as constraints, which reflects the union of both. Later gcc versions do the right thing and always accept single T and S constraints. See gcc commit 3e4be43f69da ("S/390: Memory constraint cleanup"). Fixes: ca897bb1814f ("s390/atomic: use proper constraints") Fixes: b23eb636d7f9 ("s390/atomic: get rid of gcc atomic builtins") Fixes: d2b1f6d2d350 ("s390/cmpxchg: get rid of gcc atomic builtins") Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/cmpxchg.h')
-rw-r--r--arch/s390/include/asm/cmpxchg.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxchg.h
index 6ae4e8a288a2..e1eb65fceef2 100644
--- a/arch/s390/include/asm/cmpxchg.h
+++ b/arch/s390/include/asm/cmpxchg.h
@@ -62,7 +62,7 @@ static inline unsigned long __xchg(unsigned long x, unsigned long address, int s
" lg %0,%1\n"
"0: csg %0,%2,%1\n"
" jl 0b\n"
- : "=&d" (old), "+S" (*(long *) address)
+ : "=&d" (old), "+QS" (*(long *) address)
: "d" (x)
: "memory", "cc");
return old;
@@ -142,7 +142,7 @@ static inline unsigned long __cmpxchg(unsigned long address, unsigned long old,
case 8:
asm volatile(
" csg %0,%3,%1\n"
- : "=&d" (prev), "+S" (*(long *) address)
+ : "=&d" (prev), "+QS" (*(long *) address)
: "0" (old), "d" (new)
: "memory", "cc");
return prev;