]> gcc.gnu.org Git - gcc.git/commit
RISC-V: Avoid zero/sign extend for volatile loads. Fix for 97417.
authorLevy Hsu <admin@levyhsu.com>
Sat, 13 Feb 2021 20:26:33 +0000 (12:26 -0800)
committerJim Wilson <jimw@sifive.com>
Sat, 13 Feb 2021 20:33:44 +0000 (12:33 -0800)
commit18fabc35f47f0abf4ec14d147098ec4e0734d2a3
tree60f291aab71ca4af4d8c3de1e3ab32cb530bbc31
parenta4953810bac524e19126a2745c75fed58db962c2
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.
gcc/config/riscv/riscv-shorten-memrefs.c
gcc/config/riscv/riscv.c
This page took 0.057657 seconds and 6 git commands to generate.