150
|
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s
|
|
2 ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=FUNC %s
|
|
3
|
|
4 ; FIXME: This should be merged with uint_to_fp.ll, but s_uint_to_fp_v2i64 crashes on r600
|
|
5
|
|
6 ; FUNC-LABEL: {{^}}s_uint_to_fp_i64_to_f16:
|
|
7 define amdgpu_kernel void @s_uint_to_fp_i64_to_f16(half addrspace(1)* %out, i64 %in) #0 {
|
|
8 %result = uitofp i64 %in to half
|
|
9 store half %result, half addrspace(1)* %out
|
|
10 ret void
|
|
11 }
|
|
12
|
|
13 ; FUNC-LABEL: {{^}}v_uint_to_fp_i64_to_f16:
|
|
14 ; GCN: {{buffer|flat}}_load_dwordx2
|
|
15
|
|
16 ; GCN: v_ffbh_u32
|
|
17 ; GCN: v_ffbh_u32
|
|
18 ; GCN: v_cndmask
|
|
19 ; GCN: v_cndmask
|
|
20
|
|
21 ; GCN-DAG: v_cmp_eq_u64
|
|
22 ; GCN-DAG: v_cmp_gt_u64
|
|
23
|
|
24 ; GCN: v_add_{{[iu]}}32_e32 [[VR:v[0-9]+]]
|
|
25 ; GCN: v_cvt_f16_f32_e32 [[VR_F16:v[0-9]+]], [[VR]]
|
|
26 ; GCN: {{buffer|flat}}_store_short {{.*}}[[VR_F16]]
|
|
27 define amdgpu_kernel void @v_uint_to_fp_i64_to_f16(half addrspace(1)* %out, i64 addrspace(1)* %in) #0 {
|
|
28 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
29 %in.gep = getelementptr i64, i64 addrspace(1)* %in, i32 %tid
|
|
30 %out.gep = getelementptr half, half addrspace(1)* %out, i32 %tid
|
|
31 %val = load i64, i64 addrspace(1)* %in.gep
|
|
32 %result = uitofp i64 %val to half
|
|
33 store half %result, half addrspace(1)* %out.gep
|
|
34 ret void
|
|
35 }
|
|
36
|
|
37 ; FUNC-LABEL: {{^}}s_uint_to_fp_i64_to_f32:
|
|
38 define amdgpu_kernel void @s_uint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 %in) #0 {
|
|
39 %result = uitofp i64 %in to float
|
|
40 store float %result, float addrspace(1)* %out
|
|
41 ret void
|
|
42 }
|
|
43
|
|
44 ; FUNC-LABEL: {{^}}v_uint_to_fp_i64_to_f32:
|
|
45 ; GCN: {{buffer|flat}}_load_dwordx2
|
|
46
|
|
47 ; GCN: v_ffbh_u32
|
|
48 ; GCN: v_ffbh_u32
|
|
49 ; GCN: v_cndmask
|
|
50 ; GCN: v_cndmask
|
|
51
|
|
52 ; GCN-DAG: v_cmp_eq_u64
|
|
53 ; GCN-DAG: v_cmp_gt_u64
|
|
54
|
|
55 ; GCN: v_add_{{[iu]}}32_e32 [[VR:v[0-9]+]]
|
|
56 ; GCN: {{buffer|flat}}_store_dword {{.*}}[[VR]]
|
|
57 define amdgpu_kernel void @v_uint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 addrspace(1)* %in) #0 {
|
|
58 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
59 %in.gep = getelementptr i64, i64 addrspace(1)* %in, i32 %tid
|
|
60 %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
61 %val = load i64, i64 addrspace(1)* %in.gep
|
|
62 %result = uitofp i64 %val to float
|
|
63 store float %result, float addrspace(1)* %out.gep
|
|
64 ret void
|
|
65 }
|
|
66
|
|
67 ; FUNC-LABEL: {{^}}s_uint_to_fp_v2i64_to_v2f32:
|
|
68 define amdgpu_kernel void @s_uint_to_fp_v2i64_to_v2f32(<2 x float> addrspace(1)* %out, <2 x i64> %in) #0{
|
|
69 %result = uitofp <2 x i64> %in to <2 x float>
|
|
70 store <2 x float> %result, <2 x float> addrspace(1)* %out
|
|
71 ret void
|
|
72 }
|
|
73
|
|
74 ; FUNC-LABEL: {{^}}v_uint_to_fp_v4i64_to_v4f32:
|
|
75 define amdgpu_kernel void @v_uint_to_fp_v4i64_to_v4f32(<4 x float> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) #0 {
|
|
76 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
77 %in.gep = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i32 %tid
|
|
78 %out.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %out, i32 %tid
|
|
79 %value = load <4 x i64>, <4 x i64> addrspace(1)* %in.gep
|
|
80 %result = uitofp <4 x i64> %value to <4 x float>
|
|
81 store <4 x float> %result, <4 x float> addrspace(1)* %out.gep
|
|
82 ret void
|
|
83 }
|
|
84
|
|
85 ; FUNC-LABEL: {{^}}s_uint_to_fp_v2i64_to_v2f16:
|
|
86 define amdgpu_kernel void @s_uint_to_fp_v2i64_to_v2f16(<2 x half> addrspace(1)* %out, <2 x i64> %in) #0{
|
|
87 %result = uitofp <2 x i64> %in to <2 x half>
|
|
88 store <2 x half> %result, <2 x half> addrspace(1)* %out
|
|
89 ret void
|
|
90 }
|
|
91
|
|
92 ; FUNC-LABEL: {{^}}v_uint_to_fp_v4i64_to_v4f16:
|
|
93 define amdgpu_kernel void @v_uint_to_fp_v4i64_to_v4f16(<4 x half> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) #0 {
|
|
94 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
95 %in.gep = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i32 %tid
|
|
96 %out.gep = getelementptr <4 x half>, <4 x half> addrspace(1)* %out, i32 %tid
|
|
97 %value = load <4 x i64>, <4 x i64> addrspace(1)* %in.gep
|
|
98 %result = uitofp <4 x i64> %value to <4 x half>
|
|
99 store <4 x half> %result, <4 x half> addrspace(1)* %out.gep
|
|
100 ret void
|
|
101 }
|
|
102
|
|
103 declare i32 @llvm.amdgcn.workitem.id.x() #1
|
|
104
|
|
105 attributes #0 = { nounwind }
|
|
106 attributes #1 = { nounwind readnone }
|