diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2008-10-24 16:53:33 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-11-05 09:51:02 -0800 |
commit | 838e8bb71dc0c892bf8f84abd3c709d8fe3a8d3c (patch) | |
tree | 3cae439c32d1e046aba1f0cb6fa81aeed482a91c /arch/x86/include/asm/bitops.h | |
parent | a376f30a95a796cde81d6dffde0f5243c8bd8f92 (diff) | |
download | kernel_samsung_tuna-838e8bb71dc0c892bf8f84abd3c709d8fe3a8d3c.zip kernel_samsung_tuna-838e8bb71dc0c892bf8f84abd3c709d8fe3a8d3c.tar.gz kernel_samsung_tuna-838e8bb71dc0c892bf8f84abd3c709d8fe3a8d3c.tar.bz2 |
x86: Implement change_bit with immediate operand as "lock xorb"
Impact: Minor optimization.
Implement change_bit with immediate bit count as "lock xorb". This is
similar to "lock orb" and "lock andb" for set_bit and clear_bit
functions.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/include/asm/bitops.h')
-rw-r--r-- | arch/x86/include/asm/bitops.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 3600103..9fa9dcd 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -168,7 +168,15 @@ static inline void __change_bit(int nr, volatile unsigned long *addr) */ static inline void change_bit(int nr, volatile unsigned long *addr) { - asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr)); + if (IS_IMMEDIATE(nr)) { + asm volatile(LOCK_PREFIX "xorb %1,%0" + : CONST_MASK_ADDR(nr, addr) + : "iq" ((u8)CONST_MASK(nr))); + } else { + asm volatile(LOCK_PREFIX "btc %1,%0" + : BITOP_ADDR(addr) + : "Ir" (nr)); + } } /** |