From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id 8CFDB3857829; Mon, 14 Mar 2022 10:34:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CFDB3857829 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] aarch64: Fix CADImode case of hard_regno_mode_ok X-Act-Checkin: gcc X-Git-Author: Alex Coplan X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: bdcb489bdaa102bf4e6f5dc773c94db5e7c596b1 X-Git-Newrev: 32ea15f06b16599bf16f737cff30ad201ca3eb1f Message-Id: <20220314103421.8CFDB3857829@sourceware.org> Date: Mon, 14 Mar 2022 10:34:21 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2022 10:34:21 -0000 https://gcc.gnu.org/g:32ea15f06b16599bf16f737cff30ad201ca3eb1f commit 32ea15f06b16599bf16f737cff30ad201ca3eb1f Author: Alex Coplan 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");