<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [X86] Unnecessary register moves"
   href="https://llvm.org/bugs/show_bug.cgi?id=31024">31024</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] Unnecessary register moves
          </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>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>define <8 x i64> @sext_16i8_to_8i64(<16 x i8> %A) nounwind uwtable readnone ssp
{
entry:
  %B = shufflevector <16 x i8> %A, <16 x i8> undef, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %C = sext <8 x i8> %B to <8 x i64>
  ret <8 x i64> %C
}

llc -mtriple=x86_64-unknown-unknown -mattr=+avx2

sext_16i8_to_8i64:
  vpmovsxbq %xmm0, %ymm2
  vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
  vpmovsxbq %xmm0, %ymm1
  vmovdqa %ymm2, %ymm0
  retq

This could avoid the register move:

sext_16i8_to_8i64:
  vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
  vpmovsxbq %xmm0, %ymm0
  vpmovsxbq %xmm1, %ymm1
  retq

Reg-reg moves are almost free but its still better to avoid them if we can.</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>