• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-codegen-ppcg -polly-acc-dump-code \
2; RUN: -polly-acc-use-shared \
3; RUN: -disable-output < %s | \
4; RUN: FileCheck -check-prefix=CODE %s
5
6; REQUIRES: pollyacc
7
8;    void add(float *A, float alpha) {
9;      for (long i = 0; i < 32; i++)
10;        for (long j = 0; j < 10; j++)
11;          A[i] += alpha;
12;    }
13
14; CODE:       read(t0);
15; CODE-NEXT:  sync0();
16; CODE-NEXT:  for (int c3 = 0; c3 <= 9; c3 += 1)
17; CODE-NEXT:    Stmt_bb5(t0, c3);
18; CODE-NEXT:  sync1();
19; CODE-NEXT:  write(t0);
20
21; This test case was intended to test code generation for scalars stored
22; in shared memory. However, after properly marking the scalar as read-only
23; the scalar is not stored any more in shared memory. We still leave this
24; test case as documentation if we every forget to mark scalars as read-only.
25
26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27
28define void @add(float* %A, float %alpha) {
29bb:
30  br label %bb2
31
32bb2:                                              ; preds = %bb11, %bb
33  %i.0 = phi i64 [ 0, %bb ], [ %tmp12, %bb11 ]
34  %exitcond1 = icmp ne i64 %i.0, 32
35  br i1 %exitcond1, label %bb3, label %bb13
36
37bb3:                                              ; preds = %bb2
38  br label %bb4
39
40bb4:                                              ; preds = %bb8, %bb3
41  %j.0 = phi i64 [ 0, %bb3 ], [ %tmp9, %bb8 ]
42  %exitcond = icmp ne i64 %j.0, 10
43  br i1 %exitcond, label %bb5, label %bb10
44
45bb5:                                              ; preds = %bb4
46  %tmp = getelementptr inbounds float, float* %A, i64 %i.0
47  %tmp6 = load float, float* %tmp, align 4
48  %tmp7 = fadd float %tmp6, %alpha
49  store float %tmp7, float* %tmp, align 4
50  br label %bb8
51
52bb8:                                              ; preds = %bb5
53  %tmp9 = add nuw nsw i64 %j.0, 1
54  br label %bb4
55
56bb10:                                             ; preds = %bb4
57  br label %bb11
58
59bb11:                                             ; preds = %bb10
60  %tmp12 = add nuw nsw i64 %i.0, 1
61  br label %bb2
62
63bb13:                                             ; preds = %bb2
64  ret void
65}
66