public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] aarch64: Fix CADImode case of hard_regno_mode_ok
@ 2022-03-14 10:34 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-03-14 10:34 UTC (permalink / raw)
  To: gcc-cvs

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");


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-14 10:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 10:34 [gcc(refs/vendors/ARM/heads/morello)] aarch64: Fix CADImode case of hard_regno_mode_ok Matthew Malcomson

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).