riscv: atomic: Optimize dec_if_positive functions
authorGuo Ren <guoren@linux.alibaba.com>
Thu, 5 May 2022 03:55:23 +0000 (11:55 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Sat, 21 May 2022 17:31:46 +0000 (10:31 -0700)
commit1d7f6932c522ea95668e14265175ce3d753d0c24
tree1e086c935a6ee78823da19e88172fcacb5172800
parentdd8437cd4249e367f747a37b6a19d4cd04bf8796
riscv: atomic: Optimize dec_if_positive functions

Current implementation wastes another register to pass the
argument, but we only need addi to calculate the result. Optimize
the code with minimize the usage of registers.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/20220505035526.2974382-3-guoren@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/atomic.h