[LLVMbugs] [Bug 15298] New: llc generates incorrect AVX code on sandy bridge on following .ll file

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 19 06:53:07 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15298

            Bug ID: 15298
           Summary: llc generates incorrect AVX code on sandy bridge on
                    following .ll file
           Product: new-bugs
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: babslachem at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Following ll code is designed to produce a vector of 8 floats with following
values

<0.0, elem(0, source), elem(0, source), 0.0, 0.0, 0.0, 0.0, 0.0>


; ModuleID = 'shufxbug.ll'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"

define void @sample_test(<4 x float>* nocapture %source, <8 x float>* nocapture
%dest) nounwind noinline {
L.entry:
  %0 = getelementptr <4 x float>* %source, i32 19
  %1 = load <4 x float>* %0, align 16
  %2 = extractelement <4 x float> %1, i32 0
  %3 = insertelement <8 x float> <float 0.000000e+00, float undef, float undef,
float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00,
float 0.000000e+00>, float %2, i32 2
  %4 = insertelement <8 x float> %3, float %2, i32 1
  %5 = getelementptr <8 x float>* %dest, i32 19
  store <8 x float> %4, <8 x float>* %5, align 4
  ret void
}

When compiled on a sandy bridge machine as follows:

llc shufxbug.ll -march=x86 -relocation-model=pic -o shufxbug.s

Following assembly is generated:

...
    pushl   %ebp
.Ltmp5:
    .cfi_def_cfa_offset 8
.Ltmp6:
    .cfi_offset %ebp, -8
    movl    %esp, %ebp
.Ltmp7:
    .cfi_def_cfa_register %ebp
    movl    12(%ebp), %eax
    .loc    1 9 0 prologue_end      # shufxbug.cl:9:0
.Ltmp8:
    vpermilps   $65, 304(%eax), %xmm0 # xmm0 = mem[1,0,0,1]
    vxorps  %xmm1, %xmm1, %xmm1
    vinsertf128 $1, %xmm1, %ymm0, %ymm0
    movl    16(%ebp), %eax
    .loc    1 10 0                  # shufxbug.cl:10:0
    vmovups %ymm0, 608(%eax)
    .loc    1 11 0                  # shufxbug.cl:11:0
    popl    %ebp
    vzeroupper
    ret
...

Vector created is then


<elem(1, source), elem(0, source), elem(0, source), elem(1, source), 0.0, 0.0,
0.0, 0.0>

On a Core i7 machine code is slightly different and produce expected result

-- 
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/20130219/322c6fee/attachment.html>


More information about the llvm-bugs mailing list