[llvm-bugs] [Bug 25320] New: [X86] [AVX2] incorrect code generated for insert element

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 26 05:51:27 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25320

            Bug ID: 25320
           Summary: [X86] [AVX2] incorrect code generated for insert
                    element
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: koffieyahoo at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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, at 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","", at progbits

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151026/fe680698/attachment.html>


More information about the llvm-bugs mailing list