Skip to content
Snippets Groups Projects
Commit a16dc729 authored by Jivan Hakobyan's avatar Jivan Hakobyan Committed by Jeff Law
Browse files

RISC-V: Folding memory for FP + constant case

Accessing local arrays element turned into load form (fp + (index << C1)) +
C2 address.

In the case when access is in the loop we got loop invariant computation.  For
some reason, moving out that part cannot be done in loop-invariant passes.  But
we can handle that in target-specific hook (legitimize_address).  That provides
an opportunity to rewrite memory access more suitable for the target
architecture.

This patch solves the mentioned case by rewriting mentioned case to ((fp +
C2) + (index << C1))

I have evaluated it on SPEC2017 and got an improvement on leela (over 7b
instructions, .39% of the dynamic count) and dwarfs the regression for gcc (14m
instructions, .0012% of the dynamic count).

gcc/ChangeLog:
	* config/riscv/riscv.cc (riscv_legitimize_address): Handle folding.
	(mem_shadd_or_shadd_rtx_p): New function.
parent 7fb65f10
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment