~pali/llvm/polly-3.5

« back to all changes in this revision

Viewing changes to test/Isl/Ast/reduction_modulo_schedule.ll

  • Committer: jdoerfert
  • Date: 2014-07-15 00:00:35 UTC
  • Revision ID: svn-v4:91177308-0d34-0410-b5e6-96231b3b80d8:polly/trunk:213019
Annotate reduction parallel loops in the IslAst textual output

  + Introduced dependency type TYPE_TC_RED to represent the transitive closure
    (& the reverse) of reduction dependences. These are used when we check for
    reduction parallel loops.
  + Test cases including loop reversals and modulo schedules which compute
    reductions in a alternated order.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
 
2
;
 
3
; CHECK-NOT: #pragma simd{{\s*$}}
 
4
; CHECK: #pragma simd reduction
 
5
; CHECK: Stmt_S0
 
6
; CHECK: #pragma simd{{\s*$}}
 
7
; CHECK: Stmt_S1
 
8
; CHECK: #pragma simd reduction
 
9
; CHECK: Stmt_S0
 
10
; CHECK-NOT: #pragma simd{{\s*$}}
 
11
;
 
12
;    void rms(int *A, long n) {
 
13
;      for (long i = 0; i < 2 * n; i++)
 
14
; S0:    A[0] += i;
 
15
;      for (long i = 0; i < 2 * n; i++)
 
16
; S1:    A[i + 1] = 1;
 
17
;    }
 
18
;
 
19
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
 
20
 
 
21
define void @rms(i32* %A, i32 %n) {
 
22
entry:
 
23
  br label %for.cond
 
24
 
 
25
for.cond:                                         ; preds = %for.inc, %entry
 
26
  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
 
27
  %mul = shl nsw i32 %n, 1
 
28
  %cmp = icmp slt i32 %i.0, %mul
 
29
  br i1 %cmp, label %for.body, label %for.end
 
30
 
 
31
for.body:                                         ; preds = %for.cond
 
32
  br label %S0
 
33
 
 
34
S0:                                               ; preds = %for.body
 
35
  %tmp = load i32* %A, align 4
 
36
  %add = add nsw i32 %tmp, %i.0
 
37
  store i32 %add, i32* %A, align 4
 
38
  br label %for.inc
 
39
 
 
40
for.inc:                                          ; preds = %S0
 
41
  %inc = add nsw i32 %i.0, 1
 
42
  br label %for.cond
 
43
 
 
44
for.end:                                          ; preds = %for.cond
 
45
  br label %for.cond2
 
46
 
 
47
for.cond2:                                        ; preds = %for.inc8, %for.end
 
48
  %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
 
49
  %mul3 = shl nsw i32 %n, 1
 
50
  %cmp4 = icmp slt i32 %i1.0, %mul3
 
51
  br i1 %cmp4, label %for.body5, label %for.end10
 
52
 
 
53
for.body5:                                        ; preds = %for.cond2
 
54
  br label %S1
 
55
 
 
56
S1:                                               ; preds = %for.body5
 
57
  %add6 = add nsw i32 %i1.0, 1
 
58
  %arrayidx7 = getelementptr inbounds i32* %A, i32 %add6
 
59
  store i32 1, i32* %arrayidx7, align 4
 
60
  br label %for.inc8
 
61
 
 
62
for.inc8:                                         ; preds = %S1
 
63
  %inc9 = add nsw i32 %i1.0, 1
 
64
  br label %for.cond2
 
65
 
 
66
for.end10:                                        ; preds = %for.cond2
 
67
  ret void
 
68
}
 
69