[LLVMbugs] [Bug 15467] New: X86 CodeGen: Miscompile vector kernel

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 7 11:21:59 PST 2013


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

            Bug ID: 15467
           Summary: X86 CodeGen: Miscompile vector kernel
           Product: tools
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: aschwaighofer at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10149
  --> http://llvm.org/bugs/attachment.cgi?id=10149&action=edit
Failing test

../Release+Asserts/bin/clang++ -O3 -fvectorize test.cpp -o with;
../Release+Asserts/bin/clang++ -O3 -fno-vectorize test.cpp -o without ; ./with
1 > with.out ; ./without 1 > without.out ; diff with.out without.out

../Release+Asserts/bin/clang++ --version
clang version 3.3 (trunk 176630) (llvm/trunk 176632)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

cat reduced.ll 
; ModuleID = 'test.ll'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"

@A2 = external global [1024 x i16], align 16
@C2 = external global [1024 x i16], align 16
@D2 = external global [1024 x i16], align 16

define void @_Z7kernel2v() nounwind uwtable noinline ssp {
vector.ph:
  br label %vector.body

vector.body:                                      ; preds = %vector.body,
%vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %0 = getelementptr inbounds [1024 x i16]* @C2, i64 0, i64 %index
  %1 = bitcast i16* %0 to <4 x i16>*
  %wide.load = load <4 x i16>* %1, align 8
  %2 = zext <4 x i16> %wide.load to <4 x i32>
  %3 = getelementptr inbounds [1024 x i16]* @D2, i64 0, i64 %index
  %4 = bitcast i16* %3 to <4 x i16>*
  %wide.load12 = load <4 x i16>* %4, align 8
  %5 = zext <4 x i16> %wide.load12 to <4 x i32>
  %6 = shl <4 x i32> %2, %5
  %7 = trunc <4 x i32> %6 to <4 x i16>
  %8 = getelementptr inbounds [1024 x i16]* @A2, i64 0, i64 %index
  %9 = bitcast i16* %8 to <4 x i16>*
  store <4 x i16> %7, <4 x i16>* %9, align 8
  %index.next = add i64 %index, 4
  %10 = icmp eq i64 %index.next, 1024
  br i1 %10, label %for.end, label %vector.body

for.end:                                          ; preds = %vector.body
  ret void
}
-----
Produces the failing code in kernel2:
../Release+Asserts/bin/llc -mcpu=core2 reduced.ll


It looks like a problem during ISel.

-- 
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/20130307/016c9b83/attachment.html>


More information about the llvm-bugs mailing list