diff options
author | Levy Hsu <admin@levyhsu.com> | 2021-02-13 12:26:33 -0800 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2021-02-13 12:33:44 -0800 |
commit | 18fabc35f47f0abf4ec14d147098ec4e0734d2a3 (patch) | |
tree | 60f291aab71ca4af4d8c3de1e3ab32cb530bbc31 /gcc/ipa-reference.c | |
parent | a4953810bac524e19126a2745c75fed58db962c2 (diff) | |
download | gcc-18fabc35f47f0abf4ec14d147098ec4e0734d2a3.zip gcc-18fabc35f47f0abf4ec14d147098ec4e0734d2a3.tar.gz gcc-18fabc35f47f0abf4ec14d147098ec4e0734d2a3.tar.bz2 |
RISC-V: Avoid zero/sign extend for volatile loads. Fix for 97417.
This expands sub-word loads as a zero/sign extended load, followed by
a subreg. This helps eliminate unnecessary zero/sign extend insns after
the load, particularly for volatiles, but also in some other cases.
Testing shows that it gives consistent code size decreases.
Tested with riscv32-elf rv32imac/ilp32 and riscv64-linux rv64gc/lp064d
builds and checks. Some -gsplit-stack tests fail with the patch, but
this turns out to be an existing bug with the split-stack support that
I hadn't noticed before. It isn't a bug in this patch. Ignoring that
there are no regressions.
Committed.
gcc/
PR target/97417
* config/riscv/riscv-shorten-memrefs.c (pass_shorten_memrefs): Add
extend parameter to get_si_mem_base_reg declaration.
(get_si_mem_base_reg): Add extend parameter. Set it.
(analyze): Pass extend arg to get_si_mem_base_reg.
(transform): Likewise. Use it when rewriting mems.
* config/riscv/riscv.c (riscv_legitimize_move): Check for subword
loads and emit sign/zero extending load followed by subreg move.
Diffstat (limited to 'gcc/ipa-reference.c')
0 files changed, 0 insertions, 0 deletions