<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 - vector select optimization failures?"
   href="https://bugs.llvm.org/show_bug.cgi?id=41429">41429</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>vector select optimization failures?
          </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>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lebedev.ri@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From IRC:
<a href="https://godbolt.org/z/NgGuw9">https://godbolt.org/z/NgGuw9</a>

#include <immintrin.h>
#include <inttypes.h>
void test_restrict(__m256i * __restrict__ dest, const __m256i * __restrict__ a)
{
    (*dest)[2] = (*a)[2];
    (*dest)[3] = (*a)[3];
}

Currently results in:
define dso_local void @example2(<4 x i64>* noalias nocapture, <4 x i64>*
noalias nocapture readonly) local_unnamed_addr #0 {
  %3 = load <4 x i64>, <4 x i64>* %1, align 32, !tbaa !2
  %4 = load <4 x i64>, <4 x i64>* %0, align 32
  %5 = shufflevector <4 x i64> %4, <4 x i64> %3, <4 x i32> <i32 0, i32 1, i32
6, i32 undef>
  %6 = shufflevector <4 x i64> %5, <4 x i64> %3, <4 x i32> <i32 0, i32 1, i32
2, i32 7>
  store <4 x i64> %6, <4 x i64>* %0, align 32
  ret void
}

Since these are simple identity shuffles), can we combine this into a single
shuffle?
I'm guessing it is the `undef` that is the problem?

; Function Attrs: norecurse nounwind uwtable
define dso_local void @test_restrict(<4 x i64>* noalias nocapture, <4 x i64>*
noalias nocapture readonly) local_unnamed_addr #0 {
  %3 = load <4 x i64>, <4 x i64>* %1, align 32, !tbaa !2
  %4 = load <4 x i64>, <4 x i64>* %0, align 32
  %5 = shufflevector <4 x i64> %4, <4 x i64> %3, <4 x i32> <i32 0, i32 1, i32
6, i32 7>
  store <4 x i64> %5, <4 x i64>* %0, align 32
  ret void
}

<a href="https://godbolt.org/z/NgGuw9">https://godbolt.org/z/NgGuw9</a>

The final x86 asm is identical.</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>