[LLVMbugs] [Bug 21356] New: [loop vectorizer] failure to vectorize int to fp conversions for <256 bit vectors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 23 09:05:31 PDT 2014


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

            Bug ID: 21356
           Summary: [loop vectorizer] failure to vectorize int to fp
                    conversions for <256 bit vectors
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Using clang/tools built from r220352:

Original C source:

void foo(int *x, float *y) {
        int i;
        for (i=0; i<1024; i++) {
                y[i] = x[i];
        }
}

-----------------------------------------------------------------

Reduced IR test case:

$ cat lvbug.ll 
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0"

define void @foo(i32* nocapture readonly %x, float* nocapture %y) {
entry:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %arrayidx = getelementptr inbounds i32* %x, i64 %indvars.iv
  %0 = load i32* %arrayidx, align 4
  %conv = sitofp i32 %0 to float
  %arrayidx2 = getelementptr inbounds float* %y, i64 %indvars.iv
  store float %conv, float* %arrayidx2, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv, 1023
  br i1 %exitcond, label %for.end, label %for.body

for.end:
  ret void
}

----------------------------------------------------------------

$ ./opt -mcpu=core2  -loop-vectorize lvbug.ll -S | grep sitofp
  %conv = sitofp i32 %0 to float

But with 256-bit vectors available:

$ ./opt -mcpu=core-avx2  -loop-vectorize lvbug.ll -S | grep sitofp
  %104 = sitofp <8 x i32> %wide.load to <8 x float>
  %105 = sitofp <8 x i32> %wide.load9 to <8 x float>
  %106 = sitofp <8 x i32> %wide.load10 to <8 x float>
  %107 = sitofp <8 x i32> %wide.load11 to <8 x float>
  %conv = sitofp i32 %189 to float

-- 
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/20141023/bb7732c2/attachment.html>


More information about the llvm-bugs mailing list