This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: TCP/IP checksum routine performance


Grant has gone down under for a while....

> Note - did you check with -Os.  This may have produced better
> results in this particular case.

-Os? Its not in the documentation i have. I guess this tells it to
optimise for space?
 
> 
> : The really odd thing is that the code generated by gcc -O[123]
> : is 50% slower than the code generated with -O0.  At first I
> : thought there was something wrong with my test procedure, but
> : when I looked at the assembly language gnerated with
> : optimization on, it's indeed about 50% longer.
> 
> It sounds like loop unrolling is causing the code to exceed the
> instruction cache size....

I doubt it. First off, the code is small. A typical ARM cache is 4K. I
think Grant said the code was something like 100 instructions. I would
have to check the achive to be sure, but i would be very supprised if
the code got bigger than the ICache. Secondly Grant looked at the code
and said it was a register thrash problem. Its trying to do a delayed
add, but running out of registers and so having to put intermediate
values into memory. The -0 code does not suffer from this problem
since its not doing a delayed add.

> So compiling with '-O3 -fno-unroll-loops' might produce good
> results.

I think the real problem to be addressed is why gcc gets into the
register threash problem? My guess is that it should consider delaying
the add, lay the code out and then find out its run out of
registers. It should then change its mind and not delay the add. Its
not looking at the code it produced and sanity checking it to see if
the optimisintion its made has actually made the code worse.

        Andrew

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]