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]
Other format: [Raw text]

Code optimization with GCSE


Dear all,

As some might know, I've been concentrating on optimizing the handling
of loads for my port of GCC. I'm now considering this code:
uint64_t data[107];
uint64_t foo (void)
{
    uint64_t x0, x1, x2, x3, x4, x5,x6,x7;
    uint64_t i;

    for(i=0;i<107;i++) {
        data[i] = i;
    }

    return data[0] + data[1] + data[2];
}

However, the code I get is:

    la  r9,data
    mov r8, r9
    #LOOP, of no consequence, it uses r8 for the stores...

    la  r7,data+8    #Loads data+8 in r7 instead of using r9 directly
    ldd r9,0(r9)       #This loads from r9 and the two next from r7
    ldd r6,0(r7)
    ldd r8,8(r7)


As you can see, the compiler uses r9 to store data and then uses that
for data[0] but also loads in r7 data+8 instead of directly using r9.
If I remove the loop then it does not do this.

Any ideas where I can look for this, or is this going to be difficult to fix?
Thanks !
Jean Christophe Beyler


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