<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] Optimise xtn+xtn to uzp"
   href="https://bugs.llvm.org/show_bug.cgi?id=52298">52298</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] Optimise xtn+xtn to uzp
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>beginner
          </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>pavel.iliin@arm.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>Optimise truncate operations with a hi/lo pair into a single permute of half
the bit size of the input and just ignoring the top bits (which are truncated
out).

void d2 (short * restrict a, int *b, int n) {
    for (int i = 0; i < n; i++)
        a[i] = b[i];
}

clang -O3 generates
 ldp q0, q1, [x9, #-16]
 add x9, x9, #32
 subs x8, x8, #8
 xtn v0.4h, v0.4s
 xtn v1.4h, v1.4s
 stur d0, [x10, #-8]
 str d1, [x10], #16
 b.ne .LBB0_2

gcc -O3 combines the two `xtn`s into a `uzp`
 ldp q0, q1, [x1]
 add x1, x1, 32
 uzp1 v0.8h, v0.8h, v1.8h
 str q0, [x0], 16
 cmp x1, x2
 bne .L3
<a href="https://godbolt.org/z/dYozq6GPh">https://godbolt.org/z/dYozq6GPh</a>

gcc commit
<a href="https://github.com/gcc-mirror/gcc/commit/52da40ffe2aaf086f622e513cc99a64bc7573a67#diff-e55f82ad6f42cf1df30ab3fffeba1fd00aea748d04e231dda6f247b5c7e1c35a">https://github.com/gcc-mirror/gcc/commit/52da40ffe2aaf086f622e513cc99a64bc7573a67#diff-e55f82ad6f42cf1df30ab3fffeba1fd00aea748d04e231dda6f247b5c7e1c35a</a></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>