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

    <tr>
        <th>Summary</th>
        <td>
            [clang] __iso_volatile_load64/store64 not atomic on i386-windows
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    __iso_volatile_load64/store64 are used for 64-bit atomic access on i386:

https://github.com/microsoft/STL/blob/c10ae01b4d9508eed9d5f059a120ee7223b6ac12/stl/inc/atomic#L840-L849

https://github.com/microsoft/STL/blob/c10ae01b4d9508eed9d5f059a120ee7223b6ac12/stl/inc/atomic#L804-L825

However, clang splits __iso_volatile_load64/store64 into two consecutive volatile 32-bit accesses, which diverges from MSVC which uses FILD/FISTP.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEkk9r3DAQxT-NfBG7yCPbkQ8-tA2igS0UEnpd9Ge8VpGtoJF36bcv9ibtrTkWBEJIM3rvzc8QhcuCOLD2M2sfK7OWKeUhmNlM62yWyib_azifA6XzNUVTQsRzTMZ3DQNNJWXsGm4y8pXQ8zFl3jUHGwo3Jc3BceMcEvG08CBVx-QnJrY1lfJK2wk0A30JZVrt0aWZgZ6Dy4nSWBjo55cTA21jsgy0q4VBUdvG961QiL737Sja3tQgEB8ApO2Mq2EXFhnosDgG-i6EgTypRhxOqun_pwTRHE4K2ruEr-mGV8wMvnAXzXLh9BpDIf5R3mEpiZdb4i4thG4t4Yr8_TmXcB_AnjzS1v02BTdxH66YL0h8zGnm355_vF-shMT10-mRgdZPzy_fj5UfpO9lbyoc6gfZ130je1VNgzVu7NrReud6pVqLnbdGWtdIrBtwqgoDCGgF1KKWUtbqaFvhxl4aYQVapQRrBM4mxGOM1_mY8qUKRCsONXRt3VXRWIy08wiwp8IANjTzsBUc7Hoh1ogYqNDfFiWUuEN8r2gfP8xwSX8YfYPzcAuLTzeq1hyHf9Cxffq2HV5z-olu42Q3QQz0m4_rAL8DAAD__4j_EoU">