xref: /aosp_15_r20/external/llvm/test/CodeGen/NVPTX/bug22322.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
4*9880d681SAndroid Build Coastguard Workertarget triple = "nvptx64-nvidia-cuda"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker%class.float3 = type { float, float, float }
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: some_kernel
10*9880d681SAndroid Build Coastguard Workerdefine void @some_kernel(%class.float3* nocapture %dst) #0 {
11*9880d681SAndroid Build Coastguard Worker_ZL11compute_vecRK6float3jb.exit:
12*9880d681SAndroid Build Coastguard Worker  %ret_vec.sroa.8.i = alloca float, align 4
13*9880d681SAndroid Build Coastguard Worker  %0 = tail call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x()
14*9880d681SAndroid Build Coastguard Worker  %1 = tail call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
15*9880d681SAndroid Build Coastguard Worker  %2 = mul nsw i32 %1, %0
16*9880d681SAndroid Build Coastguard Worker  %3 = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
17*9880d681SAndroid Build Coastguard Worker  %4 = add nsw i32 %2, %3
18*9880d681SAndroid Build Coastguard Worker  %5 = zext i32 %4 to i64
19*9880d681SAndroid Build Coastguard Worker  %6 = bitcast float* %ret_vec.sroa.8.i to i8*
20*9880d681SAndroid Build Coastguard Worker  call void @llvm.lifetime.start(i64 4, i8* %6)
21*9880d681SAndroid Build Coastguard Worker  %7 = and i32 %4, 15
22*9880d681SAndroid Build Coastguard Worker  %8 = icmp eq i32 %7, 0
23*9880d681SAndroid Build Coastguard Worker  %9 = select i1 %8, float 0.000000e+00, float -1.000000e+00
24*9880d681SAndroid Build Coastguard Worker  store float %9, float* %ret_vec.sroa.8.i, align 4
25*9880d681SAndroid Build Coastguard Worker; CHECK: setp.lt.f32     %p{{[0-9]+}}, %f{{[0-9]+}}, 0f00000000
26*9880d681SAndroid Build Coastguard Worker  %10 = fcmp olt float %9, 0.000000e+00
27*9880d681SAndroid Build Coastguard Worker  %ret_vec.sroa.8.i.val = load float, float* %ret_vec.sroa.8.i, align 4
28*9880d681SAndroid Build Coastguard Worker  %11 = select i1 %10, float 0.000000e+00, float %ret_vec.sroa.8.i.val
29*9880d681SAndroid Build Coastguard Worker  call void @llvm.lifetime.end(i64 4, i8* %6)
30*9880d681SAndroid Build Coastguard Worker  %12 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 0
31*9880d681SAndroid Build Coastguard Worker  store float 0.000000e+00, float* %12, align 4
32*9880d681SAndroid Build Coastguard Worker  %13 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 1
33*9880d681SAndroid Build Coastguard Worker  store float %11, float* %13, align 4
34*9880d681SAndroid Build Coastguard Worker  %14 = getelementptr inbounds %class.float3, %class.float3* %dst, i64 %5, i32 2
35*9880d681SAndroid Build Coastguard Worker  store float 0.000000e+00, float* %14, align 4
36*9880d681SAndroid Build Coastguard Worker  ret void
37*9880d681SAndroid Build Coastguard Worker}
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
40*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() #1
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
43*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.nvvm.read.ptx.sreg.ntid.x() #1
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
46*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
49*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.start(i64, i8* nocapture) #2
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
52*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.end(i64, i8* nocapture) #2
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerattributes #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" }
55*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
56*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind }
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker!nvvm.annotations = !{!0}
59*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!1}
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker!0 = !{void (%class.float3*)* @some_kernel, !"kernel", i32 1}
62*9880d681SAndroid Build Coastguard Worker!1 = !{!"clang version 3.5.1 (tags/RELEASE_351/final)"}
63