diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2024-12-05 11:24:30 +0100 |
---|---|---|
committer | Georg-Johann Lay <avr@gjlay.de> | 2024-12-05 12:43:50 +0100 |
commit | bf6f77edd625cfe2f2f164e90437df318b96527f (patch) | |
tree | bb570f283320934cde6c5ef41553240f4c99fd6c /gcc/c | |
parent | b78c0dcb1b6b523880ee193698defca3ebd0b3f7 (diff) | |
download | gcc-bf6f77edd625cfe2f2f164e90437df318b96527f.zip gcc-bf6f77edd625cfe2f2f164e90437df318b96527f.tar.gz gcc-bf6f77edd625cfe2f2f164e90437df318b96527f.tar.bz2 |
AVR: target/107957 - Propagate zero_reg to store sources.
When -msplit-ldst is on, it may be possible to propagate __zero_reg__
to the sources of the new stores. For example, without this patch,
unsigned long lx;
void store_lsr17 (void)
{
lx >>= 17;
}
compiles to:
store_lsr17:
lds r26,lx+2 ; movqi_insn
lds r27,lx+3 ; movqi_insn
movw r24,r26 ; *movhi
lsr r25 ; *lshrhi3_const
ror r24
ldi r26,0 ; movqi_insn
ldi r27,0 ; movqi_insn
sts lx,r24 ; movqi_insn
sts lx+1,r25 ; movqi_insn
sts lx+2,r26 ; movqi_insn
sts lx+3,r27 ; movqi_insn
ret
but with this patch it becomes:
store_lsr17:
lds r26,lx+2 ; movqi_insn
lds r27,lx+3 ; movqi_insn
movw r24,r26 ; *movhi
lsr r25 ; *lshrhi3_const
ror r24
sts lx,r24 ; movqi_insn
sts lx+1,r25 ; movqi_insn
sts lx+2,__zero_reg__ ; movqi_insn
sts lx+3,__zero_reg__ ; movqi_insn
ret
gcc/
PR target/107957
* config/avr/avr-passes-fuse-move.h (bbinfo_t) <try_mem0_p>:
Add static property.
* config/avr/avr-passes.cc (bbinfo_t::try_mem0_p): Define it.
(optimize_data_t::try_mem0): New method.
(bbinfo_t::optimize_one_block) [bbinfo_t::try_mem0_p]: Run try_mem0.
(bbinfo_t::optimize_one_function): Set bbinfo_t::try_mem0_p.
* config/avr/avr.md (pushhi1_insn): Also allow zero as source.
(define_split) [avropt_split_ldst]: Only run avr_split_ldst()
when avr-fuse-move has been run at least once.
* doc/invoke.texi (AVR Options) <-msplit-ldst>: Document it.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions