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

    <tr>
        <th>Summary</th>
        <td>
            Consider implementing ARM64 `__load_acquire`/`__stlr` intrinsics
        </td>
    </tr>

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

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

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

<pre>
    As of VS 2022 17.6 Preview 3, MSVC supports the following ARM64 intrinsics used by its STL:

```cpp
unsigned __int8 __load_acquire8 (const volatile unsigned __int8  * _Target);
unsigned __int16 __load_acquire16(const volatile unsigned __int16 * _Target);
unsigned __int32 __load_acquire32(const volatile unsigned __int32 * _Target);
unsigned __int64 __load_acquire64(const volatile unsigned __int64 * _Target);

void __stlr8 (volatile unsigned __int8  * _Target, unsigned __int8  _Value);
void __stlr16(volatile unsigned __int16 * _Target, unsigned __int16 _Value);
void __stlr32(volatile unsigned __int32 * _Target, unsigned __int32 _Value);
void __stlr64(volatile unsigned __int64 * _Target, unsigned __int64 _Value);
```

According to my understanding, the `__load_acquire` intrinsic emits either the `ldar` or `ldapr` instructions (according to criteria that are beyond my cat-sized brain :cat: :brain:), while the `__stlr` intrinsic emits the `stlr` instruction. These are significantly more efficient than what was previously possible.

Currently, MSVC's STL is using its classic (slower) codepaths for Clang/LLVM ARM64. It would be nice if Clang added support for the new faster intrinsics.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMlc-O4jgQxp_GXEqDYjsEcsiBYYS0Ure02m71FTl2hXhk7KztgNinX1XoPyzTO42EAsTlnz9_5SqrlOzeIzZs8Z0tfszUmPsQm6eMQ6_884M6qiP-nLXBnJt1gtDByxOIQgjgy3kFf0Y8WjyBZGIDj08vG0jjMISYE-QeoQvOhZP1e1j_9ViVYH2O1ierE4wJDbRnsDnB0_MDk2tW_GDF27MqLh89DJc3o5-EGtjtrM8r2O1cUGan9N-jjbgCJlY6-JThGJzK1iHczgAm1rB7VnGPmYmaye-fkXl1g-bVV2he3YeW4gYtxVdoKe5DV-UNuiq_Qlfl_6Evz2OwFJmyi5O7d_q6-XV896LciNcrXLEne-809pZNufode_L3Tmdv2ZSs37Eng--09pZN2fqF_X7kr5Ow1jpEQwWUAxzOMHqDMWXl6R2BqcpYVfw3-awqPkoN8EA1hjb3GN_inVGRokJ8_TfEy6SU46izDT5RztX18jrajNEqyL3KoCJCi-fgDenSKn9L9h8q6aisBybXWmUm1_RrekUFLmqSfOrJsXfhZOZngl8DPobfpc3huceEkwSy1XZWK5_dGQ4hImDXWW3RZxLq4URqTyrBQL0qjMmdYQgp2dbh_NrrzRgjEuatlzGxnHoTWGpX5ALp0o56piZ7kgsnjEzUoIPBQeU-QRcibJyi7GwfHl4eL51vDn9kOIXRGWgRvNUItrvEgTIGzVvfnObT1j2eoFMpY7zqmvOZaaSpZa1m2PBqxaVYFMVq1jcFR7VsF1yaUgrOl7wQtZA1aq5N3VX1zDaiELIoueCrUorVnPNStK1coMZuyeuKlQUelHVz546HeYj7mU1pxKYSvJAzp1p0abolhCBt0yATgi6N2NCcb-24T6wsnE05fVCyzQ6bTfDJGtrMYXB4QJ8_boXPzi8T289PR5qN0TV9zkOajtSWie3e5n5s5zocmNjSwq9f34YYfqLOTGwnuYmJ7bSdfwMAAP__ixhJcQ">