Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" |
| 4 | target triple = "nvptx64-nvidia-cuda" |
| 5 | |
| 6 | %class.float3 = type { float, float, float } |
| 7 | |
| 8 | ; Function Attrs: nounwind |
| 9 | ; CHECK-LABEL: some_kernel |
| 10 | define void @some_kernel(%class.float3* nocapture %dst) #0 { |
| 11 | _ZL11compute_vecRK6float3jb.exit: |
| 12 | %ret_vec.sroa.8.i = alloca float, align 4 |
Justin Bogner | a466cc3 | 2016-07-07 16:40:17 +0000 | [diff] [blame] | 13 | %0 = tail call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() |
| 14 | %1 = tail call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 15 | %2 = mul nsw i32 %1, %0 |
Justin Bogner | a466cc3 | 2016-07-07 16:40:17 +0000 | [diff] [blame] | 16 | %3 = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 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* |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 20 | call void @llvm.lifetime.start.p0i8(i64 4, i8* %6) |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 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 |
Justin Lebar | b5e8849 | 2016-09-09 21:07:26 +0000 | [diff] [blame] | 25 | ; CHECK: max.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, 0f00000000 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 26 | %10 = fcmp olt float %9, 0.000000e+00 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 27 | %ret_vec.sroa.8.i.val = load float, float* %ret_vec.sroa.8.i, align 4 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 28 | %11 = select i1 %10, float 0.000000e+00, float %ret_vec.sroa.8.i.val |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 29 | call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 30 | %12 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 0 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 31 | store float 0.000000e+00, float* %12, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 32 | %13 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 1 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 33 | store float %11, float* %13, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 34 | %14 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 2 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 35 | store float 0.000000e+00, float* %14, align 4 |
| 36 | ret void |
| 37 | } |
| 38 | |
| 39 | ; Function Attrs: nounwind readnone |
Justin Bogner | a466cc3 | 2016-07-07 16:40:17 +0000 | [diff] [blame] | 40 | declare i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() #1 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 41 | |
| 42 | ; Function Attrs: nounwind readnone |
Justin Bogner | a466cc3 | 2016-07-07 16:40:17 +0000 | [diff] [blame] | 43 | declare i32 @llvm.nvvm.read.ptx.sreg.ntid.x() #1 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 44 | |
| 45 | ; Function Attrs: nounwind readnone |
Justin Bogner | a466cc3 | 2016-07-07 16:40:17 +0000 | [diff] [blame] | 46 | declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 47 | |
| 48 | ; Function Attrs: nounwind |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 49 | declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 50 | |
| 51 | ; Function Attrs: nounwind |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 52 | declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2 |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 53 | |
Matt Arsenault | 1201301 | 2018-08-12 19:09:12 +0000 | [diff] [blame] | 54 | attributes #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" "no-signed-zeros-fp-math"="true" "use-soft-float"="false" } |
Justin Holewinski | 23df659 | 2015-01-26 19:11:20 +0000 | [diff] [blame] | 55 | attributes #1 = { nounwind readnone } |
| 56 | attributes #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)"} |