<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [AArch64] atomicrmw on Armv8.1-a can change memory ordering"
   href="https://bugs.llvm.org/show_bug.cgi?id=35094">35094</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] atomicrmw on Armv8.1-a can change memory ordering
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Christof.Douma@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19346" name="attach_19346" title="example">attachment 19346</a> <a href="attachment.cgi?id=19346&action=edit" title="example">[details]</a></span>
example

The LD<OP>[A|L|AL] instructions in Armv8.1-a have different memory orderings if
the target register is the zero register (WZR or XZR). In particular they are
no longer loads if the target register is the zero register[1]. This means that
a load barrier ("fence acquire" in LLVM terms) will no longer order these
before the barrier.

These instructions are used for atomicrmw LLVM operations, and LLVM's "AArch64
Dead register definitions" pass tries to use the zero register. If it does, it
changes the semantics (memory order) of the program.

I don't have a real-life example. But I hope the attached example makes the
story a bit clearer.

[1] Arm ARM for Armv8-A [ARM DDI 0487B.b] section C3.2.13
<a href="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0487b.b/DDI0487B_b_armv8_arm.pdf">http://infocenter.arm.com/help/topic/com.arm.doc.ddi0487b.b/DDI0487B_b_armv8_arm.pdf</a>
"The ST<OP> instructions, and LD<OP> instructions where the destination
register is WZR or XZR, are not regarded as doing a read for the purpose of a
DMB LD barrier."</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>