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]

[tree-ssa] count-branch-reg optimization


Is there a way get this optimization working on the ssa branch, it seems like it is broken because of the rtl that is written out from the trees.

For an example:
void temp(int limit, char *x)
{
        int i;
        for(i=0;i<limit;i++)
        {
                x[i] = 0;
        }
}

On PPC on the mainline, it produces:
_temp:
        li r2,0
        cmpw cr0,r2,r3
        bgelr- cr0
        mtctr r3
        li r0,0
L8:
        stbx r0,r4,r2
        addi r2,r2,1
        bdnz L8
        blr

But using the ssa-branch it produces:

_temp:
        li r2,0
        li r0,0
        cmpw cr0,r2,r3
        bgelr- cr0
L8:
        stbx r0,r4,r2
        addi r2,r2,1
        cmpw cr0,r2,r3
        bgelr- cr0
        b L8

One on the mainline is faster by about 2x.

tester:

Attachment: temp.main.c
Description: Text document



Output:
[omni:~/src] pinskia% ./a.out
temp_ssa:    75180285
temp_nonssa: 37026882
[omni:~/src] pinskia% ./a.out
temp_ssa:    75130658
temp_nonssa: 36955802
[omni:~/src] pinskia% ./a.out
temp_ssa:    73768955
temp_nonssa: 36932939
[omni:~/src] pinskia% ./a.out
temp_ssa:    74389079
temp_nonssa: 37560076
[omni:~/src] pinskia%



Thanks,
Andrew Pinski

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