lightning
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]