RISC-V: Describe correct USEs for gpr_save pattern [PR95252]
authorKito Cheng <kito.cheng@sifive.com>
Thu, 11 Jun 2020 02:40:59 +0000 (19:40 -0700)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 11 Jun 2020 02:40:59 +0000 (19:40 -0700)
commitd0e0c1300f9f08608873df5571e14a61308dd0c0
tree071dc677a6be1d9678939876f1f8eaf213e67684
parentec6ffbb919cdde26da3fbc949e65d564c70a3084
RISC-V: Describe correct USEs for gpr_save pattern [PR95252]

 - Verified on rv32emc/rv32gc/rv64gc bare-metal target and rv32gc/rv64gc
   linux target with qemu.

gcc/ChangeLog:

* config/riscv/predicates.md (gpr_save_operation): New.
* config/riscv/riscv-protos.h (riscv_gen_gpr_save_insn): New.
(riscv_gpr_save_operation_p): Ditto.
* config/riscv/riscv-sr.c (riscv_remove_unneeded_save_restore_calls):
Ignore USEs for gpr_save patter.
* config/riscv/riscv.c (gpr_save_reg_order): New.
(riscv_expand_prologue): Use riscv_gen_gpr_save_insn to gen gpr_save.
(riscv_gen_gpr_save_insn): New.
(riscv_gpr_save_operation_p): Ditto.
* config/riscv/riscv.md (S3_REGNUM): New.
(S4_REGNUM): Ditto.
(S5_REGNUM): Ditto.
(S6_REGNUM): Ditto.
(S7_REGNUM): Ditto.
(S8_REGNUM): Ditto.
(S9_REGNUM): Ditto.
(S10_REGNUM): Ditto.
(S11_REGNUM): Ditto.
(gpr_save): Model USEs correctly.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr95252.c: New.
gcc/config/riscv/predicates.md
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv-sr.c
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.md
gcc/testsuite/gcc.target/riscv/pr95252.c [new file with mode: 0644]