1; RUN: opt %loadPolly -polly-codegen-ppcg -polly-acc-dump-code \
2; RUN: -polly-acc-use-private \
3; RUN: -disable-output < %s | \
4; RUN: FileCheck -check-prefix=CODE %s
5
6; RUN: opt %loadPolly -polly-codegen-ppcg \
7; RUN: -polly-acc-use-private \
8; RUN: -disable-output -polly-acc-dump-kernel-ir < %s | \
9; RUN: FileCheck -check-prefix=KERNEL %s
10
11; REQUIRES: pollyacc
12
13;    void add(float *A) {
14;      for (long i = 0; i < 32; i++)
15;        for (long j = 0; j < 10; j++)
16;          A[i] += 1;
17;    }
18
19; CODE: # kernel0
20; CODE: {
21; CODE:     read(t0);
22; CODE:     for (int c3 = 0; c3 <= 9; c3 += 1)
23; CODE:       Stmt_bb5(t0, c3);
24; CODE:     write(t0);
25; CODE: }
26
27; KERNEL: %private_array = alloca [1 x float]
28
29; KERNEL:   %polly.access.cast.private_array = bitcast [1 x float]* %private_array to float*
30; KERNEL-NEXT:   %polly.access.private_array = getelementptr float, float* %polly.access.cast.private_array, i64 0
31; KERNEL-NEXT:   %polly.access.cast.MemRef_A = bitcast i8 addrspace(1)* %MemRef_A to float addrspace(1)*
32; KERNEL-NEXT:   %polly.access.MemRef_A = getelementptr float, float addrspace(1)* %polly.access.cast.MemRef_A, i64 %t0
33; KERNEL-NEXT:   %shared.read = load float, float addrspace(1)* %polly.access.MemRef_A
34; KERNEL-NEXT:   store float %shared.read, float* %polly.access.private_array
35
36; KERNEL:   %polly.access.cast.private_array5 = bitcast [1 x float]* %private_array to float*
37; KERNEL-NEXT:   %polly.access.private_array6 = getelementptr float, float* %polly.access.cast.private_array5, i64 0
38; KERNEL-NEXT:   %polly.access.cast.MemRef_A7 = bitcast i8 addrspace(1)* %MemRef_A to float addrspace(1)*
39; KERNEL-NEXT:   %polly.access.MemRef_A8 = getelementptr float, float addrspace(1)* %polly.access.cast.MemRef_A7, i64 %t0
40; KERNEL-NEXT:   %shared.write = load float, float* %polly.access.private_array6
41; KERNEL-NEXT:   store float %shared.write, float addrspace(1)* %polly.access.MemRef_A8
42
43target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
44
45define void @add(float* %A) {
46bb:
47  br label %bb2
48
49bb2:                                              ; preds = %bb11, %bb
50  %i.0 = phi i64 [ 0, %bb ], [ %tmp12, %bb11 ]
51  %exitcond1 = icmp ne i64 %i.0, 32
52  br i1 %exitcond1, label %bb3, label %bb13
53
54bb3:                                              ; preds = %bb2
55  br label %bb4
56
57bb4:                                              ; preds = %bb8, %bb3
58  %j.0 = phi i64 [ 0, %bb3 ], [ %tmp9, %bb8 ]
59  %exitcond = icmp ne i64 %j.0, 10
60  br i1 %exitcond, label %bb5, label %bb10
61
62bb5:                                              ; preds = %bb4
63  %tmp = getelementptr inbounds float, float* %A, i64 %i.0
64  %tmp6 = load float, float* %tmp, align 4
65  %tmp7 = fadd float %tmp6, 1.000000e+00
66  store float %tmp7, float* %tmp, align 4
67  br label %bb8
68
69bb8:                                              ; preds = %bb5
70  %tmp9 = add nuw nsw i64 %j.0, 1
71  br label %bb4
72
73bb10:                                             ; preds = %bb4
74  br label %bb11
75
76bb11:                                             ; preds = %bb10
77  %tmp12 = add nuw nsw i64 %i.0, 1
78  br label %bb2
79
80bb13:                                             ; preds = %bb2
81  ret void
82}
83