1 ; RUN: opt %loadPolly -polly-codegen-ppcg -polly-acc-dump-code \
2 ; RUN: -disable-output < %s | \
3 ; RUN: FileCheck -check-prefix=CODE %s
5 ; RUN: opt %loadPolly -polly-codegen-ppcg -S < %s | \
6 ; RUN: FileCheck %s -check-prefix=IR
10 ; CODE: cudaCheckReturn(cudaMemcpy(dev_MemRef_B, MemRef_B, (16) * sizeof(float), cudaMemcpyHostToDevice));
11 ; CODE-NEXT: cudaCheckReturn(cudaMemcpy(dev_MemRef_A, MemRef_A, (8) * sizeof(float), cudaMemcpyHostToDevice));
13 ; CODE: dim3 k0_dimBlock(8);
14 ; CODE-NEXT: dim3 k0_dimGrid(1);
15 ; CODE-NEXT: kernel0 <<<k0_dimGrid, k0_dimBlock>>> (dev_MemRef_A);
16 ; CODE-NEXT: cudaCheckKernel();
20 ; CODE-NEXT: dim3 k1_dimBlock(8);
21 ; CODE-NEXT: dim3 k1_dimGrid(1);
22 ; CODE-NEXT: kernel1 <<<k1_dimGrid, k1_dimBlock>>> (dev_MemRef_B);
23 ; CODE-NEXT: cudaCheckKernel();
26 ; CODE: cudaCheckReturn(cudaMemcpy(MemRef_B, dev_MemRef_B, (16) * sizeof(float), cudaMemcpyDeviceToHost));
27 ; CODE-NEXT: cudaCheckReturn(cudaMemcpy(MemRef_A, dev_MemRef_A, (8) * sizeof(float), cudaMemcpyDeviceToHost));
30 ; CODE-NEXT: Stmt_bb11(t0);
33 ; CODE-NEXT: Stmt_bb3(t0);
35 ; IR: %p_dev_array_MemRef_B = call i8* @polly_allocateMemoryForDevice(i64 32)
36 ; IR-NEXT: %p_dev_array_MemRef_A = call i8* @polly_allocateMemoryForDevice(i64 32)
37 ; IR-NEXT: [[REG0:%.+]] = getelementptr float, float* %B, i64 8
38 ; IR-NEXT: [[REG1:%.+]] = bitcast float* [[REG0]] to i8*
39 ; IR-NEXT: call void @polly_copyFromHostToDevice(i8* [[REG1]], i8* %p_dev_array_MemRef_B, i64 32)
41 ; IR: [[REGA:%.+]] = call i8* @polly_getDevicePtr(i8* %p_dev_array_MemRef_B)
42 ; IR-NEXT: [[REGB:%.+]] = bitcast i8* [[REGA]] to float*
43 ; IR-NEXT: [[REGC:%.+]] = getelementptr float, float* [[REGB]], i64 -8
44 ; IR-NEXT: [[REGD:%.+]] = bitcast float* [[REGC]] to i8*
46 ; void foo(float A[], float B[]) {
47 ; for (long i = 0; i < 8; i++)
50 ; for (long i = 0; i < 8; i++)
58 ; for (long i = 0; i < 16; i++) {
59 ; __sync_synchronize();
66 ; for (long i = 0; i < 16; i++) {
67 ; __sync_synchronize();
71 ; printf("%f\n", sum);
75 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
77 define void @foo(float* %A, float* %B) {
81 bb2: ; preds = %bb7, %bb
82 %i.0 = phi i64 [ 0, %bb ], [ %tmp8, %bb7 ]
83 %exitcond1 = icmp ne i64 %i.0, 8
84 br i1 %exitcond1, label %bb3, label %bb9
87 %tmp = add nuw nsw i64 %i.0, 8
88 %tmp4 = getelementptr inbounds float, float* %B, i64 %tmp
89 %tmp5 = load float, float* %tmp4, align 4
90 %tmp6 = fmul float %tmp5, 4.000000e+00
91 store float %tmp6, float* %tmp4, align 4
95 %tmp8 = add nuw nsw i64 %i.0, 1
101 bb10: ; preds = %bb15, %bb9
102 %i1.0 = phi i64 [ 0, %bb9 ], [ %tmp16, %bb15 ]
103 %exitcond = icmp ne i64 %i1.0, 8
104 br i1 %exitcond, label %bb11, label %bb17
106 bb11: ; preds = %bb10
107 %tmp12 = getelementptr inbounds float, float* %A, i64 %i1.0
108 %tmp13 = load float, float* %tmp12, align 4
109 %tmp14 = fmul float %tmp13, 1.200000e+01
110 store float %tmp14, float* %tmp12, align 4
113 bb15: ; preds = %bb11
114 %tmp16 = add nuw nsw i64 %i1.0, 1
117 bb17: ; preds = %bb10