[llvm-bugs] [Bug 50512] New: AArch64 backend ignores failure ordering for cmpxchg

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 27 11:51:24 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50512

            Bug ID: 50512
           Summary: AArch64 backend ignores failure ordering for cmpxchg
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: efriedma at quicinc.com
                CC: arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

https://godbolt.org/z/jvnYzrPce

For the following testcase:

#include <stdatomic.h>
void test(_Atomic(int) *a, int b) {
        atomic_compare_exchange_weak_explicit(a, &b, 1, memory_order_relaxed,
memory_order_seq_cst); // undefined!
}

We generate (with --target=aarch64 -O2 -march=armv8.2-a):

test:
        mov     w8, #1
        cas     w1, w8, [x0]
        ret

This is pretty clearly wrong, especially with the most recent updates to the
C++ standard.

-- 
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/20210527/0ee8fa69/attachment.html>


More information about the llvm-bugs mailing list