mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
s390/cmpxchg: Provide arch_try_cmpxchg128()
Since gcc 14 flag output operands are supported also for s390. Provide an arch_try_cmpxchg128() implementation so that all existing try_cmpxchg128() variants provide slightly better code, if compiled with gcc 14 or newer. Reviewed-by: Juergen Christ <jchrist@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
de9e2eb891
commit
c76b3bc285
@ -251,4 +251,23 @@ static __always_inline u128 arch_cmpxchg128(volatile u128 *ptr, u128 old, u128 n
|
||||
#define arch_cmpxchg128 arch_cmpxchg128
|
||||
#define arch_cmpxchg128_local arch_cmpxchg128
|
||||
|
||||
#ifdef __HAVE_ASM_FLAG_OUTPUTS__
|
||||
|
||||
static __always_inline bool arch_try_cmpxchg128(volatile u128 *ptr, u128 *oldp, u128 new)
|
||||
{
|
||||
int cc;
|
||||
|
||||
asm volatile(
|
||||
" cdsg %[old],%[new],%[ptr]\n"
|
||||
: [old] "+d" (*oldp), [ptr] "+QS" (*ptr), "=@cc" (cc)
|
||||
: [new] "d" (new)
|
||||
: "memory");
|
||||
return likely(cc == 0);
|
||||
}
|
||||
|
||||
#define arch_try_cmpxchg128 arch_try_cmpxchg128
|
||||
#define arch_try_cmpxchg128_local arch_try_cmpxchg128
|
||||
|
||||
#endif /* __HAVE_ASM_FLAG_OUTPUTS__ */
|
||||
|
||||
#endif /* __ASM_CMPXCHG_H */
|
||||
|
Loading…
Reference in New Issue
Block a user