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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
          Component|c++                         |tree-optimization
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
On aarch64-linux-gnu (with -mcpu=thunderx+lse) we get:
.L3:
        mov     w2, 1
        ldadd   w2, w2, [x1]
        ldrb    w2, [x0], 1
        cbnz    w2, .L3
.L2:
        add     x3, x3, :lo12:.LANCHOR0
        ldar    w0, [x3]

ldadd is the atomic relaxed fetch and add.
So we don't compile exactly the same as seq_cst but still not as optimized as
you want.

Note GCC does not do any optimization on atomics yet.

Reply via email to