OSDN Git Service

MIPS: bitops: Allow immediates in test_and_{set,clear,change}_bit
authorPaul Burton <paul.burton@mips.com>
Tue, 1 Oct 2019 21:53:31 +0000 (21:53 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 7 Oct 2019 16:42:49 +0000 (09:42 -0700)
commita2e66b862cc7b8db1a0eb63b71e61943d48c3c8a
tree8ff44c2c764642531e335e29cd00a4261204ae48
parent6bbe043bd3f4766b089b7b51a80e75745868c038
MIPS: bitops: Allow immediates in test_and_{set,clear,change}_bit

The logical operations or & xor used in the test_and_set_bit_lock(),
test_and_clear_bit() & test_and_change_bit() functions currently force
the value 1<<bit to be placed in a register. If the bit is compile-time
constant & fits within the immediate field of an or/xor instruction (ie.
16 bits) then we can make use of the ori/xori instruction variants &
avoid the use of an extra register. Add the extra "i" constraints in
order to allow use of these immediate encodings.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-kernel@vger.kernel.org
arch/mips/include/asm/bitops.h