[Bug rtl-optimization/117910] New: [avr][lra] Wrong code with -mlra in cmpdi-1.c
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 4 11:37:35 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117910
Bug ID: 117910
Summary: [avr][lra] Wrong code with -mlra in cmpdi-1.c
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gjl at gcc dot gnu.org
Target Milestone: ---
Created attachment 59782
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59782&action=edit
Reduced C test case from cmpdi-1.c
There is yet another fail with -mlra with the attached cmpdi-1.c that produces
wrong code.
$avr-gcc -mmcu=atmega128 -dumpbase "" -save-temps -dp -Os -o cmpdi-1.elf -mlra
-fverbose-asm cmpdi-1.c
Notice the following load / stores involving Y+12 and X+12 in cmpdi-1.s:
std Y+13,r25 ; %sfp, _51 ; 685 [c=4 l=2] *movhi/3
std Y+12,r24 ; %sfp, _51
...
std Y+12,r25 ; %sfp, tmp162 ; 588 [c=4 l=2] *movhi/3
std Y+11,r24 ; %sfp, tmp162
...
std Y+11,r24 ; %sfp, arg1 ; 615 [c=4 l=1] movqi_insn/2
...
ldd r16,Y+11 ; , %sfp ; 640 [c=4 l=1] movqi_insn/3
...
std Y+12,r9 ; %sfp, res ; 439 [c=4 l=2] *movhi/3
std Y+11,r8 ; %sfp, res
...
ldd r24,Y+12 ; _51, %sfp ; 435 [c=8 l=2] *movhi/2
ldd r25,Y+13 ; _51, %sfp
So it seems LRA is trampling some values / is using wrong offsets.
Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --with-long-double=64
--enable-languages=c,c++
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241203 (experimental) (GCC)
More information about the Gcc-bugs
mailing list