[llvm-bugs] [Bug 29102] Incorrect barriers for legacy __sync_* on ARM64

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 1 15:43:19 PDT 2018


Tim Northover <t.p.northover at gmail.com> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
            Summary|Incorrect barriers for      |Incorrect barriers for
                   |atomic intrinsics on ARM64  |legacy __sync_* on ARM64
          Component|new bugs                    |LLVM Codegen
         Resolution|INVALID                     |---
            Product|new-bugs                    |clang
           Assignee|unassignedbugs at nondot.org   |unassignedclangbugs at nondot.
                   |                            |org
                 CC|                            |richard-llvm at metafoo.co.uk

--- Comment #3 from Tim Northover <t.p.northover at gmail.com> ---
I've just been reading through the Mono history & comments, and it's convinced
me to reopen this.

The issue is specifically with the legacy __sync_* operations. Those *do*
appear to give extra barriers on AArch64 GCC, and the documentation (while
written in horribly vague pre-C++11 terms) could be read to require them -- see

GCC codegen for a generic loop is roughly:

        ldxr    w1, [x0]
        add     w1, w1, 4
        stlxr   w2, w1, [x0]
        cbnz    w2, .L2
        dmb     ish

This is also what Will implemented (and justified) in the referenced GCC thread
on the Linux Kernel.

No matter what, this will involve Clang changes. There's a reasonable chance it
could be implemented entirely in Clang (as an "atomicrmw release" followed by a
fence) but I haven't thought in enough detail to convince even myself.
Otherwise it would need the new super_seq_cst above, and also Clang changes to
use it -- so I've put this in the Clang component.

Priority may also be an issue. This requires strong expertise and interest in
the topic. That may be difficult to drum up for legacy intrinsics.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181101/699cafa1/attachment.html>

More information about the llvm-bugs mailing list