Skip to content

Commit 1200f21

Browse files
committed
s390/spinlock: Generate shorter code for arch_spin_unlock()
Use mvhhi instead of sth to write a zero to spinlocks. Compared to the sth variant this avoids the load of zero to a register, and reduces register pressure. Signed-off-by: Heiko Carstens <[email protected]>
1 parent 2c3bc13 commit 1200f21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/s390/include/asm/spinlock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp)
8282
kcsan_release();
8383
asm_inline volatile(
8484
ALTERNATIVE("nop", ".insn rre,0xb2fa0000,7,0", ALT_FACILITY(49)) /* NIAI 7 */
85-
" sth %[zero],%[lock]\n"
86-
: [lock] "=R" (((unsigned short *)&lp->lock)[1])
87-
: [zero] "d" (0)
85+
" mvhhi %[lock],0\n"
86+
: [lock] "=Q" (((unsigned short *)&lp->lock)[1])
87+
:
8888
: "memory");
8989
}
9090

0 commit comments

Comments
 (0)