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

--- Comment #19 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> The assembly is as below on sparc64:
> f1:
>       .register       %g2, #scratch
>       sllx    %o1, 2, %g1
>       mov     99, %g2
>       add     %o0, %g1, %o0
>       sub     %g2, %o1, %o1
>       srl     %o1, 0, %g1
>       add     %g1, 1, %g1
>       sllx    %g1, 2, %g1
>       add     %o0, %g1, %g1
>       st      %g0, [%o0]
> .LL5:
>       add     %o0, 4, %o0
>       cmp     %o0, %g1
>       blu,a,pt %xcc, .LL5
>        st     %g0, [%o0]
>       jmp     %o7+8
>        nop

How did you configure the compiler?  We're talking about 64-bit SPARC/Solaris
and here's the code actually generated for the time being:

        .type   f1, #function
        .proc   020
f1:
        sllx    %o1, 2, %g1
        add     %o0, %g1, %o0
.LL2:
        st      %g0, [%o0]
        add     %o1, 1, %g1
        add     %o0, 4, %o0
        cmp     %g1, 99
        bleu,pt %icc, .LL2
         srl    %g1, 0, %o1
        jmp     %o7+8
         nop

so it is still suboptimal, hence my generic fix.

Reply via email to