1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 | %ptxas-verify %}
4 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
5 target triple = "nvptx64-unknown-unknown"
7 ; Compiled from the following CUDA code:
10 ; for (int i = 0; i < 2; ++i)
11 ; output[i] = input[i];
12 define void @nounroll(ptr %input, ptr %output) {
13 ; CHECK-LABEL: .visible .func nounroll(
18 ; CHECK: .pragma "nounroll"
19 %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
20 %idxprom = sext i32 %i.06 to i64
21 %arrayidx = getelementptr inbounds float, ptr %input, i64 %idxprom
22 %0 = load float, ptr %arrayidx, align 4
24 %arrayidx2 = getelementptr inbounds float, ptr %output, i64 %idxprom
25 store float %0, ptr %arrayidx2, align 4
27 %inc = add nuw nsw i32 %i.06, 1
28 %exitcond = icmp eq i32 %inc, 2
29 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
37 ; Compiled from the following CUDA code:
40 ; for (int i = 0; i < 2; ++i)
41 ; output[i] = input[i];
42 define void @unroll1(ptr %input, ptr %output) {
43 ; CHECK-LABEL: .visible .func unroll1(
48 ; CHECK: .pragma "nounroll"
49 %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
50 %idxprom = sext i32 %i.06 to i64
51 %arrayidx = getelementptr inbounds float, ptr %input, i64 %idxprom
52 %0 = load float, ptr %arrayidx, align 4
54 %arrayidx2 = getelementptr inbounds float, ptr %output, i64 %idxprom
55 store float %0, ptr %arrayidx2, align 4
57 %inc = add nuw nsw i32 %i.06, 1
58 %exitcond = icmp eq i32 %inc, 2
59 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !2
67 !0 = distinct !{!0, !1}
68 !1 = !{!"llvm.loop.unroll.disable"}
69 !2 = distinct !{!2, !3}
70 !3 = !{!"llvm.loop.unroll.count", i32 1}