[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/9] mips: Fix is_low_mask() to support -1
From: |
Paul Cercueil |
Subject: |
[PATCH 2/9] mips: Fix is_low_mask() to support -1 |
Date: |
Thu, 19 May 2022 10:39:11 +0100 |
A value of -1 (all bits set) can technically be considered as a "low
mask".
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
lib/jit_mips-cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/jit_mips-cpu.c b/lib/jit_mips-cpu.c
index 0014e90..b81bd96 100644
--- a/lib/jit_mips-cpu.c
+++ b/lib/jit_mips-cpu.c
@@ -110,7 +110,7 @@ typedef union {
# endif
# define can_sign_extend_short_p(im) ((im) >= -32678 && (im) <= 32767)
# define can_zero_extend_short_p(im) ((im) >= 0 && (im) <= 65535)
-# define is_low_mask(im) (((im) & 1) ? (__builtin_popcountl((im)
+ 1) == 1) : 0)
+# define is_low_mask(im) (((im) & 1) ? (__builtin_popcountl((im)
+ 1) <= 1) : 0)
# define is_high_mask(im) ((im) ? (__builtin_popcountl((im) + (1
<< __builtin_ctzl(im))) == 0) : 0)
# define masked_bits_count(im) __builtin_popcountl(im)
# define unmasked_bits_count(im) (__WORDSIZE - masked_bits_count(im))
--
2.35.1
- [PATCH 0/9] MIPS improvements, Paul Cercueil, 2022/05/19
- [PATCH 1/9] mips: Properly define jit_mips2_p(), Paul Cercueil, 2022/05/19
- [PATCH 2/9] mips: Fix is_low_mask() to support -1,
Paul Cercueil <=
- [PATCH 3/9] mips: Optimize jit_andi further, Paul Cercueil, 2022/05/19
- [PATCH 4/9] mips: Optimize jit_bmsi / jit_bmci, Paul Cercueil, 2022/05/19
- [PATCH 5/9] mips: Optimize jit_extr_ui, Paul Cercueil, 2022/05/19
- [PATCH 6/9] mips: Use 32-bit MUL opcode for mulr() on 32-bit MIPS, Paul Cercueil, 2022/05/19
- [PATCH 7/9] mips: Optimize jit_lei / jit_lei_u, Paul Cercueil, 2022/05/19
- [PATCH 8/9] mips: Optimize jit_gei/jit_gei_u, Paul Cercueil, 2022/05/19
- [PATCH 9/9] mips: Optimize jit_htonr_us/jit_htonr_ui, Paul Cercueil, 2022/05/19