]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: bitops: Only use ins for bit 16 or higher
authorPaul Burton <paul.burton@mips.com>
Tue, 1 Oct 2019 21:53:26 +0000 (21:53 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 7 Oct 2019 16:42:39 +0000 (09:42 -0700)
commitf923e267e3d23760452618fed77d58331f6c39ec
treeb39ad6da2c40a4ee7c29892f319cf7938d5bd6d6
parentab42a86b07f30855ce5fac7220f08b92324a42ff
MIPS: bitops: Only use ins for bit 16 or higher

set_bit() can set bits 0-15 using an ori instruction, rather than
loading the value -1 into a register & then using an ins instruction.

That is, rather than the following:

  li   t0, -1
  ll   t1, 0(t2)
  ins  t1, t0, 4, 1
  sc   t1, 0(t2)

We can have the simpler:

  ll   t1, 0(t2)
  ori  t1, t1, 0x10
  sc   t1, 0(t2)

The or path already allows immediates to be used, so simply restricting
the ins path to bits that don't fit in immediates is sufficient to take
advantage of this.

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