https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66612

--- Comment #5 from amker at gcc dot gnu.org ---
Hmm, (In reply to amker from comment #4)
> (In reply to Andreas Schwab from comment #3)
> > stwx 10,8,9 -> *(int*)(r8+r9)=r10
> 
> I am wondering how should we handle this failure.  Create a new doloop test
> and change this one testing the optimization gcc does now?
> 
> Thanks,
> bin

Hmm,
Actually, GCC shouldn't eliminate loop condition with address type candidate. 
Like on 32 bits powerpc, the loop can be further optimized with do-loop
structure:

foo:
        cmpwi 7,3,511
        ble- 7,.L4
        addi 9,3,-256
        lis 10,a@ha
        cmpwi 7,9,256
        addi 9,3,-512
        srwi 9,9,8
        la 10,a@l(10)
        slwi 3,3,2
        addi 9,9,1
        add 3,3,10
        mtctr 9
        li 10,42
        blt- 7,.L9
.L3:
        stw 10,0(3)
        addi 3,3,-1024
        bdnz .L3
.L4:
        li 3,0
        blr
.L9:
        li 9,1
        mtctr 9
        b .L3

Please correct me if I was wrong assuming same scenario on powerpc64 and
powerpc.

Thanks

Reply via email to