<html>
    <head>
      <base href="http://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 CodeGen: Miscompile vector kernel"
   href="http://llvm.org/bugs/show_bug.cgi?id=15467">15467</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86 CodeGen: Miscompile vector kernel
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>llc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aschwaighofer@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10149" name="attach_10149" title="Failing test">attachment 10149</a> <a href="attachment.cgi?id=10149&action=edit" title="Failing test">[details]</a></span>
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.</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>