GCC cannot move address calculation to store+load?
Miles Bader
miles@gnu.org
Fri Jan 18 15:58:00 GMT 2013
Richard Biener <richard.guenther@gmail.com> writes:
> Note that combine does not apply because %eax is used multiple
> times. This also means that for code-size the combining is not a good
> idea.
Though the lea instruction seems rather large, so in fact the code is
a fair bit smaller without it, e.g. as generated by clang/llvm:
clang/llvm 3.1 (-O2 -m32):
00000000 <foo>:
0: 8b 44 24 08 mov 0x8(%esp),%eax
4: 8b 4c 24 04 mov 0x4(%esp),%ecx
8: 8b 14 c1 mov (%ecx,%eax,8),%edx
b: 89 15 00 00 00 00 mov %edx,0x0
11: 89 04 c1 mov %eax,(%ecx,%eax,8)
14: 31 c0 xor %eax,%eax
16: c3 ret
gcc 4.8 20130113 (-O2 -m32):
00000000 <foo>:
0: 8b 54 24 08 mov 0x8(%esp),%edx
4: 8d 04 d5 00 00 00 00 lea 0x0(,%edx,8),%eax
b: 03 44 24 04 add 0x4(%esp),%eax
f: 8b 08 mov (%eax),%ecx
11: 89 0d 00 00 00 00 mov %ecx,0x0
17: 89 10 mov %edx,(%eax)
19: 31 c0 xor %eax,%eax
1b: c3 ret
-miles
--
Ich bin ein Virus. Mach' mit und kopiere mich in Deine .signature.
More information about the Gcc
mailing list