1 ; RUN: opt %loadPolly -polly-codegen-ppcg -polly-acc-dump-kernel-ir \
2 ; RUN: -disable-output < %s | \
3 ; RUN: FileCheck -check-prefix=KERNEL %s
5 ; RUN: opt %loadPolly -polly-codegen-ppcg \
7 ; RUN: FileCheck -check-prefix=IR %s
11 ; void kernel_params_only_some_arrays(float A[], float B[]) {
12 ; for (long i = 0; i < 32; i++)
15 ; for (long i = 0; i < 32; i++)
19 ; KERNEL: ; ModuleID = 'kernel_0'
20 ; KERNEL-NEXT: source_filename = "kernel_0"
21 ; KERNEL-NEXT: target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
22 ; KERNEL-NEXT: target triple = "nvptx64-nvidia-cuda"
24 ; KERNEL: define ptx_kernel void @kernel_0(i8 addrspace(1)* %MemRef_A)
26 ; KERNEL-NEXT: %0 = call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x()
27 ; KERNEL-NEXT: %b0 = zext i32 %0 to i64
28 ; KERNEL-NEXT: %1 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
29 ; KERNEL-NEXT: %t0 = zext i32 %1 to i64
34 ; KERNEL: ; ModuleID = 'kernel_1'
35 ; KERNEL-NEXT: source_filename = "kernel_1"
36 ; KERNEL-NEXT: target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
37 ; KERNEL-NEXT: target triple = "nvptx64-nvidia-cuda"
39 ; KERNEL: define ptx_kernel void @kernel_1(i8 addrspace(1)* %MemRef_B)
41 ; KERNEL-NEXT: %0 = call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x()
42 ; KERNEL-NEXT: %b0 = zext i32 %0 to i64
43 ; KERNEL-NEXT: %1 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
44 ; KERNEL-NEXT: %t0 = zext i32 %1 to i64
50 ; IR: [[DEVPTR:%.*]] = call i8* @polly_getDevicePtr(i8* %p_dev_array_MemRef_A)
51 ; IR-NEXT: [[SLOT:%.*]] = getelementptr [2 x i8*], [2 x i8*]* %polly_launch_0_params, i64 0, i64 0
52 ; IR-NEXT: store i8* [[DEVPTR]], i8** %polly_launch_0_param_0
53 ; IR-NEXT: [[DATA:%.*]] = bitcast i8** %polly_launch_0_param_0 to i8*
54 ; IR-NEXT: store i8* [[DATA]], i8** [[SLOT]]
56 ; IR: [[DEVPTR:%.*]] = call i8* @polly_getDevicePtr(i8* %p_dev_array_MemRef_B)
57 ; IR-NEXT: [[SLOT:%.*]] = getelementptr [2 x i8*], [2 x i8*]* %polly_launch_1_params, i64 0, i64 0
58 ; IR-NEXT: store i8* [[DEVPTR]], i8** %polly_launch_1_param_0
59 ; IR-NEXT: [[DATA:%.*]] = bitcast i8** %polly_launch_1_param_0 to i8*
60 ; IR-NEXT: store i8* [[DATA]], i8** [[SLOT]]
62 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
64 define void @kernel_params_only_some_arrays(float* %A, float* %B) {
68 for.cond: ; preds = %for.inc, %entry
69 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
70 %exitcond1 = icmp ne i64 %i.0, 32
71 br i1 %exitcond1, label %for.body, label %for.end
73 for.body: ; preds = %for.cond
74 %arrayidx = getelementptr inbounds float, float* %A, i64 %i.0
75 %tmp = load float, float* %arrayidx, align 4
76 %add = fadd float %tmp, 4.200000e+01
77 store float %add, float* %arrayidx, align 4
80 for.inc: ; preds = %for.body
81 %inc = add nuw nsw i64 %i.0, 1
84 for.end: ; preds = %for.cond
87 for.cond2: ; preds = %for.inc7, %for.end
88 %i1.0 = phi i64 [ 0, %for.end ], [ %inc8, %for.inc7 ]
89 %exitcond = icmp ne i64 %i1.0, 32
90 br i1 %exitcond, label %for.body4, label %for.end9
92 for.body4: ; preds = %for.cond2
93 %arrayidx5 = getelementptr inbounds float, float* %B, i64 %i1.0
94 %tmp2 = load float, float* %arrayidx5, align 4
95 %add6 = fadd float %tmp2, 4.200000e+01
96 store float %add6, float* %arrayidx5, align 4
99 for.inc7: ; preds = %for.body4
100 %inc8 = add nuw nsw i64 %i1.0, 1
103 for.end9: ; preds = %for.cond2