~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/LoopVectorize/X86/tripcount.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=1 -mcpu=prescott < %s | FileCheck %s
 
2
 
 
3
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-S128"
 
4
target triple = "i386-unknown-freebsd11.0"
 
5
 
 
6
@big = external global [0 x i32]
 
7
 
 
8
; PR18049
 
9
; We need to truncate the exit count to i32. This is legal because the
 
10
; arithmetic is signed (%inc is nsw).
 
11
 
 
12
; CHECK-LABEL: tripcount
 
13
; CHECK: trunc i64 %count to i32
 
14
 
 
15
define void @tripcount(i64 %count) {
 
16
entry:
 
17
  %cmp6 = icmp sgt i64 %count, 0
 
18
  br i1 %cmp6, label %for.body.preheader, label %for.end
 
19
 
 
20
for.body.preheader:
 
21
  br label %for.body
 
22
 
 
23
for.body:
 
24
  %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
 
25
  %arrayidx = getelementptr inbounds [0 x i32], [0 x i32]* @big, i32 0, i32 %i.07
 
26
  %0 = load i32, i32* %arrayidx, align 4
 
27
  %neg = xor i32 %0, -1
 
28
  store i32 %neg, i32* %arrayidx, align 4
 
29
  %inc = add nsw i32 %i.07, 1
 
30
  %conv = sext i32 %inc to i64
 
31
  %cmp = icmp slt i64 %conv, %count
 
32
  br i1 %cmp, label %for.body, label %for.end.loopexit
 
33
 
 
34
for.end.loopexit:
 
35
  br label %for.end
 
36
 
 
37
for.end:
 
38
  ret void
 
39
}