1; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s 2 3target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" 4target triple = "nvptx64-nvidia-cuda" 5 6%class.float3 = type { float, float, float } 7 8; Function Attrs: nounwind 9; CHECK-LABEL: some_kernel 10define void @some_kernel(%class.float3* nocapture %dst) #0 { 11_ZL11compute_vecRK6float3jb.exit: 12 %ret_vec.sroa.8.i = alloca float, align 4 13 %0 = tail call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() 14 %1 = tail call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() 15 %2 = mul nsw i32 %1, %0 16 %3 = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 17 %4 = add nsw i32 %2, %3 18 %5 = zext i32 %4 to i64 19 %6 = bitcast float* %ret_vec.sroa.8.i to i8* 20 call void @llvm.lifetime.start(i64 4, i8* %6) 21 %7 = and i32 %4, 15 22 %8 = icmp eq i32 %7, 0 23 %9 = select i1 %8, float 0.000000e+00, float -1.000000e+00 24 store float %9, float* %ret_vec.sroa.8.i, align 4 25; CHECK: setp.lt.f32 %p{{[0-9]+}}, %f{{[0-9]+}}, 0f00000000 26 %10 = fcmp olt float %9, 0.000000e+00 27 %ret_vec.sroa.8.i.val = load float, float* %ret_vec.sroa.8.i, align 4 28 %11 = select i1 %10, float 0.000000e+00, float %ret_vec.sroa.8.i.val 29 call void @llvm.lifetime.end(i64 4, i8* %6) 30 %12 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 0 31 store float 0.000000e+00, float* %12, align 4 32 %13 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 1 33 store float %11, float* %13, align 4 34 %14 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 2 35 store float 0.000000e+00, float* %14, align 4 36 ret void 37} 38 39; Function Attrs: nounwind readnone 40declare i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() #1 41 42; Function Attrs: nounwind readnone 43declare i32 @llvm.nvvm.read.ptx.sreg.ntid.x() #1 44 45; Function Attrs: nounwind readnone 46declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 47 48; Function Attrs: nounwind 49declare void @llvm.lifetime.start(i64, i8* nocapture) #2 50 51; Function Attrs: nounwind 52declare void @llvm.lifetime.end(i64, i8* nocapture) #2 53 54attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" } 55attributes #1 = { nounwind readnone } 56attributes #2 = { nounwind } 57 58!nvvm.annotations = !{!0} 59!llvm.ident = !{!1} 60 61!0 = !{void (%class.float3*)* @some_kernel, !"kernel", i32 1} 62!1 = !{!"clang version 3.5.1 (tags/RELEASE_351/final)"} 63