Optimization question
Carlo Wood
carlo@alinoe.com
Sun Dec 15 10:23:00 GMT 2002
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>
More information about the Gcc
mailing list