llvm.org GIT mirror llvm / 3f2e0d9
AMDGPU: int_to_fp test cleanups git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257354 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 4 years ago
2 changed file(s) with 178 addition(s) and 66 deletion(s). Raw diff Collapse all Expand all
11 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
22 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 -check-prefix=FUNC %s
33
4 ; FUNC-LABEL: {{^}}s_sint_to_fp_i32_to_f32:
5 ; SI: v_cvt_f32_i32_e32 {{v[0-9]+}}, {{s[0-9]+$}}
46
5 ; FUNC-LABEL: {{^}}s_sint_to_fp_i32_to_f32:
67 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[2].Z
7 ; SI: v_cvt_f32_i32_e32 {{v[0-9]+}}, {{s[0-9]+$}}
8 define void @s_sint_to_fp_i32_to_f32(float addrspace(1)* %out, i32 %in) {
8 define void @s_sint_to_fp_i32_to_f32(float addrspace(1)* %out, i32 %in) #0 {
99 %result = sitofp i32 %in to float
1010 store float %result, float addrspace(1)* %out
1111 ret void
1212 }
1313
14 ; FUNC-LABEL: {{^}}sint_to_fp_v2i32:
14 ; FUNC-LABEL: {{^}}v_sint_to_fp_i32_to_f32:
15 ; SI: v_cvt_f32_i32_e32 {{v[0-9]+}}, {{v[0-9]+$}}
16
17 ; R600: INT_TO_FLT
18 define void @v_sint_to_fp_i32_to_f32(float addrspace(1)* %out, i32 addrspace(1)* %in) #0 {
19 %tid = call i32 @llvm.r600.read.tidig.x()
20 %in.gep = getelementptr i32, i32 addrspace(1)* %in, i32 %tid
21 %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
22 %val = load i32, i32 addrspace(1)* %in.gep
23 %result = sitofp i32 %val to float
24 store float %result, float addrspace(1)* %out.gep
25 ret void
26 }
27
28 ; FUNC-LABEL: {{^}}s_sint_to_fp_v2i32:
29 ; SI: v_cvt_f32_i32_e32
30 ; SI: v_cvt_f32_i32_e32
31
1532 ; R600-DAG: INT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[2].W
1633 ; R600-DAG: INT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[3].X
17
18 ; SI: v_cvt_f32_i32_e32
19 ; SI: v_cvt_f32_i32_e32
20 define void @sint_to_fp_v2i32(<2 x float> addrspace(1)* %out, <2 x i32> %in) {
34 define void @s_sint_to_fp_v2i32(<2 x float> addrspace(1)* %out, <2 x i32> %in) #0{
2135 %result = sitofp <2 x i32> %in to <2 x float>
2236 store <2 x float> %result, <2 x float> addrspace(1)* %out
2337 ret void
2438 }
2539
26 ; FUNC-LABEL: {{^}}sint_to_fp_v4i32:
40 ; FUNC-LABEL: {{^}}s_sint_to_fp_v4i32_to_v4f32:
41 ; SI: v_cvt_f32_i32_e32
42 ; SI: v_cvt_f32_i32_e32
43 ; SI: v_cvt_f32_i32_e32
44 ; SI: v_cvt_f32_i32_e32
45 ; SI: s_endpgm
46
2747 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
2848 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
2949 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
3050 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
31
32 ; SI: v_cvt_f32_i32_e32
33 ; SI: v_cvt_f32_i32_e32
34 ; SI: v_cvt_f32_i32_e32
35 ; SI: v_cvt_f32_i32_e32
36 define void @sint_to_fp_v4i32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
51 define void @s_sint_to_fp_v4i32_to_v4f32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) #0 {
3752 %value = load <4 x i32>, <4 x i32> addrspace(1) * %in
3853 %result = sitofp <4 x i32> %value to <4 x float>
3954 store <4 x float> %result, <4 x float> addrspace(1)* %out
4055 ret void
4156 }
4257
43 ; FUNC-LABEL: {{^}}sint_to_fp_i1_f32:
58 ; FUNC-LABEL: {{^}}v_sint_to_fp_v4i32:
59 ; SI: v_cvt_f32_i32_e32
60 ; SI: v_cvt_f32_i32_e32
61 ; SI: v_cvt_f32_i32_e32
62 ; SI: v_cvt_f32_i32_e32
63
64 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
65 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
66 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
67 ; R600: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
68 define void @v_sint_to_fp_v4i32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) #0 {
69 %tid = call i32 @llvm.r600.read.tidig.x()
70 %in.gep = getelementptr <4 x i32>, <4 x i32> addrspace(1)* %in, i32 %tid
71 %out.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %out, i32 %tid
72 %value = load <4 x i32>, <4 x i32> addrspace(1)* %in.gep
73 %result = sitofp <4 x i32> %value to <4 x float>
74 store <4 x float> %result, <4 x float> addrspace(1)* %out.gep
75 ret void
76 }
77
78 ; FUNC-LABEL: {{^}}s_sint_to_fp_i1_f32:
4479 ; SI: v_cmp_eq_i32_e64 [[CMP:s\[[0-9]+:[0-9]\]]],
4580 ; SI-NEXT: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, 1.0, [[CMP]]
4681 ; SI: buffer_store_dword [[RESULT]],
4782 ; SI: s_endpgm
48 define void @sint_to_fp_i1_f32(float addrspace(1)* %out, i32 %in) {
83 define void @s_sint_to_fp_i1_f32(float addrspace(1)* %out, i32 %in) #0 {
4984 %cmp = icmp eq i32 %in, 0
5085 %fp = uitofp i1 %cmp to float
51 store float %fp, float addrspace(1)* %out, align 4
86 store float %fp, float addrspace(1)* %out
5287 ret void
5388 }
5489
55 ; FUNC-LABEL: {{^}}sint_to_fp_i1_f32_load:
90 ; FUNC-LABEL: {{^}}s_sint_to_fp_i1_f32_load:
5691 ; SI: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, -1.0
5792 ; SI: buffer_store_dword [[RESULT]],
5893 ; SI: s_endpgm
59 define void @sint_to_fp_i1_f32_load(float addrspace(1)* %out, i1 %in) {
94 define void @s_sint_to_fp_i1_f32_load(float addrspace(1)* %out, i1 %in) #0 {
6095 %fp = sitofp i1 %in to float
61 store float %fp, float addrspace(1)* %out, align 4
96 store float %fp, float addrspace(1)* %out
6297 ret void
6398 }
99
100 ; FUNC-LABEL: {{^}}v_sint_to_fp_i1_f32_load:
101 ; SI: {{buffer|flat}}_load_ubyte
102 ; SI: v_and_b32_e32 {{v[0-9]+}}, 1, {{v[0-9]+}}
103 ; SI: v_cmp_eq_i32
104 ; SI: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, -1.0
105 ; SI: {{buffer|flat}}_store_dword [[RESULT]],
106 ; SI: s_endpgm
107 define void @v_sint_to_fp_i1_f32_load(float addrspace(1)* %out, i1 addrspace(1)* %in) #0 {
108 %tid = call i32 @llvm.r600.read.tidig.x()
109 %in.gep = getelementptr i1, i1 addrspace(1)* %in, i32 %tid
110 %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
111 %val = load i1, i1 addrspace(1)* %in.gep
112 %fp = sitofp i1 %val to float
113 store float %fp, float addrspace(1)* %out.gep
114 ret void
115 }
116
117 declare i32 @llvm.r600.read.tidig.x() #1
118
119 attributes #0 = { nounwind }
120 attributes #1 = { nounwind readnone }
11 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
22 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 -check-prefix=FUNC %s
33
4 ; FUNC-LABEL: {{^}}uint_to_fp_i32_to_f32:
5 ; R600-DAG: UINT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[2].Z
4 ; FUNC-LABEL: {{^}}s_uint_to_fp_i32_to_f32:
5 ; SI: v_cvt_f32_u32_e32
66
7 ; SI: v_cvt_f32_u32_e32
8 ; SI: s_endpgm
9 define void @uint_to_fp_i32_to_f32(float addrspace(1)* %out, i32 %in) {
7 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[2].Z
8 define void @s_uint_to_fp_i32_to_f32(float addrspace(1)* %out, i32 %in) #0 {
109 %result = uitofp i32 %in to float
1110 store float %result, float addrspace(1)* %out
1211 ret void
1312 }
1413
15 ; FUNC-LABEL: {{^}}uint_to_fp_v2i32_to_v2f32:
14 ; FUNC-LABEL: {{^}}v_uint_to_fp_i32_to_f32:
15 ; SI: v_cvt_f32_u32_e32 {{v[0-9]+}}, {{v[0-9]+$}}
16
17 ; R600: INT_TO_FLT
18 define void @v_uint_to_fp_i32_to_f32(float addrspace(1)* %out, i32 addrspace(1)* %in) #0 {
19 %tid = call i32 @llvm.r600.read.tidig.x()
20 %in.gep = getelementptr i32, i32 addrspace(1)* %in, i32 %tid
21 %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
22 %val = load i32, i32 addrspace(1)* %in.gep
23 %result = uitofp i32 %val to float
24 store float %result, float addrspace(1)* %out.gep
25 ret void
26 }
27
28 ; FUNC-LABEL: {{^}}s_uint_to_fp_v2i32_to_v2f32:
29 ; SI: v_cvt_f32_u32_e32
30 ; SI: v_cvt_f32_u32_e32
31
1632 ; R600-DAG: UINT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[2].W
1733 ; R600-DAG: UINT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[3].X
18
19 ; SI: v_cvt_f32_u32_e32
20 ; SI: v_cvt_f32_u32_e32
21 ; SI: s_endpgm
22 define void @uint_to_fp_v2i32_to_v2f32(<2 x float> addrspace(1)* %out, <2 x i32> %in) {
34 define void @s_uint_to_fp_v2i32_to_v2f32(<2 x float> addrspace(1)* %out, <2 x i32> %in) #0 {
2335 %result = uitofp <2 x i32> %in to <2 x float>
2436 store <2 x float> %result, <2 x float> addrspace(1)* %out
2537 ret void
2638 }
2739
28 ; FUNC-LABEL: {{^}}uint_to_fp_v4i32_to_v4f32:
29 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
30 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
31 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
32 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
33
40 ; FUNC-LABEL: {{^}}s_uint_to_fp_v4i32_to_v4f32:
3441 ; SI: v_cvt_f32_u32_e32
3542 ; SI: v_cvt_f32_u32_e32
3643 ; SI: v_cvt_f32_u32_e32
3744 ; SI: v_cvt_f32_u32_e32
3845 ; SI: s_endpgm
39 define void @uint_to_fp_v4i32_to_v4f32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
46
47 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
48 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
49 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
50 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
51 define void @s_uint_to_fp_v4i32_to_v4f32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) #0 {
4052 %value = load <4 x i32>, <4 x i32> addrspace(1) * %in
4153 %result = uitofp <4 x i32> %value to <4 x float>
4254 store <4 x float> %result, <4 x float> addrspace(1)* %out
4355 ret void
4456 }
4557
46 ; FUNC-LABEL: {{^}}uint_to_fp_i64_to_f32:
47 ; R600: UINT_TO_FLT
48 ; R600: UINT_TO_FLT
49 ; R600: MULADD_IEEE
58 ; FUNC-LABEL: {{^}}v_uint_to_fp_v4i32:
59 ; SI: v_cvt_f32_u32_e32
60 ; SI: v_cvt_f32_u32_e32
61 ; SI: v_cvt_f32_u32_e32
62 ; SI: v_cvt_f32_u32_e32
63
64 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
65 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
66 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
67 ; R600: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
68 define void @v_uint_to_fp_v4i32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) #0 {
69 %tid = call i32 @llvm.r600.read.tidig.x()
70 %in.gep = getelementptr <4 x i32>, <4 x i32> addrspace(1)* %in, i32 %tid
71 %out.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %out, i32 %tid
72 %value = load <4 x i32>, <4 x i32> addrspace(1)* %in.gep
73 %result = uitofp <4 x i32> %value to <4 x float>
74 store <4 x float> %result, <4 x float> addrspace(1)* %out.gep
75 ret void
76 }
77
78 ; FUNC-LABEL: {{^}}s_uint_to_fp_i1_to_f32:
79 ; SI: v_cmp_eq_i32_e64 [[CMP:s\[[0-9]+:[0-9]\]]],
80 ; SI-NEXT: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, 1.0, [[CMP]]
81 ; SI: buffer_store_dword [[RESULT]],
82 ; SI: s_endpgm
83 define void @s_uint_to_fp_i1_to_f32(float addrspace(1)* %out, i32 %in) #0 {
84 %cmp = icmp eq i32 %in, 0
85 %fp = uitofp i1 %cmp to float
86 store float %fp, float addrspace(1)* %out
87 ret void
88 }
89
90 ; FUNC-LABEL: {{^}}s_uint_to_fp_i1_to_f32_load:
91 ; SI: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, 1.0
92 ; SI: buffer_store_dword [[RESULT]],
93 ; SI: s_endpgm
94 define void @s_uint_to_fp_i1_to_f32_load(float addrspace(1)* %out, i1 %in) #0 {
95 %fp = uitofp i1 %in to float
96 store float %fp, float addrspace(1)* %out
97 ret void
98 }
99
100 ; FUNC-LABEL: {{^}}v_uint_to_fp_i1_f32_load:
101 ; SI: {{buffer|flat}}_load_ubyte
102 ; SI: v_and_b32_e32 {{v[0-9]+}}, 1, {{v[0-9]+}}
103 ; SI: v_cmp_eq_i32
104 ; SI: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, 1.0
105 ; SI: {{buffer|flat}}_store_dword [[RESULT]],
106 ; SI: s_endpgm
107 define void @v_uint_to_fp_i1_f32_load(float addrspace(1)* %out, i1 addrspace(1)* %in) #0 {
108 %tid = call i32 @llvm.r600.read.tidig.x()
109 %in.gep = getelementptr i1, i1 addrspace(1)* %in, i32 %tid
110 %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
111 %val = load i1, i1 addrspace(1)* %in.gep
112 %fp = uitofp i1 %val to float
113 store float %fp, float addrspace(1)* %out.gep
114 ret void
115 }
116
117 ; FUNC-LABEL: {{^}}s_uint_to_fp_i64_to_f32:
50118 ; SI: v_cvt_f32_u32_e32
51119 ; SI: v_cvt_f32_u32_e32
52120 ; SI: v_madmk_f32_e32 {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}, 0x4f800000
53121 ; SI: s_endpgm
54 define void @uint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 %in) {
122
123 ; R600: UINT_TO_FLT
124 ; R600: UINT_TO_FLT
125 ; R600: MULADD_IEEE
126 define void @s_uint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 %in) #0 {
55127 entry:
56 %0 = uitofp i64 %in to float
57 store float %0, float addrspace(1)* %out
128 %cvt = uitofp i64 %in to float
129 store float %cvt, float addrspace(1)* %out
58130 ret void
59131 }
60132
61 ; FUNC-LABEL: {{^}}uint_to_fp_i1_to_f32:
62 ; SI: v_cmp_eq_i32_e64 [[CMP:s\[[0-9]+:[0-9]\]]],
63 ; SI-NEXT: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, 1.0, [[CMP]]
64 ; SI: buffer_store_dword [[RESULT]],
65 ; SI: s_endpgm
66 define void @uint_to_fp_i1_to_f32(float addrspace(1)* %out, i32 %in) {
67 %cmp = icmp eq i32 %in, 0
68 %fp = uitofp i1 %cmp to float
69 store float %fp, float addrspace(1)* %out, align 4
70 ret void
71 }
133 declare i32 @llvm.r600.read.tidig.x() #1
72134
73 ; FUNC-LABEL: {{^}}uint_to_fp_i1_to_f32_load:
74 ; SI: v_cndmask_b32_e64 [[RESULT:v[0-9]+]], 0, 1.0
75 ; SI: buffer_store_dword [[RESULT]],
76 ; SI: s_endpgm
77 define void @uint_to_fp_i1_to_f32_load(float addrspace(1)* %out, i1 %in) {
78 %fp = uitofp i1 %in to float
79 store float %fp, float addrspace(1)* %out, align 4
80 ret void
81 }
135 attributes #0 = { nounwind }
136 attributes #1 = { nounwind readnone }