[Bug middle-end/89859] Addition of __restrict generates worse assembly

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 27 18:57:00 GMT 2019


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |middle-end
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
_ZN4test7computeEPi.isra.0: // non-restrict
.LFB2:
        .cfi_startproc
        ldr     x3, [x0]
        mov     w4, 99
        ldr     w2, [x0, 8]
        add     w2, w2, w1
        str     w2, [x0, 8]
        strb    w4, [x3]
        ldr     w2, [x0, 8]
        add     w1, w2, w1
        str     w1, [x0, 8]
        ret

_ZN4test7computeEPi.isra.0: // restrict
.LFB2:
        .cfi_startproc
        ldr     x3, [x0]
        mov     w4, 99
        ldr     w2, [x0, 8]
        strb    w4, [x3]
        add     w1, w2, w1, lsl 1
        str     w1, [x0, 8]
        ret

// Actually it is not worse, there is one less load; just it looks worse due to
CISC notion of x86_64.

See above for AARCH64 assembly to show that is the story.


More information about the Gcc-bugs mailing list