<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] [AVX2] incorrect code generated for insert element"
   href="https://llvm.org/bugs/show_bug.cgi?id=25320">25320</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] [AVX2] incorrect code generated for insert element
          </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>normal
          </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>koffieyahoo@gmail.com
          </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>This is a follow up to PR24935, but since the is related to insert element, I'm
opening a new issue.

The following:

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @__sample_test(<2 x i32>* %in, <8 x i32>* %out) {
body:
  %0 = load <2 x i32>, <2 x i32>* %in, align 8
  %1 = extractelement <2 x i32> %0, i64 0
  %2 = insertelement <8 x i32> <i32 undef, i32 0, i32 0, i32 0, i32 0, i32 0,
i32 0, i32 0>, i32 %1, i64 0
  store <8 x i32> %2, <8 x i32>* %out, align 32
  ret void
}

Generates wrong code when AVX2 is enabled (a non-zero value occurs both in the
0th and in the 2nd position of the output vector due to the use of vpmovzxdq):

$llc test.ll -o - -mattr=+avx2
    .text
    .file    "test.ll"
    .globl    __sample_test
    .align    16, 0x90
    .type    __sample_test,@function
__sample_test:                          # @__sample_test
    .cfi_startproc
# BB#0:                                 # %body
    vpmovzxdq    (%rdi), %xmm0   # xmm0 = mem[0],zero,mem[1],zero
    vmovdqa    %xmm0, %xmm0
    vmovdqa    %ymm0, (%rsi)
    vzeroupper
    retq
.Lfunc_end0:
    .size    __sample_test, .Lfunc_end0-__sample_test
    .cfi_endproc


    .section    ".note.GNU-stack","",@progbits</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>