[Bug target/81357] New: Extra mov for zero extend of add
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jul 8 05:29:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81357
Bug ID: 81357
Summary: Extra mov for zero extend of add
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: aarch64-linux-gnu
Take:
unsigned long long d;
unsigned int test1(unsigned int fParm)
{
d = fParm + 1;
return fParm + 1;
}
--- CUT ---
Currently this produces:
test1:
add w2, w0, 1
adrp x1, d
str x2, [x1, #:lo12:d]
mov x0, x2
ret
But w0 is dead after the add, so why not use w0 instead of x2. This should
allow the removal of the mov at the end of the function.
This looks like it only shows up with function returns.
More information about the Gcc-bugs
mailing list