From: Kito Cheng <kito.cheng@gmail.com>
To: Palmer Dabbelt <palmer@rivosinc.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] RISC-V: Fix the V calling convention
Date: Fri, 2 Sep 2022 15:54:33 +0800 [thread overview]
Message-ID: <CA+yXCZCCscYnqSAHLQccje8FAxH0C4_9dZZuZJorYcje+iGGpA@mail.gmail.com> (raw)
In-Reply-To: <20220901032746.22765-1-palmer@rivosinc.com>
CALL_USED_REGISTERS already set those registers to 1, but I think it
is worth doing some clean up like this to prevent confusion.
On Thu, Sep 1, 2022 at 11:28 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> The V registers are always clobbered on calls.
>
> gcc/ChangeLog
>
> * config/riscv/riscv.cc (riscv_conditional_register_usage):
> Always mark the V registers as clobbered on calls.
> ---
> gcc/config/riscv/riscv.cc | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> index 675d92c0961..c18e61f4a03 100644
> --- a/gcc/config/riscv/riscv.cc
> +++ b/gcc/config/riscv/riscv.cc
> @@ -5442,11 +5442,18 @@ riscv_conditional_register_usage (void)
> if (!TARGET_VECTOR)
> {
> for (int regno = V_REG_FIRST; regno <= V_REG_LAST; regno++)
> - fixed_regs[regno] = call_used_regs[regno] = 1;
> + fixed_regs[regno] = 1;
>
> - fixed_regs[VTYPE_REGNUM] = call_used_regs[VTYPE_REGNUM] = 1;
> - fixed_regs[VL_REGNUM] = call_used_regs[VL_REGNUM] = 1;
> + fixed_regs[VTYPE_REGNUM] = 1;
> + fixed_regs[VL_REGNUM] = 1;
> }
So we only need the above change I think.
> +
> + /* The standard ABIs all clobber the entire vector state on calls. */
> + for (int regno = V_REG_FIRST; regno <= V_REG_LAST; regno++)
> + call_used_regs[regno] = 1;
> +
> + call_used_regs[VTYPE_REGNUM] = 1;
> + call_used_regs[VL_REGNUM] = 1;
> }
>
> /* Return a register priority for hard reg REGNO. */
> --
> 2.34.1
>
prev parent reply other threads:[~2022-09-02 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 3:27 Palmer Dabbelt
2022-09-01 3:27 ` Palmer Dabbelt
2022-09-02 7:54 ` Kito Cheng [this message]
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=CA+yXCZCCscYnqSAHLQccje8FAxH0C4_9dZZuZJorYcje+iGGpA@mail.gmail.com \
--to=kito.cheng@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=palmer@rivosinc.com \
/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).