~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/SLPVectorizer/X86/simple-loop.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 -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
 
2
 
 
3
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"
 
4
target triple = "x86_64-apple-macosx10.8.0"
 
5
 
 
6
;CHECK:rollable
 
7
define i32 @rollable(i32* noalias nocapture %in, i32* noalias nocapture %out, i64 %n) {
 
8
  %1 = icmp eq i64 %n, 0
 
9
  br i1 %1, label %._crit_edge, label %.lr.ph
 
10
 
 
11
.lr.ph:                                           ; preds = %0, %.lr.ph
 
12
  %i.019 = phi i64 [ %26, %.lr.ph ], [ 0, %0 ]
 
13
  %2 = shl i64 %i.019, 2
 
14
  %3 = getelementptr inbounds i32, i32* %in, i64 %2
 
15
;CHECK:load <4 x i32>
 
16
  %4 = load i32, i32* %3, align 4
 
17
  %5 = or i64 %2, 1
 
18
  %6 = getelementptr inbounds i32, i32* %in, i64 %5
 
19
  %7 = load i32, i32* %6, align 4
 
20
  %8 = or i64 %2, 2
 
21
  %9 = getelementptr inbounds i32, i32* %in, i64 %8
 
22
  %10 = load i32, i32* %9, align 4
 
23
  %11 = or i64 %2, 3
 
24
  %12 = getelementptr inbounds i32, i32* %in, i64 %11
 
25
  %13 = load i32, i32* %12, align 4
 
26
;CHECK:mul <4 x i32>
 
27
  %14 = mul i32 %4, 7
 
28
;CHECK:add <4 x i32>
 
29
  %15 = add i32 %14, 7
 
30
  %16 = mul i32 %7, 7
 
31
  %17 = add i32 %16, 14
 
32
  %18 = mul i32 %10, 7
 
33
  %19 = add i32 %18, 21
 
34
  %20 = mul i32 %13, 7
 
35
  %21 = add i32 %20, 28
 
36
  %22 = getelementptr inbounds i32, i32* %out, i64 %2
 
37
;CHECK:store <4 x i32>
 
38
  store i32 %15, i32* %22, align 4
 
39
  %23 = getelementptr inbounds i32, i32* %out, i64 %5
 
40
  store i32 %17, i32* %23, align 4
 
41
  %24 = getelementptr inbounds i32, i32* %out, i64 %8
 
42
  store i32 %19, i32* %24, align 4
 
43
  %25 = getelementptr inbounds i32, i32* %out, i64 %11
 
44
  store i32 %21, i32* %25, align 4
 
45
  %26 = add i64 %i.019, 1
 
46
  %exitcond = icmp eq i64 %26, %n
 
47
  br i1 %exitcond, label %._crit_edge, label %.lr.ph
 
48
 
 
49
._crit_edge:                                      ; preds = %.lr.ph, %0
 
50
;CHECK: ret
 
51
  ret i32 undef
 
52
}
 
53
 
 
54
;CHECK:unrollable
 
55
;CHECK-NOT: <4 x i32>
 
56
;CHECK: ret
 
57
define i32 @unrollable(i32* %in, i32* %out, i64 %n) nounwind ssp uwtable {
 
58
  %1 = icmp eq i64 %n, 0
 
59
  br i1 %1, label %._crit_edge, label %.lr.ph
 
60
 
 
61
.lr.ph:                                           ; preds = %0, %.lr.ph
 
62
  %i.019 = phi i64 [ %26, %.lr.ph ], [ 0, %0 ]
 
63
  %2 = shl i64 %i.019, 2
 
64
  %3 = getelementptr inbounds i32, i32* %in, i64 %2
 
65
  %4 = load i32, i32* %3, align 4
 
66
  %5 = or i64 %2, 1
 
67
  %6 = getelementptr inbounds i32, i32* %in, i64 %5
 
68
  %7 = load i32, i32* %6, align 4
 
69
  %8 = or i64 %2, 2
 
70
  %9 = getelementptr inbounds i32, i32* %in, i64 %8
 
71
  %10 = load i32, i32* %9, align 4
 
72
  %11 = or i64 %2, 3
 
73
  %12 = getelementptr inbounds i32, i32* %in, i64 %11
 
74
  %13 = load i32, i32* %12, align 4
 
75
  %14 = mul i32 %4, 7
 
76
  %15 = add i32 %14, 7
 
77
  %16 = mul i32 %7, 7
 
78
  %17 = add i32 %16, 14
 
79
  %18 = mul i32 %10, 7
 
80
  %19 = add i32 %18, 21
 
81
  %20 = mul i32 %13, 7
 
82
  %21 = add i32 %20, 28
 
83
  %22 = getelementptr inbounds i32, i32* %out, i64 %2
 
84
  store i32 %15, i32* %22, align 4
 
85
  %23 = getelementptr inbounds i32, i32* %out, i64 %5
 
86
  store i32 %17, i32* %23, align 4
 
87
  %barrier = call i32 @goo(i32 0)                      ; <---------------- memory barrier.
 
88
  %24 = getelementptr inbounds i32, i32* %out, i64 %8
 
89
  store i32 %19, i32* %24, align 4
 
90
  %25 = getelementptr inbounds i32, i32* %out, i64 %11
 
91
  store i32 %21, i32* %25, align 4
 
92
  %26 = add i64 %i.019, 1
 
93
  %exitcond = icmp eq i64 %26, %n
 
94
  br i1 %exitcond, label %._crit_edge, label %.lr.ph
 
95
 
 
96
._crit_edge:                                      ; preds = %.lr.ph, %0
 
97
  ret i32 undef
 
98
}
 
99
 
 
100
declare i32 @goo(i32)