annotate llvm/test/CodeGen/AMDGPU/fp_to_sint.ll @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=SI --check-prefix=FUNC --check-prefix=GCN
anatofuz
parents:
diff changeset
2 ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=VI --check-prefix=FUNC --check-prefix=GCN
anatofuz
parents:
diff changeset
3 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=EG --check-prefix=FUNC
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 declare float @llvm.fabs.f32(float) #1
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 ; FUNC-LABEL: {{^}}fp_to_sint_i32:
anatofuz
parents:
diff changeset
8 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
anatofuz
parents:
diff changeset
9 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
10 ; SI: s_endpgm
anatofuz
parents:
diff changeset
11 define amdgpu_kernel void @fp_to_sint_i32(i32 addrspace(1)* %out, float %in) {
anatofuz
parents:
diff changeset
12 %conv = fptosi float %in to i32
anatofuz
parents:
diff changeset
13 store i32 %conv, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
14 ret void
anatofuz
parents:
diff changeset
15 }
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 ; FUNC-LABEL: {{^}}fp_to_sint_i32_fabs:
anatofuz
parents:
diff changeset
18 ; SI: v_cvt_i32_f32_e64 v{{[0-9]+}}, |s{{[0-9]+}}|{{$}}
anatofuz
parents:
diff changeset
19 define amdgpu_kernel void @fp_to_sint_i32_fabs(i32 addrspace(1)* %out, float %in) {
anatofuz
parents:
diff changeset
20 %in.fabs = call float @llvm.fabs.f32(float %in)
anatofuz
parents:
diff changeset
21 %conv = fptosi float %in.fabs to i32
anatofuz
parents:
diff changeset
22 store i32 %conv, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
23 ret void
anatofuz
parents:
diff changeset
24 }
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 ; FUNC-LABEL: {{^}}fp_to_sint_v2i32:
anatofuz
parents:
diff changeset
27 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
anatofuz
parents:
diff changeset
28 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
anatofuz
parents:
diff changeset
29 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
30 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
31 define amdgpu_kernel void @fp_to_sint_v2i32(<2 x i32> addrspace(1)* %out, <2 x float> %in) {
anatofuz
parents:
diff changeset
32 %result = fptosi <2 x float> %in to <2 x i32>
anatofuz
parents:
diff changeset
33 store <2 x i32> %result, <2 x i32> addrspace(1)* %out
anatofuz
parents:
diff changeset
34 ret void
anatofuz
parents:
diff changeset
35 }
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 ; FUNC-LABEL: {{^}}fp_to_sint_v4i32:
anatofuz
parents:
diff changeset
38 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
anatofuz
parents:
diff changeset
39 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW]}}
anatofuz
parents:
diff changeset
40 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
anatofuz
parents:
diff changeset
41 ; EG: FLT_TO_INT {{\** *}}T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
anatofuz
parents:
diff changeset
42 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
43 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
44 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
45 ; SI: v_cvt_i32_f32_e32
anatofuz
parents:
diff changeset
46 define amdgpu_kernel void @fp_to_sint_v4i32(<4 x i32> addrspace(1)* %out, <4 x float> addrspace(1)* %in) {
anatofuz
parents:
diff changeset
47 %value = load <4 x float>, <4 x float> addrspace(1) * %in
anatofuz
parents:
diff changeset
48 %result = fptosi <4 x float> %value to <4 x i32>
anatofuz
parents:
diff changeset
49 store <4 x i32> %result, <4 x i32> addrspace(1)* %out
anatofuz
parents:
diff changeset
50 ret void
anatofuz
parents:
diff changeset
51 }
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 ; FUNC-LABEL: {{^}}fp_to_sint_i64:
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
56 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
57 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
58 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
59 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
60 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
61 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
62 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
63 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
64 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
65 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
66 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
67 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
68 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
69 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
70 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
71 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
72 ; EG: SUB_INT
anatofuz
parents:
diff changeset
73 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
74 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
75 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
76
anatofuz
parents:
diff changeset
77 ; Check that the compiler doesn't crash with a "cannot select" error
anatofuz
parents:
diff changeset
78 ; SI: s_endpgm
anatofuz
parents:
diff changeset
79 define amdgpu_kernel void @fp_to_sint_i64 (i64 addrspace(1)* %out, float %in) {
anatofuz
parents:
diff changeset
80 entry:
anatofuz
parents:
diff changeset
81 %0 = fptosi float %in to i64
anatofuz
parents:
diff changeset
82 store i64 %0, i64 addrspace(1)* %out
anatofuz
parents:
diff changeset
83 ret void
anatofuz
parents:
diff changeset
84 }
anatofuz
parents:
diff changeset
85
anatofuz
parents:
diff changeset
86 ; FUNC: {{^}}fp_to_sint_v2i64:
anatofuz
parents:
diff changeset
87 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
88 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
89 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
90 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
91 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
92 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
93 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
94 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
95 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
96 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
97 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
98 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
99 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
100 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
101 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
102 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
103 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
104 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
105 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
106 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
107 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
108 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
109 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
110 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
111 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
112 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
113 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
114 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
115 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
116 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
117 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
118 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
119 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
120 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
121 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
122 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
123 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
124 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
125 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
126 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
127 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
128 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
129
anatofuz
parents:
diff changeset
130 ; SI: s_endpgm
anatofuz
parents:
diff changeset
131 define amdgpu_kernel void @fp_to_sint_v2i64(<2 x i64> addrspace(1)* %out, <2 x float> %x) {
anatofuz
parents:
diff changeset
132 %conv = fptosi <2 x float> %x to <2 x i64>
anatofuz
parents:
diff changeset
133 store <2 x i64> %conv, <2 x i64> addrspace(1)* %out
anatofuz
parents:
diff changeset
134 ret void
anatofuz
parents:
diff changeset
135 }
anatofuz
parents:
diff changeset
136
anatofuz
parents:
diff changeset
137 ; FUNC: {{^}}fp_to_sint_v4i64:
anatofuz
parents:
diff changeset
138 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
139 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
140 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
141 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
142 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
143 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
144 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
145 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
146 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
147 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
148 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
149 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
150 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
151 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
152 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
153 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
154 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
155 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
156 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
157 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
158 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
159 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
160 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
161 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
162 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
163 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
164 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
165 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
166 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
167 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
168 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
169 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
170 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
171 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
172 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
173 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
174 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
175 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
176 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
177 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
178 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
179 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
180 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
181 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
182 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
183 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
184 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
185 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
186 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
187 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
188 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
189 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
190 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
191 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
192 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
193 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
194 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
195 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
196 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
197 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
198 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
199 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
200 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
201 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
202 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
203 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
204 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
205 ; EG-DAG: ASHR
anatofuz
parents:
diff changeset
206 ; EG-DAG: AND_INT
anatofuz
parents:
diff changeset
207 ; EG-DAG: OR_INT
anatofuz
parents:
diff changeset
208 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
209 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
210 ; EG-DAG: LSHL
anatofuz
parents:
diff changeset
211 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
212 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
213 ; EG-DAG: LSHR
anatofuz
parents:
diff changeset
214 ; EG-DAG: SETGT_UINT
anatofuz
parents:
diff changeset
215 ; EG-DAG: SETGT_INT
anatofuz
parents:
diff changeset
216 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
217 ; EG-DAG: XOR_INT
anatofuz
parents:
diff changeset
218 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
219 ; EG-DAG: SUB_INT
anatofuz
parents:
diff changeset
220 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
221 ; EG-DAG: CNDE_INT
anatofuz
parents:
diff changeset
222
anatofuz
parents:
diff changeset
223 ; SI: s_endpgm
anatofuz
parents:
diff changeset
224 define amdgpu_kernel void @fp_to_sint_v4i64(<4 x i64> addrspace(1)* %out, <4 x float> %x) {
anatofuz
parents:
diff changeset
225 %conv = fptosi <4 x float> %x to <4 x i64>
anatofuz
parents:
diff changeset
226 store <4 x i64> %conv, <4 x i64> addrspace(1)* %out
anatofuz
parents:
diff changeset
227 ret void
anatofuz
parents:
diff changeset
228 }
anatofuz
parents:
diff changeset
229
anatofuz
parents:
diff changeset
230 ; FUNC-LABEL: {{^}}fp_to_uint_f32_to_i1:
anatofuz
parents:
diff changeset
231 ; SI: v_cmp_eq_f32_e64 s{{\[[0-9]+:[0-9]+\]}}, -1.0, s{{[0-9]+}}
anatofuz
parents:
diff changeset
232
anatofuz
parents:
diff changeset
233 ; EG: AND_INT
anatofuz
parents:
diff changeset
234 ; EG: SETE_DX10 {{[*]?}} T{{[0-9]+}}.{{[XYZW]}}, KC0[2].Z, literal.y,
anatofuz
parents:
diff changeset
235 ; EG-NEXT: -1082130432(-1.000000e+00)
anatofuz
parents:
diff changeset
236 define amdgpu_kernel void @fp_to_uint_f32_to_i1(i1 addrspace(1)* %out, float %in) #0 {
anatofuz
parents:
diff changeset
237 %conv = fptosi float %in to i1
anatofuz
parents:
diff changeset
238 store i1 %conv, i1 addrspace(1)* %out
anatofuz
parents:
diff changeset
239 ret void
anatofuz
parents:
diff changeset
240 }
anatofuz
parents:
diff changeset
241
anatofuz
parents:
diff changeset
242 ; FUNC-LABEL: {{^}}fp_to_uint_fabs_f32_to_i1:
anatofuz
parents:
diff changeset
243 ; SI: v_cmp_eq_f32_e64 s{{\[[0-9]+:[0-9]+\]}}, -1.0, |s{{[0-9]+}}|
anatofuz
parents:
diff changeset
244 define amdgpu_kernel void @fp_to_uint_fabs_f32_to_i1(i1 addrspace(1)* %out, float %in) #0 {
anatofuz
parents:
diff changeset
245 %in.fabs = call float @llvm.fabs.f32(float %in)
anatofuz
parents:
diff changeset
246 %conv = fptosi float %in.fabs to i1
anatofuz
parents:
diff changeset
247 store i1 %conv, i1 addrspace(1)* %out
anatofuz
parents:
diff changeset
248 ret void
anatofuz
parents:
diff changeset
249 }
anatofuz
parents:
diff changeset
250
anatofuz
parents:
diff changeset
251 ; FUNC-LABEL: {{^}}fp_to_sint_f32_i16:
anatofuz
parents:
diff changeset
252 ; GCN: v_cvt_i32_f32_e32 [[VAL:v[0-9]+]], s{{[0-9]+}}
anatofuz
parents:
diff changeset
253 ; GCN: buffer_store_short [[VAL]]
anatofuz
parents:
diff changeset
254 define amdgpu_kernel void @fp_to_sint_f32_i16(i16 addrspace(1)* %out, float %in) #0 {
anatofuz
parents:
diff changeset
255 %sint = fptosi float %in to i16
anatofuz
parents:
diff changeset
256 store i16 %sint, i16 addrspace(1)* %out
anatofuz
parents:
diff changeset
257 ret void
anatofuz
parents:
diff changeset
258 }
anatofuz
parents:
diff changeset
259
anatofuz
parents:
diff changeset
260 attributes #0 = { nounwind }
anatofuz
parents:
diff changeset
261 attributes #1 = { nounwind readnone }