"uint64_t a & 0xffffffff" expands to two and:SI with -O0:
(insn 8 7 9 (set (subreg:SI (reg:DI 82 [ a_2 ]) 0)
(and:SI (reg:SI 83)
(const_int -1 [0xffffffffffffffff]))) "t.c":3:5 -1
(nil))
(insn 10 9 11 (set (subreg:SI (reg:DI 82 [ a_2 ]) 4)
(and:SI (reg:SI 84)
(const_int 0 [0]))) "t.c":3:5 -1
(nil))
"*and<mode>3_extend" template -> Yx constraint -> low_bitmask_operand predicate
-> low_bitmask_len(VOIDmode, 0xffffffffffffffff) return -1 result in:
../src/repart/repart.c:6321:1: error: unable to generate reloads for:
(insn 72 71 73 8 (set (subreg:SI (reg:DI 150 [ f_63 ]) 0)
(and:SI (reg:SI 151)
(const_int -1 [0xffffffffffffffff])))
"../src/repart/repart.c":6289:29 discrim 2 102 {*andsi3_extend}
(expr_list:REG_DEAD (reg:SI 151)
(nil)))
during RTL pass: reload
Add (match_test "INTVAL (op) == -1") to low_bitmask_operand predicate.
gcc/ChangeLog:
* config/loongarch/predicates.md: Add (match_test "INTVAL (op) == -1")
to low_bitmask_operand
---
gcc/config/loongarch/predicates.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/config/loongarch/predicates.md
b/gcc/config/loongarch/predicates.md
index dd30eb84c4e..77c9230fac2 100644
--- a/gcc/config/loongarch/predicates.md
+++ b/gcc/config/loongarch/predicates.md
@@ -291,7 +291,9 @@ (define_predicate "si_mask_operand"
(define_predicate "low_bitmask_operand"
(and (match_code "const_int")
- (match_test "low_bitmask_len (mode, INTVAL (op)) > 12")
+ (ior
+ (match_test "low_bitmask_len (mode, INTVAL (op)) > 12")
+ (match_test "INTVAL (op) == -1"))
(match_test "!TARGET_32BIT_R")))
(define_predicate "d_operand"
--
2.34.1