]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Optimize RVV epilogue logic.
authorJia-Wei Chen <jiawei@iscas.ac.cn>
Thu, 17 Nov 2022 03:58:54 +0000 (22:58 -0500)
committerJeff Law <jeffreyalaw@gmail.com>
Thu, 17 Nov 2022 04:00:52 +0000 (23:00 -0500)
commita62d957342e3e9ee9bda812f737279f1166e03ba
treea59ee47de8a820f4386d88764b0e428a7947590d
parente214cab68cb34e77622b91113f7698cf137bbdd6
RISC-V: Optimize RVV epilogue logic.

Sometimes "step1 -= scalable_frame" will cause adjust equal to
zero. And it will generate additional redundant instruction
"addi sp,sp,0". Add checking segement to skip that case.

This testcase mix exist spill-1.c and adding new fun to check if
there have redundant addi intructions. Idea provided by Jeff Law.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_expand_epilogue):
Do not emit useless add sp, sp, 0 instrutions.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/spill-sp-adjust.c: New test.
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/rvv/base/spill-sp-adjust.c [new file with mode: 0644]