Skip to content
Snippets Groups Projects
Commit d7b60202 authored by Fei Gao's avatar Fei Gao Committed by Patrick O'Neill
Browse files

fix PR 111259 invalid zcmp mov predicate.


The code changes are from Palmer.

root cause:
In a gcc build with --enable-checking=yes, REGNO (op) checks
rtx code and expected code 'reg'. so a rtx with 'subreg' causes
an internal compiler error.

solution:
Restrict predicate to allow 'reg' only.

gcc/ChangeLog:

	* config/riscv/predicates.md: Restrict predicate
	to allow 'reg' only.
Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Acked-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent fd5a858e
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
(ior (match_operand 0 "const_0_operand") (ior (match_operand 0 "const_0_operand")
(match_operand 0 "register_operand"))) (match_operand 0 "register_operand")))
;; ZCMP predicates
(define_predicate "stack_push_up_to_ra_operand" (define_predicate "stack_push_up_to_ra_operand"
(and (match_code "const_int") (and (match_code "const_int")
(match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op) * -1, 1)"))) (match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op) * -1, 1)")))
...@@ -170,13 +171,12 @@ ...@@ -170,13 +171,12 @@
(and (match_code "const_int") (and (match_code "const_int")
(match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op), 13)"))) (match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op), 13)")))
;; ZCMP predicates
(define_predicate "a0a1_reg_operand" (define_predicate "a0a1_reg_operand"
(and (match_operand 0 "register_operand") (and (match_code "reg")
(match_test "IN_RANGE (REGNO (op), A0_REGNUM, A1_REGNUM)"))) (match_test "IN_RANGE (REGNO (op), A0_REGNUM, A1_REGNUM)")))
(define_predicate "zcmp_mv_sreg_operand" (define_predicate "zcmp_mv_sreg_operand"
(and (match_operand 0 "register_operand") (and (match_code "reg")
(match_test "TARGET_RVE ? IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM) (match_test "TARGET_RVE ? IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM)
: IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM) : IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM)
|| IN_RANGE (REGNO (op), S2_REGNUM, S7_REGNUM)"))) || IN_RANGE (REGNO (op), S2_REGNUM, S7_REGNUM)")))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment