This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
In message <19980522112932.39503@atrey.karlin.mff.cuni.cz>you write:
> Hi
> Just for fun I've tires to compile following small program with
> both old gcc and egcs-1.0.1 (sorry I don't have latest snapshot here,
> but I will try it at home later).
>
> Program is:
>
> #include <stdio.h>
> main()
> {
> int i,a=1,b=0;
> for(i=0;i<99999999;i++)
> a=a+b,b=2*a;
> printf("%i\n",a);
> }
>
> It is compiled with -O3 -m486
> Output from the gcc2.7.2 is:
> pushl %ebp
> movl %esp,%ebp
> movl $1,%eax
> xorl %ecx,%ecx
> movl $9998,%edx
> .align 4
> .L11:
> addl %ecx,%eax
> leal (%eax,%eax),%ecx
> decl %edx
> jns .L11
>
> (just the internal loop)
> And egcs:
>
> pushl %ebp
> movl $1,%edx
> movl %esp,%ebp
> xorl %ecx,%ecx
> movl $9998,%eax
> .align 4
> .L5:
> addl %ecx,%edx
> movl %edx,%ecx
> addl %edx,%ecx
> decl %eax
> jns .L5
> Looks IMO worse... Why it didn't used leal anymore? I think it is also
> slower (at least here at K5).
I just checked this with the current snapshot and the loop looks like this now:
.L6:
addl %edx,%eax
leal 0(,%eax,2),%edx
decl %ecx
jns .L6
jeff