brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · e078570 Raw
71 lines · plain
1; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 | FileCheck %s2; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_20 | %ptxas-verify %}3 4target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"5target triple = "nvptx64-unknown-unknown"6 7; Compiled from the following CUDA code:8;9;   #pragma nounroll10;   for (int i = 0; i < 2; ++i)11;     output[i] = input[i];12define void @nounroll(ptr %input, ptr %output) {13; CHECK-LABEL: .visible .func nounroll(14entry:15  br label %for.body16 17for.body:18; CHECK: .pragma "nounroll"19  %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]20  %idxprom = sext i32 %i.06 to i6421  %arrayidx = getelementptr inbounds float, ptr %input, i64 %idxprom22  %0 = load float, ptr %arrayidx, align 423; CHECK: ld.b3224  %arrayidx2 = getelementptr inbounds float, ptr %output, i64 %idxprom25  store float %0, ptr %arrayidx2, align 426; CHECK: st.b3227  %inc = add nuw nsw i32 %i.06, 128  %exitcond = icmp eq i32 %inc, 229  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !030; CHECK-NOT: ld.b3231; CHECK-NOT: st.b3232 33for.end:34  ret void35}36 37; Compiled from the following CUDA code:38;39;   #pragma unroll 140;   for (int i = 0; i < 2; ++i)41;     output[i] = input[i];42define void @unroll1(ptr %input, ptr %output) {43; CHECK-LABEL: .visible .func unroll1(44entry:45  br label %for.body46 47for.body:48; CHECK: .pragma "nounroll"49  %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]50  %idxprom = sext i32 %i.06 to i6451  %arrayidx = getelementptr inbounds float, ptr %input, i64 %idxprom52  %0 = load float, ptr %arrayidx, align 453; CHECK: ld.b3254  %arrayidx2 = getelementptr inbounds float, ptr %output, i64 %idxprom55  store float %0, ptr %arrayidx2, align 456; CHECK: st.b3257  %inc = add nuw nsw i32 %i.06, 158  %exitcond = icmp eq i32 %inc, 259  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !260; CHECK-NOT: ld.b3261; CHECK-NOT: st.b3262 63for.end:64  ret void65}66 67!0 = distinct !{!0, !1}68!1 = !{!"llvm.loop.unroll.disable"}69!2 = distinct !{!2, !3}70!3 = !{!"llvm.loop.unroll.count", i32 1}71