Skip to content

Commit ea81b05

Browse files
author
Luis Silva
committed
arcv: Fix immediate predicate for arcv_vclr.
arcv_vclr clears the lower imm[4:0] number of elements of vd. However, the current pattern uses imm5_operand, which only accepts values < 5 and therefore rejects valid immediates. The instruction encoding allows a 5-bit unsigned immediate, i.e. values in the range 0..31. Introduce a dedicated const_0_31_operand predicate and use it for arcv_vclr. Signed-off-by: Luis Silva <luiss@synopsys.com>
1 parent fd20ff6 commit ea81b05

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

gcc/config/riscv/arcv-vector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
(reg:SI VL_REGNUM)
266266
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
267267
(unspec:V_VLSI
268-
[(match_operand 3 "imm5_operand" "i,i,i,i,i,i,i,i,i,i,i,i")]
268+
[(match_operand 3 "const_0_31_operand" "i,i,i,i,i,i,i,i,i,i,i,i")]
269269
UNSPEC_ARCV_VCLR)
270270
(match_operand:V_VLSI 2 "vector_merge_operand" "vu,0,vu,0,vu,0,vu,0,vu,0,vu,0")))]
271271
"TARGET_XARCVVDSP"

gcc/config/riscv/predicates.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
(and (match_code "const_int")
6666
(match_test "IN_RANGE (INTVAL (op), 0, 10)")))
6767

68+
(define_predicate "const_0_31_operand"
69+
(and (match_code "const_int")
70+
(match_test "IN_RANGE (INTVAL (op), 0, 31)")))
71+
6872
(define_predicate "csr_operand"
6973
(ior (match_operand 0 "const_csr_operand")
7074
(match_operand 0 "register_operand")))

0 commit comments

Comments
 (0)