• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-opt-isl -polly-ast -analyze < %s | FileCheck %s
2;
3;    void jacobi1d(long T, long N, float *A, float *B) {
4;      long t, i, j;
5;      for (t = 0; t < T; t++) {
6;        for (i = 1; i < N - 1; i++)
7;          B[i] = 0.33333 * (A[i - 1] + A[i] + A[i + 1]);
8;        for (j = 1; j < N - 1; j++)
9;          A[j] = 0.33333 * (B[i - 1] + B[i] + B[i + 1]);
10;      }
11;    }
12
13; Verify that we do not tile bands that have just a single dimension.
14
15; CHECK: for (int c0 = 0; c0 < T; c0 += 1) {
16; CHECK:   for (int c1 = 0; c1 < N - 2; c1 += 1)
17; CHECK:     Stmt_for_body3(c0, c1);
18; CHECK:   for (int c1 = 0; c1 < N - 2; c1 += 1)
19; CHECK:     Stmt_for_body15(c0, c1);
20; CHECK: }
21
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24define void @jacobi1d(i64 %T, i64 %N, float* %A, float* %B) {
25entry:
26  %tmp = add i64 %N, -1
27  %tmp1 = icmp sgt i64 %tmp, 1
28  %smax = select i1 %tmp1, i64 %tmp, i64 1
29  br label %for.cond
30
31for.cond:                                         ; preds = %for.inc30, %entry
32  %t.0 = phi i64 [ 0, %entry ], [ %inc31, %for.inc30 ]
33  %cmp = icmp slt i64 %t.0, %T
34  br i1 %cmp, label %for.body, label %for.end32
35
36for.body:                                         ; preds = %for.cond
37  br label %for.cond1
38
39for.cond1:                                        ; preds = %for.inc, %for.body
40  %i.0 = phi i64 [ 1, %for.body ], [ %inc, %for.inc ]
41  %sub = add nsw i64 %N, -1
42  %cmp2 = icmp slt i64 %i.0, %sub
43  br i1 %cmp2, label %for.body3, label %for.end
44
45for.body3:                                        ; preds = %for.cond1
46  %sub4 = add nsw i64 %i.0, -1
47  %arrayidx = getelementptr inbounds float, float* %A, i64 %sub4
48  %tmp2 = load float, float* %arrayidx, align 4
49  %arrayidx5 = getelementptr inbounds float, float* %A, i64 %i.0
50  %tmp3 = load float, float* %arrayidx5, align 4
51  %add = fadd float %tmp2, %tmp3
52  %add6 = add nuw nsw i64 %i.0, 1
53  %arrayidx7 = getelementptr inbounds float, float* %A, i64 %add6
54  %tmp4 = load float, float* %arrayidx7, align 4
55  %add8 = fadd float %add, %tmp4
56  %conv = fpext float %add8 to double
57  %mul = fmul double %conv, 3.333300e-01
58  %conv9 = fptrunc double %mul to float
59  %arrayidx10 = getelementptr inbounds float, float* %B, i64 %i.0
60  store float %conv9, float* %arrayidx10, align 4
61  br label %for.inc
62
63for.inc:                                          ; preds = %for.body3
64  %inc = add nuw nsw i64 %i.0, 1
65  br label %for.cond1
66
67for.end:                                          ; preds = %for.cond1
68  br label %for.cond11
69
70for.cond11:                                       ; preds = %for.inc27, %for.end
71  %j.0 = phi i64 [ 1, %for.end ], [ %inc28, %for.inc27 ]
72  %sub12 = add nsw i64 %N, -1
73  %cmp13 = icmp slt i64 %j.0, %sub12
74  br i1 %cmp13, label %for.body15, label %for.end29
75
76for.body15:                                       ; preds = %for.cond11
77  %sub16 = add nsw i64 %smax, -1
78  %arrayidx17 = getelementptr inbounds float, float* %B, i64 %sub16
79  %tmp5 = load float, float* %arrayidx17, align 4
80  %arrayidx18 = getelementptr inbounds float, float* %B, i64 %smax
81  %tmp6 = load float, float* %arrayidx18, align 4
82  %add19 = fadd float %tmp5, %tmp6
83  %add20 = add nsw i64 %smax, 1
84  %arrayidx21 = getelementptr inbounds float, float* %B, i64 %add20
85  %tmp7 = load float, float* %arrayidx21, align 4
86  %add22 = fadd float %add19, %tmp7
87  %conv23 = fpext float %add22 to double
88  %mul24 = fmul double %conv23, 3.333300e-01
89  %conv25 = fptrunc double %mul24 to float
90  %arrayidx26 = getelementptr inbounds float, float* %A, i64 %j.0
91  store float %conv25, float* %arrayidx26, align 4
92  br label %for.inc27
93
94for.inc27:                                        ; preds = %for.body15
95  %inc28 = add nuw nsw i64 %j.0, 1
96  br label %for.cond11
97
98for.end29:                                        ; preds = %for.cond11
99  br label %for.inc30
100
101for.inc30:                                        ; preds = %for.end29
102  %inc31 = add nuw nsw i64 %t.0, 1
103  br label %for.cond
104
105for.end32:                                        ; preds = %for.cond
106  ret void
107}
108