This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/81357] New: Extra mov for zero extend of add
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Jul 2017 05:29:40 +0000
- Subject: [Bug target/81357] New: Extra mov for zero extend of add
- Auto-submitted: auto-generated
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.