public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] RISC-V: Optimize RVV epilogue logic.
@ 2022-11-15  8:33 jiawei
  2022-11-15  8:33 ` [PATCH v2 1/2] RISC-V: Add spill sp adjust check testcase jiawei
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: jiawei @ 2022-11-15  8:33 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, palmer, juzhe.zhong, jeffreyalaw, christoph.muellner,
	philipp.tomsich, wuwei2016, jiawei

Current epilogue will generate "addi sp,sp,0" redundant instruction.

```
        csrr    t0,vlenb
        slli    t1,t0,1
        add     sp,sp,t1
        addi    sp,sp,0
        ld      s0,24(sp)
        addi    sp,sp,32
        jr      ra
```

Optimize it by check if adjust equal to zero, remove redundant insn gen.

```
        csrr    t0,vlenb
        slli    t1,t0,1
        add     sp,sp,t1
        ld      s0,24(sp)
        addi    sp,sp,32
        jr      ra
```

Thanks for Kito and Jeff's suggestion, add testcase and fix code format.

jiawei (2):
  RISC-V: Add spill sp adjust check testcase.
  RISC-V: Optimize RVV epilogue logic.

 gcc/config/riscv/riscv.cc                     | 35 ++++++++++---------
 .../riscv/rvv/base/spill-sp-adjust.c          | 13 +++++++
 2 files changed, 32 insertions(+), 16 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/spill-sp-adjust.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-17  4:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  8:33 [PATCH v2 0/2] RISC-V: Optimize RVV epilogue logic jiawei
2022-11-15  8:33 ` [PATCH v2 1/2] RISC-V: Add spill sp adjust check testcase jiawei
2022-11-17  4:02   ` Jeff Law
2022-11-15  8:33 ` [PATCH v2 2/2] RISC-V: Optimize RVV epilogue logic jiawei
2022-11-15  8:39 ` [PATCH v2 0/2] " juzhe.zhong

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