public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jeff Law <law@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] [RISC-V] correct machine mode in save-restore cfi RTL. Date: Mon, 12 Jun 2023 14:25:21 +0000 (GMT) [thread overview] Message-ID: <20230612142521.23A1C3858D20@sourceware.org> (raw) https://gcc.gnu.org/g:b18d9371dc5043b6fb9b23d840f4338bb9591d96 commit b18d9371dc5043b6fb9b23d840f4338bb9591d96 Author: Fei Gao <gaofei@eswincomputing.com> Date: Mon Jun 5 20:09:03 2023 -0600 [RISC-V] correct machine mode in save-restore cfi RTL. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_adjust_libcall_cfi_prologue): Use Pmode for cfi reg/mem machmode (riscv_adjust_libcall_cfi_epilogue): Use Pmode for cfi reg machmode gcc/testsuite/ChangeLog: * gcc.target/riscv/save-restore-cfi-2.c: New test to check machmode for cfi reg/mem. Diff: --- gcc/config/riscv/riscv.cc | 10 +++++----- gcc/testsuite/gcc.target/riscv/save-restore-cfi-2.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index caa7858b864..3954c89a039 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -5370,10 +5370,10 @@ riscv_adjust_libcall_cfi_prologue () else offset = saved_size - ((regno - S2_REGNUM + 4) * UNITS_PER_WORD); - reg = gen_rtx_REG (SImode, regno); - mem = gen_frame_mem (SImode, plus_constant (Pmode, - stack_pointer_rtx, - offset)); + reg = gen_rtx_REG (Pmode, regno); + mem = gen_frame_mem (Pmode, plus_constant (Pmode, + stack_pointer_rtx, + offset)); insn = gen_rtx_SET (mem, reg); dwarf = alloc_reg_note (REG_CFA_OFFSET, insn, dwarf); @@ -5510,7 +5510,7 @@ riscv_adjust_libcall_cfi_epilogue () for (int regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++) if (BITSET_P (cfun->machine->frame.mask, regno - GP_REG_FIRST)) { - reg = gen_rtx_REG (SImode, regno); + reg = gen_rtx_REG (Pmode, regno); dwarf = alloc_reg_note (REG_CFA_RESTORE, reg, dwarf); } diff --git a/gcc/testsuite/gcc.target/riscv/save-restore-cfi-2.c b/gcc/testsuite/gcc.target/riscv/save-restore-cfi-2.c new file mode 100644 index 00000000000..44d805b4de8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/save-restore-cfi-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-rtl-pro_and_epilogue -O2 -march=rv64gc -mabi=lp64d -msave-restore -mcmodel=medany" } */ +/* { dg-skip-if "" { *-*-* } {"-Os" "-O1" "-O0" "-Og" "-O3" "-Oz" "-flto"} } */ +/* { dg-final { scan-rtl-dump {expr_list:REG_CFA_OFFSET \(set \(mem/c:DI} "pro_and_epilogue" } } */ +/* { dg-final { scan-rtl-dump {expr_list:REG_CFA_RESTORE \(reg:DI 8 s0\)} "pro_and_epilogue" } } */ + +char my_getchar(); +float getf(); + +int foo() +{ + int s0 = my_getchar(); + float f0 = getf(); + int b = my_getchar(); + return f0 + s0 + b; +}
next reply other threads:[~2023-06-12 14:25 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-12 14:25 Jeff Law [this message] 2023-07-14 2:43 Jeff Law
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=20230612142521.23A1C3858D20@sourceware.org \ --to=law@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: linkBe 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).