This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: a C routine to optimize GCC for


In a message dated 9/29/99 6:56:46 PM EST, diep@xs4all.nl writes:

> int tryalles(void){
>     int ut,*va,ua,summation=0;
>  
>     for( ua = 0 ; ua < 16 ; ua++ ) {
>       va = Pindex;
>       ut = 0;
>       if( !sweep[snelbord[ua]] )
>         ut = board[ua];
>       va += ut;
>       summation += *va;
>     }
>     return(summation);
>  }
guessing at appropriate declarations, with gcc-2.96 -ffast-math 
-march=pentiumpro -O2 produces

....
L6:
    movl    -64(%ebp,%ecx), %eax
    movl    $0, %edx
    sall    $3, %eax
    fldl    (%eax,%edi)
    fcomip  %st(1), %st
    jne L7
    movl    -128(%ebp,%ecx), %edx
L7:
    movl    -260(%ebp), %eax
    addl    $4, %ecx
    addl    (%eax,%edx,4), %esi
    decl    %ebx
    jne L6
...

   sall $2,%eax           <== where do we need this shift instruction
for?
Without it, you could only address char, not float (I see now you're not 
declaring double)

HTH
Tim


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