<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] use rev16 with load/store merging patterns"
   href="https://bugs.llvm.org/show_bug.cgi?id=46694">46694</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] use rev16 with load/store merging patterns
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Backend: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>struct edge {
    unsigned char from;
    unsigned char to;
};

void reverse_edge_inplace(struct edge *e) {
    unsigned char tmp = e->from;
    e->from = e->to;
    e->to = tmp;
}

void reverse_edge_src_dst(const struct edge *src, struct edge *dst) {
    struct edge e = *src;

    unsigned char tmp = e.from;
    e.from = e.to;
    e.to = tmp;

    *dst = e;
}

This is the same example as <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Missed rotate opportunity"
   href="show_bug.cgi?id=41098">bug 41098</a> but targeted specifically at an AArch64
opportunity:
<a href="https://godbolt.org/z/xbaf3M">https://godbolt.org/z/xbaf3M</a>

As seen in the gcc output, we can trade 1 load + 1 store for a rev16:
  ldrb w8, [x0, #1]
  ldrb w9, [x0]
  strb w8, [x0]
  strb w9, [x0, #1]

vs.
  ldrh w1, [x0]
  rev16 w1, w1
  strh w1, [x0]</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>