Skip to content

Commit ca897bb

Browse files
committed
s390/atomic: use proper constraints
Use the R,T, and S constraints instead of the Q constraint in atomic inline assemblies wherever possible. This allows the compiler to generate better code. (~ -2kb code size). Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent c8a91c2 commit ca897bb

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

arch/s390/include/asm/atomic_ops.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ static inline int __atomic_read(const atomic_t *v)
1414

1515
asm volatile(
1616
" l %0,%1\n"
17-
: "=d" (c) : "Q" (v->counter));
17+
: "=d" (c) : "R" (v->counter));
1818
return c;
1919
}
2020

2121
static inline void __atomic_set(atomic_t *v, int i)
2222
{
2323
asm volatile(
2424
" st %1,%0\n"
25-
: "=Q" (v->counter) : "d" (i));
25+
: "=R" (v->counter) : "d" (i));
2626
}
2727

2828
static inline s64 __atomic64_read(const atomic64_t *v)
@@ -31,15 +31,15 @@ static inline s64 __atomic64_read(const atomic64_t *v)
3131

3232
asm volatile(
3333
" lg %0,%1\n"
34-
: "=d" (c) : "Q" (v->counter));
34+
: "=d" (c) : "T" (v->counter));
3535
return c;
3636
}
3737

3838
static inline void __atomic64_set(atomic64_t *v, s64 i)
3939
{
4040
asm volatile(
4141
" stg %1,%0\n"
42-
: "=Q" (v->counter) : "d" (i));
42+
: "=T" (v->counter) : "d" (i));
4343
}
4444

4545
#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
@@ -52,7 +52,7 @@ static inline op_type op_name(op_type val, op_type *ptr) \
5252
asm volatile( \
5353
op_string " %[old],%[val],%[ptr]\n" \
5454
op_barrier \
55-
: [old] "=d" (old), [ptr] "+Q" (*ptr) \
55+
: [old] "=d" (old), [ptr] "+S" (*ptr) \
5656
: [val] "d" (val) : "cc", "memory"); \
5757
return old; \
5858
} \
@@ -80,7 +80,7 @@ static __always_inline void op_name(op_type val, op_type *ptr) \
8080
asm volatile( \
8181
op_string " %[ptr],%[val]\n" \
8282
op_barrier \
83-
: [ptr] "+Q" (*ptr) : [val] "i" (val) : "cc", "memory");\
83+
: [ptr] "+S" (*ptr) : [val] "i" (val) : "cc", "memory");\
8484
}
8585

8686
#define __ATOMIC_CONST_OPS(op_name, op_type, op_string) \
@@ -131,7 +131,7 @@ static inline long op_name(long val, long *ptr) \
131131
op_string " %[new],%[val]\n" \
132132
" csg %[old],%[new],%[ptr]\n" \
133133
" jl 0b" \
134-
: [old] "=d" (old), [new] "=&d" (new), [ptr] "+Q" (*ptr)\
134+
: [old] "=d" (old), [new] "=&d" (new), [ptr] "+S" (*ptr)\
135135
: [val] "d" (val), "0" (*ptr) : "cc", "memory"); \
136136
return old; \
137137
}

0 commit comments

Comments
 (0)