This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Optimization question
- From: Carlo Wood <carlo at alinoe dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 15 Dec 2002 18:37:21 +0100
- Subject: Optimization question
Isn't addressing (%ebx,%ecx,4) the same speed as -4(%ebx,%ecx,4)?
If so, then why does gcc (3.2) produce the following assembly
(using -O6):
.L1393:
subl $4, %edx
decl %ecx
movl (%edx), %eax
xorl (%ebx,%ecx,4), %eax
testl %ecx, %ecx
movl %eax, (%edx)
jne .L1393
An easy optimization of this code
would be:
.L1393:
subl $4, %edx
movl (%edx), %eax
xorl -4(%ebx,%ecx,4), %eax
decl %ecx
movl %eax, (%edx)
jne .L1393
Even faster would be imho
.L1393:
subl $4, %edx
movl (%edx), %eax
xorl -4(%ebx,%ecx,4), %eax
movl %eax, (%edx)
loop .L1393
I know that the emphasis of development hasn't been on
optimization, is it correct that this kind of optimization
can be expected in the near future?
--
Carlo Wood <carlo@alinoe.com>