[Bug target/28481] [4.2/4.3/4.4 Regression] regression from 3.x: 4.1.1 uses memory where it can use registers
vda dot linux at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 4 20:48:00 GMT 2008
------- Comment #9 from vda dot linux at googlemail dot com 2008-07-04 20:48 -------
The above comment meant to say "4.3.1 have number of memory references down
from 115 _to 48_.
I also attached the best result so far - gcc-3.4.6 with -O3 genarates assembly
with smallest number of memory references. Here is more correct method of
counting them (counting not only moves, but any memory references (XOR insns),
but not counting LEA instructions which aren't memory references):
# grep '(' serpent-346-O3.s | grep -v lea | wc -l
144
# grep '(' serpent-431-O3.s | grep -v lea | wc -l
186
Another way to see that 3.4.6 -O3 is optimal is to notice the lack of "subl
$NUM, %esp" in prologue (because gcc figured out it does not need to spill any
registers):
serpent_encrypt:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
movl 20(%esp), %ebp
movl 28(%esp), %ecx
movl 12(%ebp), %edi
xorl 12(%ecx), %edi
...
4.3.1 looks like this:
serpent_encrypt:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $20, %esp
movl 48(%esp), %eax
movl (%eax), %ecx
movl 4(%eax), %edx
movl 8(%eax), %esi
...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28481
More information about the Gcc-bugs
mailing list