<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/75081>75081</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `is_always_lock_free` Returns Incorrect Value For 128 Bit Struct On ARM64
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          insertinterestingnamehere
      </td>
    </tr>
</table>

<pre>
    With clang 17.1 on ARM64 I'm seeing `std::atomic<T>::is_always_lock_free` evaluate to `true` even though the member function `std::atomic<T>::is_lock_free()` evaluates to `false` for the same type.

Here's a minimal example:

```C++
#include <atomic>
#include <cstdint>
#include <iostream>

struct bigint_equiv {
  uint64_t first, second;
};

int main() {
 std::atomic<bigint_equiv> a;
  std::cout << a.is_lock_free() << " " << decltype(a)::is_always_lock_free << std::endl;
}
```

Possibly related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70814 where the gcc devs discuss why libatomic doesn't allow 128 bit atomics to be lock-free on ARM.

When I compile the same code with gcc 13.2 `is_always_lock_free` is `false` which is strange since I've confirmed that the same libstdc++ is being included and linked. This also appears to be what happens on godbolt too though. With gcc the assembly (as best I can tell) shows a 0 being written out (https://godbolt.org/z/T7493K8xP) while with clang the assembly shows a 1 (https://godbolt.org/z/Gb35jMfjr).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVVtv2zgT_TX0yyCCRPr6oIfc_H3BotiiG2weDYoaSUwp0ssZRU1__YKSXSftBigg0_YMdc5czpCayLYesRSrG7G6W-iBuxBL6wkjW88Ykdj61useO4y4qEL9Wj5Z7sA47VsoNlkBwcP1l0_rJTwIuemBEK1vQaxz4lqoa6GuNYfeGqFuH4W6n02WDtqN-pUOLpivhyYiinUO-KLdoBmBQ0LgOJzM6IG7MLQdcIfQY19hhGbwhm3wv0F2YZFbIXdvuehE1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