public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] aarch64: Fix CADImode case of hard_regno_mode_ok
Date: Mon, 14 Mar 2022 10:34:21 +0000 (GMT)	[thread overview]
Message-ID: <20220314103421.8CFDB3857829@sourceware.org> (raw)

https://gcc.gnu.org/g:32ea15f06b16599bf16f737cff30ad201ca3eb1f

commit 32ea15f06b16599bf16f737cff30ad201ca3eb1f
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Fri Feb 25 16:20:57 2022 +0000

    aarch64: Fix CADImode case of hard_regno_mode_ok
    
    This patch allows us to compile some code from newlib that was
    previously being incorrectly rejected. Prior to this patch, we would
    reject the stack pointer (CSP) in aarch64_hard_regno_mode_ok with mode =
    CADImode. This changes the CADImode case to use
    aarch64_regno_ok_for_base_p, which further allows the stack pointer, as
    well as the fake frame and argument pointers.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Adjust
            CADImode case to use aarch64_regno_ok_for_base_p.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/morello/access-csp.c: New test.

Diff:
---
 gcc/config/aarch64/aarch64.c                          | 2 +-
 gcc/testsuite/gcc.target/aarch64/morello/access-csp.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index cf18d63dc30..d3a9017ab3e 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2650,7 +2650,7 @@ static bool
 aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode)
 {
   if (mode == CADImode)
-    return GP_REGNUM_P (regno);
+    return aarch64_regno_ok_for_base_p (regno, true);
 
   if (GET_MODE_CLASS (mode) == MODE_CC)
     return regno == CC_REGNUM;
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/access-csp.c b/gcc/testsuite/gcc.target/aarch64/morello/access-csp.c
new file mode 100644
index 00000000000..fc2c4b5ed00
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/morello/access-csp.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-std=gnu99" } */
+register char * stack_ptr asm ("sp");


                 reply	other threads:[~2022-03-14 10:34 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=20220314103421.8CFDB3857829@sourceware.org \
    --to=matmal01@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).