diff options
author | Tiezhu Yang <yangtiezhu@loongson.cn> | 2023-01-17 11:42:16 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-01-17 11:42:16 +0800 |
commit | 2959fce7fdb73fc784aefd58cc34b1ba700826aa (patch) | |
tree | 36e908ae88eb32480cddd35fc422c8d2df2fbc62 /arch/loongarch/include/asm/inst.h | |
parent | d52fec86a465355b379e839fa372ead0334d62e6 (diff) | |
download | lwn-2959fce7fdb73fc784aefd58cc34b1ba700826aa.tar.gz lwn-2959fce7fdb73fc784aefd58cc34b1ba700826aa.zip |
LoongArch: Use common function sign_extend64()
There exists a common function sign_extend64() to sign extend a 64-bit
value using specified bit as sign-bit in include/linux/bitops.h, it is
more efficient, let us use it and remove the arch-specific sign_extend()
under arch/loongarch.
Suggested-by: Jinyang He <hejinyang@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/include/asm/inst.h')
-rw-r--r-- | arch/loongarch/include/asm/inst.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/arch/loongarch/include/asm/inst.h b/arch/loongarch/include/asm/inst.h index c00e1512d4fa..6cd994d6d9d0 100644 --- a/arch/loongarch/include/asm/inst.h +++ b/arch/loongarch/include/asm/inst.h @@ -377,14 +377,6 @@ static inline bool unsigned_imm_check(unsigned long val, unsigned int bit) return val < (1UL << bit); } -static inline unsigned long sign_extend(unsigned long val, unsigned int idx) -{ - if (!is_imm_negative(val, idx + 1)) - return ((1UL << idx) - 1) & val; - else - return ~((1UL << idx) - 1) | val; -} - #define DEF_EMIT_REG0I26_FORMAT(NAME, OP) \ static inline void emit_##NAME(union loongarch_instruction *insn, \ int offset) \ |