public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick O'Neill <poneill@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-4044] fix PR 111259 invalid zcmp mov predicate.
Date: Fri, 15 Sep 2023 20:44:01 +0000 (GMT)	[thread overview]
Message-ID: <20230915204401.A812B3858D35@sourceware.org> (raw)

https://gcc.gnu.org/g:d7b6020276a843e97f6135259b4ab3b53a5850e2

commit r14-4044-gd7b6020276a843e97f6135259b4ab3b53a5850e2
Author: Fei Gao <gaofei@eswincomputing.com>
Date:   Fri Sep 15 01:20:08 2023 +0000

    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: Palmer Dabbelt <palmer@rivosinc.com>
    Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

Diff:
---
 gcc/config/riscv/predicates.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index 53e7c1d03aa..4bc7ff2c9d8 100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -74,6 +74,7 @@
   (ior (match_operand 0 "const_0_operand")
        (match_operand 0 "register_operand")))
 
+;; ZCMP predicates
 (define_predicate "stack_push_up_to_ra_operand"
   (and (match_code "const_int")
        (match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op) * -1, 1)")))
@@ -170,13 +171,12 @@
   (and (match_code "const_int")
        (match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op), 13)")))
 
-;; ZCMP predicates
 (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)")))
 
 (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)
                     : IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM)
                     || IN_RANGE (REGNO (op), S2_REGNUM, S7_REGNUM)")))

                 reply	other threads:[~2023-09-15 20:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915204401.A812B3858D35@sourceware.org \
    --to=poneill@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).