This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/50603] New: [x32] Unnecessary lea
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 03 Oct 2011 17:33:05 +0000
- Subject: [Bug target/50603] New: [x32] Unnecessary lea
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50603
Bug #: 50603
Summary: [x32] Unnecessary lea
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hjl.tools@gmail.com
CC: ubizjak@gmail.com
[hjl@gnu-6 ilp32-2]$ cat int.c
extern int *foo;
int bar (int x) { return foo[x]; }
[hjl@gnu-6 ilp32-2]$ make int.s
/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -mx32 -O2 int.c
[hjl@gnu-6 ilp32-2]$ cat int.s
.file "int.c"
.text
.p2align 4,,15
.globl bar
.type bar, @function
bar:
.LFB0:
.cfi_startproc
movl foo(%rip), %eax
leal (%rax,%rdi,4), %edi
movl (%edi), %eax
ret
.cfi_endproc
.LFE0:
.size bar, .-bar
.ident "GCC: (GNU) 4.7.0 20110923 (experimental)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 ilp32-2]$
We can generate
movl foo(%rip), %eax
movl (%eax,%edi,4), %eax
ret