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

--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Michael_S from comment #3)
> Well, the guidline here https://gcc.gnu.org/bugs/ specifically tells me that
> it's one of the things that you don't want ;)

The rule is there to discourage folks from posting assembly output of huge C++
compile units.

For small testcases like yours, it is easier to see what is going on directly
in assembly rather than parsing prose descriptions.

Anyway, gcc trunk generates:

        .file   "foo.i"
        .section        .text
        .align  2
        .global foo
        .type   foo, @function
foo:
        movhi   r10, %hiadj(lottery)
        movhi   r9, %hiadj(bars+220)
        addi    r10, r10, %lo(lottery)
        addi    r9, r9, %lo(bars+220)
        movi    r11, 42
.L3:
        movhi   r2, %hiadj(bars)
        addi    r2, r2, %lo(bars)
.L2:
        movhi   r3, %hiadj(lottery)
        ldw     r5, 0(r2)
        ldw     r7, %lo(lottery)(r3)
        ldw     r3, 4(r2)
        ldw     r4, 8(r2)
        add     r7, r7, r5
        cmpeq   r6, r7, zero
        add     r6, r6, r3
        cmpeq   r5, r6, zero
        ldw     r3, 12(r2)
        add     r5, r5, r4
        ldw     r8, 16(r2)
        cmpeq   r4, r5, zero
        add     r4, r4, r3
        cmpeq   r3, r4, zero
        add     r3, r3, r8
        sub     r8, r11, r3
        stw     r7, 0(r2)
        stw     r6, 4(r2)
        stw     r5, 8(r2)
        stw     r4, 12(r2)
        stw     r3, 16(r2)
        stw     r8, 4(r10)
        addi    r2, r2, 20
        bne     r2, r9, .L2
        br      .L3
        .size   foo, .-foo
        .comm   lottery,8,4
        .section        .bss
        .type   bars, @object
        .size   bars, 220
        .align  2
bars:
        .zero   220
        .ident  "GCC: (GNU) 8.0.0 20171221 (experimental)"

So the issue looks to be fixed already.
The only question is for which version it was fixed.

Reply via email to