Optimising std::find on x86 and PPC

Chris Jefferson caj@cs.york.ac.uk
Tue Dec 14 16:10:00 GMT 2004


Paolo Carlini wrote:

> Chris Jefferson wrote:
>
>> Then the current loop optimise doesn't do loop unrolling to something 
>> more like:
>
>
> Besided what Gaby and Benjamin already replied, out of curiosity, what 
> the loop
> unroller is doing, right now?!? Nothing!?!
>
Yep, with -funroll-loops -O3 on last week's CVS, if I give:
int* check(int* a,int* b)
{
for(;a<b;++a)
   if(*a==1) return a;
return a;
}

Then it does no optimising at all. I suspect if it could unroll this by 
itself, then it would deal with the processor-specific fixes itself.

Chris



More information about the Libstdc++ mailing list