1 ; ## Full FP16 support enabled by default.
2 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
3 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
4 ; RUN: | FileCheck -allow-deprecated-dag-overlap -check-prefixes CHECK,CHECK-F16 %s
6 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
7 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
8 ; RUN: | %ptxas-verify -arch=sm_53 \
10 ; ## FP16 support explicitly disabled.
11 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
12 ; RUN: -O0 -disable-post-ra -frame-pointer=all --nvptx-no-f16-math \
13 ; RUN: -verify-machineinstrs \
14 ; RUN: | FileCheck -allow-deprecated-dag-overlap -check-prefixes CHECK,CHECK-NOF16 %s
16 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
17 ; RUN: -O0 -disable-post-ra -frame-pointer=all --nvptx-no-f16-math \
18 ; RUN: -verify-machineinstrs \
19 ; RUN: | %ptxas-verify -arch=sm_53 \
21 ; ## FP16 is not supported by hardware.
22 ; RUN: llc < %s -O0 -mtriple=nvptx64-nvidia-cuda -mcpu=sm_52 -asm-verbose=false \
23 ; RUN: -disable-post-ra -frame-pointer=all -verify-machineinstrs \
24 ; RUN: | FileCheck -allow-deprecated-dag-overlap -check-prefixes CHECK,CHECK-NOF16 %s
26 ; RUN: llc < %s -O0 -mtriple=nvptx64-nvidia-cuda -mcpu=sm_52 -asm-verbose=false \
27 ; RUN: -disable-post-ra -frame-pointer=all -verify-machineinstrs \
28 ; RUN: | %ptxas-verify -arch=sm_52 \
31 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
33 ; CHECK-LABEL: test_ret_const(
34 ; CHECK: mov.b32 [[R:%r[0-9+]]], 1073757184;
35 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
37 define <2 x half> @test_ret_const() #0 {
38 ret <2 x half> <half 1.0, half 2.0>
41 ; CHECK-LABEL: test_extract_0(
42 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_extract_0_param_0];
43 ; CHECK: mov.b32 {[[R:%rs[0-9]+]], tmp}, [[A]];
44 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
46 define half @test_extract_0(<2 x half> %a) #0 {
47 %e = extractelement <2 x half> %a, i32 0
51 ; CHECK-LABEL: test_extract_1(
52 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_extract_1_param_0];
53 ; CHECK: mov.b32 {tmp, [[R:%rs[0-9]+]]}, [[A]];
54 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
56 define half @test_extract_1(<2 x half> %a) #0 {
57 %e = extractelement <2 x half> %a, i32 1
61 ; CHECK-LABEL: test_extract_i(
62 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_extract_i_param_0];
63 ; CHECK-DAG: ld.param.u64 [[IDX:%rd[0-9]+]], [test_extract_i_param_1];
64 ; CHECK-DAG: setp.eq.s64 [[PRED:%p[0-9]+]], [[IDX]], 0;
65 ; CHECK-DAG: mov.b32 {[[E0:%rs[0-9]+]], [[E1:%rs[0-9]+]]}, [[A]];
66 ; CHECK: selp.b16 [[R:%rs[0-9]+]], [[E0]], [[E1]], [[PRED]];
67 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
69 define half @test_extract_i(<2 x half> %a, i64 %idx) #0 {
70 %e = extractelement <2 x half> %a, i64 %idx
74 ; CHECK-LABEL: test_fadd(
75 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fadd_param_0];
76 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fadd_param_1];
78 ; CHECK-F16-NEXT: add.rn.f16x2 [[R:%r[0-9]+]], [[A]], [[B]];
80 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
81 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
82 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
83 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
84 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
85 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
86 ; CHECK-NOF16-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
87 ; CHECK-NOF16-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
88 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
89 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
90 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
92 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
94 define <2 x half> @test_fadd(<2 x half> %a, <2 x half> %b) #0 {
95 %r = fadd <2 x half> %a, %b
99 ; Check that we can lower fadd with immediate arguments.
100 ; CHECK-LABEL: test_fadd_imm_0(
101 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fadd_imm_0_param_0];
103 ; CHECK-F16: mov.b32 [[I:%r[0-9+]]], 1073757184;
104 ; CHECK-F16: add.rn.f16x2 [[R:%r[0-9]+]], [[A]], [[I]];
106 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
107 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
108 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
109 ; CHECK-NOF16-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], 0f3F800000;
110 ; CHECK-NOF16-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], 0f40000000;
111 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
112 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
113 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
115 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
117 define <2 x half> @test_fadd_imm_0(<2 x half> %a) #0 {
118 %r = fadd <2 x half> <half 1.0, half 2.0>, %a
122 ; CHECK-LABEL: test_fadd_imm_1(
123 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fadd_imm_1_param_0];
125 ; CHECK-F16: mov.b32 [[I:%r[0-9+]]], 1073757184;
126 ; CHECK-F16: add.rn.f16x2 [[R:%r[0-9]+]], [[B]], [[I]];
128 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
129 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
130 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
131 ; CHECK-NOF16-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], 0f3F800000;
132 ; CHECK-NOF16-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], 0f40000000;
133 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
134 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
135 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
137 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
139 define <2 x half> @test_fadd_imm_1(<2 x half> %a) #0 {
140 %r = fadd <2 x half> %a, <half 1.0, half 2.0>
144 ; CHECK-LABEL: test_fsub(
145 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fsub_param_0];
147 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fsub_param_1];
148 ; CHECK-F16-NEXT: sub.rn.f16x2 [[R:%r[0-9]+]], [[A]], [[B]];
150 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
151 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
152 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
153 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
154 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
155 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
156 ; CHECK-NOF16-DAG: sub.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
157 ; CHECK-NOF16-DAG: sub.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
158 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
159 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
160 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
162 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
164 define <2 x half> @test_fsub(<2 x half> %a, <2 x half> %b) #0 {
165 %r = fsub <2 x half> %a, %b
169 ; CHECK-LABEL: test_fneg(
170 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fneg_param_0];
172 ; CHECK-F16: mov.b32 [[I:%r[0-9+]]], 0;
173 ; CHECK-F16-NEXT: sub.rn.f16x2 [[R:%r[0-9]+]], [[I]], [[A]];
175 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
176 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
177 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
178 ; CHECK-NOF16-DAG: mov.f32 [[Z:%f[0-9]+]], 0f00000000;
179 ; CHECK-NOF16-DAG: sub.rn.f32 [[FR0:%f[0-9]+]], [[Z]], [[FA0]];
180 ; CHECK-NOF16-DAG: sub.rn.f32 [[FR1:%f[0-9]+]], [[Z]], [[FA1]];
181 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
182 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
183 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
185 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
187 define <2 x half> @test_fneg(<2 x half> %a) #0 {
188 %r = fsub <2 x half> <half 0.0, half 0.0>, %a
192 ; CHECK-LABEL: test_fmul(
193 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fmul_param_0];
194 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fmul_param_1];
195 ; CHECK-F16-NEXT: mul.rn.f16x2 [[R:%r[0-9]+]], [[A]], [[B]];
197 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
198 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
199 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
200 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
201 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
202 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
203 ; CHECK-NOF16-DAG: mul.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
204 ; CHECK-NOF16-DAG: mul.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
205 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
206 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
207 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
209 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
211 define <2 x half> @test_fmul(<2 x half> %a, <2 x half> %b) #0 {
212 %r = fmul <2 x half> %a, %b
216 ; CHECK-LABEL: test_fdiv(
217 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fdiv_param_0];
218 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fdiv_param_1];
219 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
220 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
221 ; CHECK-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]];
222 ; CHECK-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]];
223 ; CHECK-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]];
224 ; CHECK-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]];
225 ; CHECK-DAG: div.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]];
226 ; CHECK-DAG: div.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]];
227 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]];
228 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]];
229 ; CHECK-NEXT: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
230 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
232 define <2 x half> @test_fdiv(<2 x half> %a, <2 x half> %b) #0 {
233 %r = fdiv <2 x half> %a, %b
237 ; CHECK-LABEL: test_frem(
238 ; -- Load two 16x2 inputs and split them into f16 elements
239 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_frem_param_0];
240 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_frem_param_1];
241 ; -- Split into elements
242 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
243 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
245 ; CHECK-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]];
246 ; CHECK-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]];
247 ; CHECK-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]];
248 ; CHECK-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]];
249 ; -- frem(a[0],b[0]).
250 ; CHECK-DAG: div.rn.f32 [[FD0:%f[0-9]+]], [[FA0]], [[FB0]];
251 ; CHECK-DAG: cvt.rzi.f32.f32 [[DI0:%f[0-9]+]], [[FD0]];
252 ; CHECK-DAG: mul.f32 [[RI0:%f[0-9]+]], [[DI0]], [[FB0]];
253 ; CHECK-DAG: sub.f32 [[RFNINF0:%f[0-9]+]], [[FA0]], [[RI0]];
254 ; CHECK-DAG: testp.infinite.f32 [[ISB0INF:%p[0-9]+]], [[FB0]];
255 ; CHECK-DAG: selp.f32 [[RF0:%f[0-9]+]], [[FA0]], [[RFNINF0]], [[ISB0INF]];
256 ; -- frem(a[1],b[1]).
257 ; CHECK-DAG: div.rn.f32 [[FD1:%f[0-9]+]], [[FA1]], [[FB1]];
258 ; CHECK-DAG: cvt.rzi.f32.f32 [[DI1:%f[0-9]+]], [[FD1]];
259 ; CHECK-DAG: mul.f32 [[RI1:%f[0-9]+]], [[DI1]], [[FB1]];
260 ; CHECK-DAG: sub.f32 [[RFNINF1:%f[0-9]+]], [[FA1]], [[RI1]];
261 ; CHECK-DAG: testp.infinite.f32 [[ISB1INF:%p[0-9]+]], [[FB1]];
262 ; CHECK-DAG: selp.f32 [[RF1:%f[0-9]+]], [[FA1]], [[RFNINF1]], [[ISB1INF]];
263 ; -- convert back to f16.
264 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
265 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
266 ; -- merge into f16x2 and return it.
267 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
268 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
270 define <2 x half> @test_frem(<2 x half> %a, <2 x half> %b) #0 {
271 %r = frem <2 x half> %a, %b
275 ; CHECK-LABEL: .func test_ldst_v2f16(
276 ; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v2f16_param_0];
277 ; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v2f16_param_1];
278 ; CHECK-DAG: ld.b32 [[E:%r[0-9]+]], [%[[A]]]
279 ; CHECK-DAG: st.b32 [%[[B]]], [[E]];
281 define void @test_ldst_v2f16(ptr %a, ptr %b) {
282 %t1 = load <2 x half>, ptr %a
283 store <2 x half> %t1, ptr %b, align 16
287 ; CHECK-LABEL: .func test_ldst_v3f16(
288 ; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v3f16_param_0];
289 ; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v3f16_param_1];
290 ; -- v3 is inconvenient to capture as it's lowered as ld.b64 + fair
291 ; number of bitshifting instructions that may change at llvm's whim.
292 ; So we only verify that we only issue correct number of writes using
293 ; correct offset, but not the values we write.
295 ; CHECK-DAG: st.u32 [%[[B]]],
296 ; CHECK-DAG: st.b16 [%[[B]]+4],
298 define void @test_ldst_v3f16(ptr %a, ptr %b) {
299 %t1 = load <3 x half>, ptr %a
300 store <3 x half> %t1, ptr %b, align 16
304 ; CHECK-LABEL: .func test_ldst_v4f16(
305 ; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v4f16_param_0];
306 ; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v4f16_param_1];
307 ; CHECK-DAG: ld.v4.b16 {[[E0:%rs[0-9]+]], [[E1:%rs[0-9]+]], [[E2:%rs[0-9]+]], [[E3:%rs[0-9]+]]}, [%[[A]]];
308 ; CHECK-DAG: st.v4.b16 [%[[B]]], {[[E0]], [[E1]], [[E2]], [[E3]]};
310 define void @test_ldst_v4f16(ptr %a, ptr %b) {
311 %t1 = load <4 x half>, ptr %a
312 store <4 x half> %t1, ptr %b, align 16
316 ; CHECK-LABEL: .func test_ldst_v8f16(
317 ; CHECK-DAG: ld.param.u64 %[[A:rd[0-9]+]], [test_ldst_v8f16_param_0];
318 ; CHECK-DAG: ld.param.u64 %[[B:rd[0-9]+]], [test_ldst_v8f16_param_1];
319 ; CHECK-DAG: ld.v4.b32 {[[E0:%r[0-9]+]], [[E1:%r[0-9]+]], [[E2:%r[0-9]+]], [[E3:%r[0-9]+]]}, [%[[A]]];
320 ; CHECK-DAG: st.v4.b32 [%[[B]]], {[[E0]], [[E1]], [[E2]], [[E3]]};
322 define void @test_ldst_v8f16(ptr %a, ptr %b) {
323 %t1 = load <8 x half>, ptr %a
324 store <8 x half> %t1, ptr %b, align 16
328 declare <2 x half> @test_callee(<2 x half> %a, <2 x half> %b) #0
330 ; CHECK-LABEL: test_call(
331 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_call_param_0];
332 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_call_param_1];
334 ; CHECK-DAG: .param .align 4 .b8 param0[4];
335 ; CHECK-DAG: .param .align 4 .b8 param1[4];
336 ; CHECK-DAG: st.param.b32 [param0+0], [[A]];
337 ; CHECK-DAG: st.param.b32 [param1+0], [[B]];
338 ; CHECK-DAG: .param .align 4 .b8 retval0[4];
339 ; CHECK: call.uni (retval0),
340 ; CHECK-NEXT: test_callee,
342 ; CHECK-NEXT: ld.param.b32 [[R:%r[0-9]+]], [retval0+0];
344 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
346 define <2 x half> @test_call(<2 x half> %a, <2 x half> %b) #0 {
347 %r = call <2 x half> @test_callee(<2 x half> %a, <2 x half> %b)
351 ; CHECK-LABEL: test_call_flipped(
352 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_call_flipped_param_0];
353 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_call_flipped_param_1];
355 ; CHECK-DAG: .param .align 4 .b8 param0[4];
356 ; CHECK-DAG: .param .align 4 .b8 param1[4];
357 ; CHECK-DAG: st.param.b32 [param0+0], [[B]];
358 ; CHECK-DAG: st.param.b32 [param1+0], [[A]];
359 ; CHECK-DAG: .param .align 4 .b8 retval0[4];
360 ; CHECK: call.uni (retval0),
361 ; CHECK-NEXT: test_callee,
363 ; CHECK-NEXT: ld.param.b32 [[R:%r[0-9]+]], [retval0+0];
365 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
367 define <2 x half> @test_call_flipped(<2 x half> %a, <2 x half> %b) #0 {
368 %r = call <2 x half> @test_callee(<2 x half> %b, <2 x half> %a)
372 ; CHECK-LABEL: test_tailcall_flipped(
373 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_tailcall_flipped_param_0];
374 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_tailcall_flipped_param_1];
376 ; CHECK-DAG: .param .align 4 .b8 param0[4];
377 ; CHECK-DAG: .param .align 4 .b8 param1[4];
378 ; CHECK-DAG: st.param.b32 [param0+0], [[B]];
379 ; CHECK-DAG: st.param.b32 [param1+0], [[A]];
380 ; CHECK-DAG: .param .align 4 .b8 retval0[4];
381 ; CHECK: call.uni (retval0),
382 ; CHECK-NEXT: test_callee,
384 ; CHECK-NEXT: ld.param.b32 [[R:%r[0-9]+]], [retval0+0];
386 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
388 define <2 x half> @test_tailcall_flipped(<2 x half> %a, <2 x half> %b) #0 {
389 %r = tail call <2 x half> @test_callee(<2 x half> %b, <2 x half> %a)
393 ; CHECK-LABEL: test_select(
394 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_param_0];
395 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_param_1];
396 ; CHECK-DAG: ld.param.u8 [[C:%rs[0-9]+]], [test_select_param_2]
397 ; CHECK-DAG: setp.eq.b16 [[PRED:%p[0-9]+]], %rs{{.*}}, 1;
398 ; CHECK-NEXT: selp.b32 [[R:%r[0-9]+]], [[A]], [[B]], [[PRED]];
399 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
401 define <2 x half> @test_select(<2 x half> %a, <2 x half> %b, i1 zeroext %c) #0 {
402 %r = select i1 %c, <2 x half> %a, <2 x half> %b
406 ; CHECK-LABEL: test_select_cc(
407 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_cc_param_0];
408 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_cc_param_1];
409 ; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_select_cc_param_2];
410 ; CHECK-DAG: ld.param.b32 [[D:%r[0-9]+]], [test_select_cc_param_3];
412 ; CHECK-F16: setp.neu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[C]], [[D]]
414 ; CHECK-NOF16-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
415 ; CHECK-NOF16-DAG: mov.b32 {[[D0:%rs[0-9]+]], [[D1:%rs[0-9]+]]}, [[D]]
416 ; CHECK-NOF16-DAG: cvt.f32.f16 [[DF0:%f[0-9]+]], [[D0]];
417 ; CHECK-NOF16-DAG: cvt.f32.f16 [[CF0:%f[0-9]+]], [[C0]];
418 ; CHECK-NOF16-DAG: cvt.f32.f16 [[DF1:%f[0-9]+]], [[D1]];
419 ; CHECK-NOF16-DAG: cvt.f32.f16 [[CF1:%f[0-9]+]], [[C1]];
420 ; CHECK-NOF16-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[CF0]], [[DF0]]
421 ; CHECK-NOF16-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[CF1]], [[DF1]]
423 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
424 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
425 ; CHECK-DAG: selp.b16 [[R0:%rs[0-9]+]], [[A0]], [[B0]], [[P0]];
426 ; CHECK-DAG: selp.b16 [[R1:%rs[0-9]+]], [[A1]], [[B1]], [[P1]];
427 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
428 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
430 define <2 x half> @test_select_cc(<2 x half> %a, <2 x half> %b, <2 x half> %c, <2 x half> %d) #0 {
431 %cc = fcmp une <2 x half> %c, %d
432 %r = select <2 x i1> %cc, <2 x half> %a, <2 x half> %b
436 ; CHECK-LABEL: test_select_cc_f32_f16(
437 ; CHECK-DAG: ld.param.v2.f32 {[[A0:%f[0-9]+]], [[A1:%f[0-9]+]]}, [test_select_cc_f32_f16_param_0];
438 ; CHECK-DAG: ld.param.v2.f32 {[[B0:%f[0-9]+]], [[B1:%f[0-9]+]]}, [test_select_cc_f32_f16_param_1];
439 ; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_select_cc_f32_f16_param_2];
440 ; CHECK-DAG: ld.param.b32 [[D:%r[0-9]+]], [test_select_cc_f32_f16_param_3];
442 ; CHECK-F16: setp.neu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[C]], [[D]]
443 ; CHECK-NOF16-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
444 ; CHECK-NOF16-DAG: mov.b32 {[[D0:%rs[0-9]+]], [[D1:%rs[0-9]+]]}, [[D]]
445 ; CHECK-NOF16-DAG: cvt.f32.f16 [[DF0:%f[0-9]+]], [[D0]];
446 ; CHECK-NOF16-DAG: cvt.f32.f16 [[CF0:%f[0-9]+]], [[C0]];
447 ; CHECK-NOF16-DAG: cvt.f32.f16 [[DF1:%f[0-9]+]], [[D1]];
448 ; CHECK-NOF16-DAG: cvt.f32.f16 [[CF1:%f[0-9]+]], [[C1]];
449 ; CHECK-NOF16-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[CF0]], [[DF0]]
450 ; CHECK-NOF16-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[CF1]], [[DF1]]
452 ; CHECK-DAG: selp.f32 [[R0:%f[0-9]+]], [[A0]], [[B0]], [[P0]];
453 ; CHECK-DAG: selp.f32 [[R1:%f[0-9]+]], [[A1]], [[B1]], [[P1]];
454 ; CHECK-NEXT: st.param.v2.f32 [func_retval0+0], {[[R0]], [[R1]]};
456 define <2 x float> @test_select_cc_f32_f16(<2 x float> %a, <2 x float> %b,
457 <2 x half> %c, <2 x half> %d) #0 {
458 %cc = fcmp une <2 x half> %c, %d
459 %r = select <2 x i1> %cc, <2 x float> %a, <2 x float> %b
463 ; CHECK-LABEL: test_select_cc_f16_f32(
464 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_select_cc_f16_f32_param_0];
465 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_select_cc_f16_f32_param_1];
466 ; CHECK-DAG: ld.param.v2.f32 {[[C0:%f[0-9]+]], [[C1:%f[0-9]+]]}, [test_select_cc_f16_f32_param_2];
467 ; CHECK-DAG: ld.param.v2.f32 {[[D0:%f[0-9]+]], [[D1:%f[0-9]+]]}, [test_select_cc_f16_f32_param_3];
468 ; CHECK-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[C0]], [[D0]]
469 ; CHECK-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[C1]], [[D1]]
470 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
471 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
472 ; CHECK-DAG: selp.b16 [[R0:%rs[0-9]+]], [[A0]], [[B0]], [[P0]];
473 ; CHECK-DAG: selp.b16 [[R1:%rs[0-9]+]], [[A1]], [[B1]], [[P1]];
474 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
475 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
477 define <2 x half> @test_select_cc_f16_f32(<2 x half> %a, <2 x half> %b,
478 <2 x float> %c, <2 x float> %d) #0 {
479 %cc = fcmp une <2 x float> %c, %d
480 %r = select <2 x i1> %cc, <2 x half> %a, <2 x half> %b
484 ; CHECK-LABEL: test_fcmp_une(
485 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_une_param_0];
486 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_une_param_1];
487 ; CHECK-F16: setp.neu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
488 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
489 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
490 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
491 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
492 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
493 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
494 ; CHECK-NOF16-DAG: setp.neu.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
495 ; CHECK-NOF16-DAG: setp.neu.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
496 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
497 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
498 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
499 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
501 define <2 x i1> @test_fcmp_une(<2 x half> %a, <2 x half> %b) #0 {
502 %r = fcmp une <2 x half> %a, %b
506 ; CHECK-LABEL: test_fcmp_ueq(
507 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ueq_param_0];
508 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ueq_param_1];
509 ; CHECK-F16: setp.equ.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
510 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
511 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
512 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
513 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
514 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
515 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
516 ; CHECK-NOF16-DAG: setp.equ.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
517 ; CHECK-NOF16-DAG: setp.equ.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
518 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
519 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
520 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
521 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
523 define <2 x i1> @test_fcmp_ueq(<2 x half> %a, <2 x half> %b) #0 {
524 %r = fcmp ueq <2 x half> %a, %b
528 ; CHECK-LABEL: test_fcmp_ugt(
529 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ugt_param_0];
530 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ugt_param_1];
531 ; CHECK-F16: setp.gtu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
532 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
533 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
534 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
535 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
536 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
537 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
538 ; CHECK-NOF16-DAG: setp.gtu.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
539 ; CHECK-NOF16-DAG: setp.gtu.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
540 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
541 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
542 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
543 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
545 define <2 x i1> @test_fcmp_ugt(<2 x half> %a, <2 x half> %b) #0 {
546 %r = fcmp ugt <2 x half> %a, %b
550 ; CHECK-LABEL: test_fcmp_uge(
551 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_uge_param_0];
552 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_uge_param_1];
553 ; CHECK-F16: setp.geu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
554 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
555 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
556 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
557 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
558 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
559 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
560 ; CHECK-NOF16-DAG: setp.geu.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
561 ; CHECK-NOF16-DAG: setp.geu.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
562 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
563 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
564 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
565 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
567 define <2 x i1> @test_fcmp_uge(<2 x half> %a, <2 x half> %b) #0 {
568 %r = fcmp uge <2 x half> %a, %b
572 ; CHECK-LABEL: test_fcmp_ult(
573 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ult_param_0];
574 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ult_param_1];
575 ; CHECK-F16: setp.ltu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
576 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
577 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
578 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
579 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
580 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
581 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
582 ; CHECK-NOF16-DAG: setp.ltu.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
583 ; CHECK-NOF16-DAG: setp.ltu.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
584 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
585 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
586 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
587 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
589 define <2 x i1> @test_fcmp_ult(<2 x half> %a, <2 x half> %b) #0 {
590 %r = fcmp ult <2 x half> %a, %b
594 ; CHECK-LABEL: test_fcmp_ule(
595 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ule_param_0];
596 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ule_param_1];
597 ; CHECK-F16: setp.leu.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
598 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
599 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
600 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
601 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
602 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
603 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
604 ; CHECK-NOF16-DAG: setp.leu.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
605 ; CHECK-NOF16-DAG: setp.leu.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
606 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
607 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
608 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
609 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
611 define <2 x i1> @test_fcmp_ule(<2 x half> %a, <2 x half> %b) #0 {
612 %r = fcmp ule <2 x half> %a, %b
617 ; CHECK-LABEL: test_fcmp_uno(
618 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_uno_param_0];
619 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_uno_param_1];
620 ; CHECK-F16: setp.nan.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
621 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
622 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
623 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
624 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
625 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
626 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
627 ; CHECK-NOF16-DAG: setp.nan.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
628 ; CHECK-NOF16-DAG: setp.nan.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
629 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
630 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
631 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
632 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
634 define <2 x i1> @test_fcmp_uno(<2 x half> %a, <2 x half> %b) #0 {
635 %r = fcmp uno <2 x half> %a, %b
639 ; CHECK-LABEL: test_fcmp_one(
640 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_one_param_0];
641 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_one_param_1];
642 ; CHECK-F16: setp.ne.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
643 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
644 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
645 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
646 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
647 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
648 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
649 ; CHECK-NOF16-DAG: setp.ne.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
650 ; CHECK-NOF16-DAG: setp.ne.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
651 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
652 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
653 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
654 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
656 define <2 x i1> @test_fcmp_one(<2 x half> %a, <2 x half> %b) #0 {
657 %r = fcmp one <2 x half> %a, %b
661 ; CHECK-LABEL: test_fcmp_oeq(
662 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_oeq_param_0];
663 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_oeq_param_1];
664 ; CHECK-F16: setp.eq.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
665 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
666 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
667 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
668 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
669 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
670 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
671 ; CHECK-NOF16-DAG: setp.eq.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
672 ; CHECK-NOF16-DAG: setp.eq.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
673 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
674 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
675 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
676 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
678 define <2 x i1> @test_fcmp_oeq(<2 x half> %a, <2 x half> %b) #0 {
679 %r = fcmp oeq <2 x half> %a, %b
683 ; CHECK-LABEL: test_fcmp_ogt(
684 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ogt_param_0];
685 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ogt_param_1];
686 ; CHECK-F16: setp.gt.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
687 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
688 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
689 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
690 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
691 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
692 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
693 ; CHECK-NOF16-DAG: setp.gt.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
694 ; CHECK-NOF16-DAG: setp.gt.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
695 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
696 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
697 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
698 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
700 define <2 x i1> @test_fcmp_ogt(<2 x half> %a, <2 x half> %b) #0 {
701 %r = fcmp ogt <2 x half> %a, %b
705 ; CHECK-LABEL: test_fcmp_oge(
706 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_oge_param_0];
707 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_oge_param_1];
708 ; CHECK-F16: setp.ge.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
709 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
710 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
711 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
712 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
713 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
714 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
715 ; CHECK-NOF16-DAG: setp.ge.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
716 ; CHECK-NOF16-DAG: setp.ge.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
717 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
718 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
719 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
720 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
722 define <2 x i1> @test_fcmp_oge(<2 x half> %a, <2 x half> %b) #0 {
723 %r = fcmp oge <2 x half> %a, %b
727 ; CHECK-LABEL: test_fcmp_olt(
728 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_olt_param_0];
729 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_olt_param_1];
730 ; CHECK-F16: setp.lt.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
731 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
732 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
733 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
734 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
735 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
736 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
737 ; CHECK-NOF16-DAG: setp.lt.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
738 ; CHECK-NOF16-DAG: setp.lt.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
739 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
740 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
741 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
742 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
744 define <2 x i1> @test_fcmp_olt(<2 x half> %a, <2 x half> %b) #0 {
745 %r = fcmp olt <2 x half> %a, %b
749 ; XCHECK-LABEL: test_fcmp_ole(
750 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ole_param_0];
751 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ole_param_1];
752 ; CHECK-F16: setp.le.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
753 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
754 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
755 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
756 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
757 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
758 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
759 ; CHECK-NOF16-DAG: setp.le.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
760 ; CHECK-NOF16-DAG: setp.le.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
761 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
762 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
763 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
764 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
766 define <2 x i1> @test_fcmp_ole(<2 x half> %a, <2 x half> %b) #0 {
767 %r = fcmp ole <2 x half> %a, %b
771 ; CHECK-LABEL: test_fcmp_ord(
772 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fcmp_ord_param_0];
773 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fcmp_ord_param_1];
774 ; CHECK-F16: setp.num.f16x2 [[P0:%p[0-9]+]]|[[P1:%p[0-9]+]], [[A]], [[B]]
775 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
776 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
777 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
778 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
779 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
780 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
781 ; CHECK-NOF16-DAG: setp.num.f32 [[P0:%p[0-9]+]], [[FA0]], [[FB0]]
782 ; CHECK-NOF16-DAG: setp.num.f32 [[P1:%p[0-9]+]], [[FA1]], [[FB1]]
783 ; CHECK-DAG: selp.u16 [[R0:%rs[0-9]+]], -1, 0, [[P0]];
784 ; CHECK-NEXT: st.param.b8 [func_retval0+0], [[R0]];
785 ; CHECK-DAG: selp.u16 [[R1:%rs[0-9]+]], -1, 0, [[P1]];
786 ; CHECK-NEXT: st.param.b8 [func_retval0+1], [[R1]];
788 define <2 x i1> @test_fcmp_ord(<2 x half> %a, <2 x half> %b) #0 {
789 %r = fcmp ord <2 x half> %a, %b
793 ; CHECK-LABEL: test_fptosi_i32(
794 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fptosi_i32_param_0];
795 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
796 ; CHECK-DAG: cvt.rzi.s32.f16 [[R0:%r[0-9]+]], [[A0]];
797 ; CHECK-DAG: cvt.rzi.s32.f16 [[R1:%r[0-9]+]], [[A1]];
798 ; CHECK: st.param.v2.b32 [func_retval0+0], {[[R0]], [[R1]]}
800 define <2 x i32> @test_fptosi_i32(<2 x half> %a) #0 {
801 %r = fptosi <2 x half> %a to <2 x i32>
805 ; CHECK-LABEL: test_fptosi_i64(
806 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fptosi_i64_param_0];
807 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
808 ; CHECK-DAG: cvt.rzi.s64.f16 [[R0:%rd[0-9]+]], [[A0]];
809 ; CHECK-DAG: cvt.rzi.s64.f16 [[R1:%rd[0-9]+]], [[A1]];
810 ; CHECK: st.param.v2.b64 [func_retval0+0], {[[R0]], [[R1]]}
812 define <2 x i64> @test_fptosi_i64(<2 x half> %a) #0 {
813 %r = fptosi <2 x half> %a to <2 x i64>
817 ; CHECK-LABEL: test_fptoui_2xi32(
818 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fptoui_2xi32_param_0];
819 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
820 ; CHECK-DAG: cvt.rzi.u32.f16 [[R0:%r[0-9]+]], [[A0]];
821 ; CHECK-DAG: cvt.rzi.u32.f16 [[R1:%r[0-9]+]], [[A1]];
822 ; CHECK: st.param.v2.b32 [func_retval0+0], {[[R0]], [[R1]]}
824 define <2 x i32> @test_fptoui_2xi32(<2 x half> %a) #0 {
825 %r = fptoui <2 x half> %a to <2 x i32>
829 ; CHECK-LABEL: test_fptoui_2xi64(
830 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fptoui_2xi64_param_0];
831 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
832 ; CHECK-DAG: cvt.rzi.u64.f16 [[R0:%rd[0-9]+]], [[A0]];
833 ; CHECK-DAG: cvt.rzi.u64.f16 [[R1:%rd[0-9]+]], [[A1]];
834 ; CHECK: st.param.v2.b64 [func_retval0+0], {[[R0]], [[R1]]}
836 define <2 x i64> @test_fptoui_2xi64(<2 x half> %a) #0 {
837 %r = fptoui <2 x half> %a to <2 x i64>
841 ; CHECK-LABEL: test_uitofp_2xi32(
842 ; CHECK: ld.param.v2.u32 {[[A0:%r[0-9]+]], [[A1:%r[0-9]+]]}, [test_uitofp_2xi32_param_0];
843 ; CHECK-DAG: cvt.rn.f16.u32 [[R0:%rs[0-9]+]], [[A0]];
844 ; CHECK-DAG: cvt.rn.f16.u32 [[R1:%rs[0-9]+]], [[A1]];
845 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
846 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
848 define <2 x half> @test_uitofp_2xi32(<2 x i32> %a) #0 {
849 %r = uitofp <2 x i32> %a to <2 x half>
853 ; CHECK-LABEL: test_uitofp_2xi64(
854 ; CHECK: ld.param.v2.u64 {[[A0:%rd[0-9]+]], [[A1:%rd[0-9]+]]}, [test_uitofp_2xi64_param_0];
855 ; CHECK-DAG: cvt.rn.f16.u64 [[R0:%rs[0-9]+]], [[A0]];
856 ; CHECK-DAG: cvt.rn.f16.u64 [[R1:%rs[0-9]+]], [[A1]];
857 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
858 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
860 define <2 x half> @test_uitofp_2xi64(<2 x i64> %a) #0 {
861 %r = uitofp <2 x i64> %a to <2 x half>
865 ; CHECK-LABEL: test_sitofp_2xi32(
866 ; CHECK: ld.param.v2.u32 {[[A0:%r[0-9]+]], [[A1:%r[0-9]+]]}, [test_sitofp_2xi32_param_0];
867 ; CHECK-DAG: cvt.rn.f16.s32 [[R0:%rs[0-9]+]], [[A0]];
868 ; CHECK-DAG: cvt.rn.f16.s32 [[R1:%rs[0-9]+]], [[A1]];
869 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
870 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
872 define <2 x half> @test_sitofp_2xi32(<2 x i32> %a) #0 {
873 %r = sitofp <2 x i32> %a to <2 x half>
877 ; CHECK-LABEL: test_sitofp_2xi64(
878 ; CHECK: ld.param.v2.u64 {[[A0:%rd[0-9]+]], [[A1:%rd[0-9]+]]}, [test_sitofp_2xi64_param_0];
879 ; CHECK-DAG: cvt.rn.f16.s64 [[R0:%rs[0-9]+]], [[A0]];
880 ; CHECK-DAG: cvt.rn.f16.s64 [[R1:%rs[0-9]+]], [[A1]];
881 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
882 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
884 define <2 x half> @test_sitofp_2xi64(<2 x i64> %a) #0 {
885 %r = sitofp <2 x i64> %a to <2 x half>
889 ; CHECK-LABEL: test_uitofp_2xi32_fadd(
890 ; CHECK-DAG: ld.param.v2.u32 {[[A0:%r[0-9]+]], [[A1:%r[0-9]+]]}, [test_uitofp_2xi32_fadd_param_0];
891 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_uitofp_2xi32_fadd_param_1];
892 ; CHECK-DAG: cvt.rn.f16.u32 [[C0:%rs[0-9]+]], [[A0]];
893 ; CHECK-DAG: cvt.rn.f16.u32 [[C1:%rs[0-9]+]], [[A1]];
895 ; CHECK-F16-DAG: mov.b32 [[C:%r[0-9]+]], {[[C0]], [[C1]]}
896 ; CHECK-F16-DAG: add.rn.f16x2 [[R:%r[0-9]+]], [[B]], [[C]];
898 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
899 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
900 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
901 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC0:%f[0-9]+]], [[C0]]
902 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC1:%f[0-9]+]], [[C1]]
903 ; CHECK-NOF16-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FB0]], [[FC0]];
904 ; CHECK-NOF16-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FB1]], [[FC1]];
905 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
906 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
907 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
909 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
911 define <2 x half> @test_uitofp_2xi32_fadd(<2 x i32> %a, <2 x half> %b) #0 {
912 %c = uitofp <2 x i32> %a to <2 x half>
913 %r = fadd <2 x half> %b, %c
917 ; CHECK-LABEL: test_sitofp_2xi32_fadd(
918 ; CHECK-DAG: ld.param.v2.u32 {[[A0:%r[0-9]+]], [[A1:%r[0-9]+]]}, [test_sitofp_2xi32_fadd_param_0];
919 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_sitofp_2xi32_fadd_param_1];
920 ; CHECK-DAG: cvt.rn.f16.s32 [[C0:%rs[0-9]+]], [[A0]];
921 ; CHECK-DAG: cvt.rn.f16.s32 [[C1:%rs[0-9]+]], [[A1]];
923 ; CHECK-F16-DAG: mov.b32 [[C:%r[0-9]+]], {[[C0]], [[C1]]}
924 ; CHECK-F16-DAG: add.rn.f16x2 [[R:%r[0-9]+]], [[B]], [[C]];
926 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
927 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
928 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
929 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC0:%f[0-9]+]], [[C0]]
930 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC1:%f[0-9]+]], [[C1]]
931 ; CHECK-NOF16-DAG: add.rn.f32 [[FR0:%f[0-9]+]], [[FB0]], [[FC0]];
932 ; CHECK-NOF16-DAG: add.rn.f32 [[FR1:%f[0-9]+]], [[FB1]], [[FC1]];
933 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
934 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
935 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
937 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
939 define <2 x half> @test_sitofp_2xi32_fadd(<2 x i32> %a, <2 x half> %b) #0 {
940 %c = sitofp <2 x i32> %a to <2 x half>
941 %r = fadd <2 x half> %b, %c
945 ; CHECK-LABEL: test_fptrunc_2xfloat(
946 ; CHECK: ld.param.v2.f32 {[[A0:%f[0-9]+]], [[A1:%f[0-9]+]]}, [test_fptrunc_2xfloat_param_0];
947 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[A0]];
948 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[A1]];
949 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
950 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
952 define <2 x half> @test_fptrunc_2xfloat(<2 x float> %a) #0 {
953 %r = fptrunc <2 x float> %a to <2 x half>
957 ; CHECK-LABEL: test_fptrunc_2xdouble(
958 ; CHECK: ld.param.v2.f64 {[[A0:%fd[0-9]+]], [[A1:%fd[0-9]+]]}, [test_fptrunc_2xdouble_param_0];
959 ; CHECK-DAG: cvt.rn.f16.f64 [[R0:%rs[0-9]+]], [[A0]];
960 ; CHECK-DAG: cvt.rn.f16.f64 [[R1:%rs[0-9]+]], [[A1]];
961 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
962 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
964 define <2 x half> @test_fptrunc_2xdouble(<2 x double> %a) #0 {
965 %r = fptrunc <2 x double> %a to <2 x half>
969 ; CHECK-LABEL: test_fpext_2xfloat(
970 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fpext_2xfloat_param_0];
971 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
972 ; CHECK-DAG: cvt.f32.f16 [[R0:%f[0-9]+]], [[A0]];
973 ; CHECK-DAG: cvt.f32.f16 [[R1:%f[0-9]+]], [[A1]];
974 ; CHECK-NEXT: st.param.v2.f32 [func_retval0+0], {[[R0]], [[R1]]};
976 define <2 x float> @test_fpext_2xfloat(<2 x half> %a) #0 {
977 %r = fpext <2 x half> %a to <2 x float>
981 ; CHECK-LABEL: test_fpext_2xdouble(
982 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fpext_2xdouble_param_0];
983 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
984 ; CHECK-DAG: cvt.f64.f16 [[R0:%fd[0-9]+]], [[A0]];
985 ; CHECK-DAG: cvt.f64.f16 [[R1:%fd[0-9]+]], [[A1]];
986 ; CHECK-NEXT: st.param.v2.f64 [func_retval0+0], {[[R0]], [[R1]]};
988 define <2 x double> @test_fpext_2xdouble(<2 x half> %a) #0 {
989 %r = fpext <2 x half> %a to <2 x double>
994 ; CHECK-LABEL: test_bitcast_2xhalf_to_2xi16(
995 ; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_bitcast_2xhalf_to_2xi16_param_0];
996 ; CHECK: st.param.b32 [func_retval0+0], [[A]]
998 define <2 x i16> @test_bitcast_2xhalf_to_2xi16(<2 x half> %a) #0 {
999 %r = bitcast <2 x half> %a to <2 x i16>
1003 ; CHECK-LABEL: test_bitcast_2xi16_to_2xhalf(
1004 ; CHECK: ld.param.u32 [[R:%r[0-9]+]], [test_bitcast_2xi16_to_2xhalf_param_0];
1005 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1007 define <2 x half> @test_bitcast_2xi16_to_2xhalf(<2 x i16> %a) #0 {
1008 %r = bitcast <2 x i16> %a to <2 x half>
1012 ; CHECK-LABEL: test_bitcast_float_to_2xhalf(
1013 ; CHECK: ld.param.f32 [[AF1:%f[0-9]+]], [test_bitcast_float_to_2xhalf_param_0];
1014 ; CHECK: mov.b32 [[R:%r[0-9]+]], [[AF1]];
1015 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1017 define <2 x half> @test_bitcast_float_to_2xhalf(float %a) #0 {
1018 %r = bitcast float %a to <2 x half>
1022 ; CHECK-LABEL: test_bitcast_2xhalf_to_float(
1023 ; CHECK: ld.param.u32 [[R:%r[0-9]+]], [test_bitcast_2xhalf_to_float_param_0];
1024 ; CHECK: mov.b32 [[AF1:%f[0-9]+]], [[R]];
1025 ; CHECK: st.param.f32 [func_retval0+0], [[AF1]];
1027 define float @test_bitcast_2xhalf_to_float(<2 x half> %a) #0 {
1028 %r = bitcast <2 x half> %a to float
1032 declare <2 x half> @llvm.sqrt.f16(<2 x half> %a) #0
1033 declare <2 x half> @llvm.powi.f16.i32(<2 x half> %a, <2 x i32> %b) #0
1034 declare <2 x half> @llvm.sin.f16(<2 x half> %a) #0
1035 declare <2 x half> @llvm.cos.f16(<2 x half> %a) #0
1036 declare <2 x half> @llvm.pow.f16(<2 x half> %a, <2 x half> %b) #0
1037 declare <2 x half> @llvm.exp.f16(<2 x half> %a) #0
1038 declare <2 x half> @llvm.exp2.f16(<2 x half> %a) #0
1039 declare <2 x half> @llvm.log.f16(<2 x half> %a) #0
1040 declare <2 x half> @llvm.log10.f16(<2 x half> %a) #0
1041 declare <2 x half> @llvm.log2.f16(<2 x half> %a) #0
1042 declare <2 x half> @llvm.fma.f16(<2 x half> %a, <2 x half> %b, <2 x half> %c) #0
1043 declare <2 x half> @llvm.fabs.f16(<2 x half> %a) #0
1044 declare <2 x half> @llvm.minnum.f16(<2 x half> %a, <2 x half> %b) #0
1045 declare <2 x half> @llvm.maxnum.f16(<2 x half> %a, <2 x half> %b) #0
1046 declare <2 x half> @llvm.copysign.f16(<2 x half> %a, <2 x half> %b) #0
1047 declare <2 x half> @llvm.floor.f16(<2 x half> %a) #0
1048 declare <2 x half> @llvm.ceil.f16(<2 x half> %a) #0
1049 declare <2 x half> @llvm.trunc.f16(<2 x half> %a) #0
1050 declare <2 x half> @llvm.rint.f16(<2 x half> %a) #0
1051 declare <2 x half> @llvm.nearbyint.f16(<2 x half> %a) #0
1052 declare <2 x half> @llvm.round.f16(<2 x half> %a) #0
1053 declare <2 x half> @llvm.roundeven.f16(<2 x half> %a) #0
1054 declare <2 x half> @llvm.fmuladd.f16(<2 x half> %a, <2 x half> %b, <2 x half> %c) #0
1056 ; CHECK-LABEL: test_sqrt(
1057 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_sqrt_param_0];
1058 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1059 ; CHECK-DAG: cvt.f32.f16 [[AF0:%f[0-9]+]], [[A0]];
1060 ; CHECK-DAG: cvt.f32.f16 [[AF1:%f[0-9]+]], [[A1]];
1061 ; CHECK-DAG: sqrt.rn.f32 [[RF0:%f[0-9]+]], [[AF0]];
1062 ; CHECK-DAG: sqrt.rn.f32 [[RF1:%f[0-9]+]], [[AF1]];
1063 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
1064 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
1065 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1066 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1068 define <2 x half> @test_sqrt(<2 x half> %a) #0 {
1069 %r = call <2 x half> @llvm.sqrt.f16(<2 x half> %a)
1073 ;;; Can't do this yet: requires libcall.
1074 ; XCHECK-LABEL: test_powi(
1075 ;define <2 x half> @test_powi(<2 x half> %a, <2 x i32> %b) #0 {
1076 ; %r = call <2 x half> @llvm.powi.f16.i32(<2 x half> %a, <2 x i32> %b)
1080 ; CHECK-LABEL: test_sin(
1081 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_sin_param_0];
1082 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1083 ; CHECK-DAG: cvt.f32.f16 [[AF0:%f[0-9]+]], [[A0]];
1084 ; CHECK-DAG: cvt.f32.f16 [[AF1:%f[0-9]+]], [[A1]];
1085 ; CHECK-DAG: sin.approx.f32 [[RF0:%f[0-9]+]], [[AF0]];
1086 ; CHECK-DAG: sin.approx.f32 [[RF1:%f[0-9]+]], [[AF1]];
1087 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
1088 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
1089 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1090 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1092 define <2 x half> @test_sin(<2 x half> %a) #0 #1 {
1093 %r = call <2 x half> @llvm.sin.f16(<2 x half> %a)
1097 ; CHECK-LABEL: test_cos(
1098 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_cos_param_0];
1099 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1100 ; CHECK-DAG: cvt.f32.f16 [[AF0:%f[0-9]+]], [[A0]];
1101 ; CHECK-DAG: cvt.f32.f16 [[AF1:%f[0-9]+]], [[A1]];
1102 ; CHECK-DAG: cos.approx.f32 [[RF0:%f[0-9]+]], [[AF0]];
1103 ; CHECK-DAG: cos.approx.f32 [[RF1:%f[0-9]+]], [[AF1]];
1104 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
1105 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
1106 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1107 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1109 define <2 x half> @test_cos(<2 x half> %a) #0 #1 {
1110 %r = call <2 x half> @llvm.cos.f16(<2 x half> %a)
1114 ;;; Can't do this yet: requires libcall.
1115 ; XCHECK-LABEL: test_pow(
1116 ;define <2 x half> @test_pow(<2 x half> %a, <2 x half> %b) #0 {
1117 ; %r = call <2 x half> @llvm.pow.f16(<2 x half> %a, <2 x half> %b)
1121 ;;; Can't do this yet: requires libcall.
1122 ; XCHECK-LABEL: test_exp(
1123 ;define <2 x half> @test_exp(<2 x half> %a) #0 {
1124 ; %r = call <2 x half> @llvm.exp.f16(<2 x half> %a)
1128 ;;; Can't do this yet: requires libcall.
1129 ; XCHECK-LABEL: test_exp2(
1130 ;define <2 x half> @test_exp2(<2 x half> %a) #0 {
1131 ; %r = call <2 x half> @llvm.exp2.f16(<2 x half> %a)
1135 ;;; Can't do this yet: requires libcall.
1136 ; XCHECK-LABEL: test_log(
1137 ;define <2 x half> @test_log(<2 x half> %a) #0 {
1138 ; %r = call <2 x half> @llvm.log.f16(<2 x half> %a)
1142 ;;; Can't do this yet: requires libcall.
1143 ; XCHECK-LABEL: test_log10(
1144 ;define <2 x half> @test_log10(<2 x half> %a) #0 {
1145 ; %r = call <2 x half> @llvm.log10.f16(<2 x half> %a)
1149 ;;; Can't do this yet: requires libcall.
1150 ; XCHECK-LABEL: test_log2(
1151 ;define <2 x half> @test_log2(<2 x half> %a) #0 {
1152 ; %r = call <2 x half> @llvm.log2.f16(<2 x half> %a)
1156 ; CHECK-LABEL: test_fma(
1157 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fma_param_0];
1158 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fma_param_1];
1159 ; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_fma_param_2];
1161 ; CHECK-F16: fma.rn.f16x2 [[R:%r[0-9]+]], [[A]], [[B]], [[C]];
1163 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1164 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
1165 ; CHECK-NOF16-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
1166 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
1167 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
1168 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC0:%f[0-9]+]], [[C0]]
1169 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
1170 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
1171 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC0:%f[0-9]+]], [[C0]]
1172 ; CHECK-NOF16-DAG: fma.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]], [[FC0]];
1173 ; CHECK-NOF16-DAG: fma.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]], [[FC1]];
1174 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
1175 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
1176 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1178 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1180 define <2 x half> @test_fma(<2 x half> %a, <2 x half> %b, <2 x half> %c) #0 {
1181 %r = call <2 x half> @llvm.fma.f16(<2 x half> %a, <2 x half> %b, <2 x half> %c)
1185 ; CHECK-LABEL: test_fabs(
1186 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_fabs_param_0];
1187 ; CHECK: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1188 ; CHECK-DAG: cvt.f32.f16 [[AF0:%f[0-9]+]], [[A0]];
1189 ; CHECK-DAG: cvt.f32.f16 [[AF1:%f[0-9]+]], [[A1]];
1190 ; CHECK-DAG: abs.f32 [[RF0:%f[0-9]+]], [[AF0]];
1191 ; CHECK-DAG: abs.f32 [[RF1:%f[0-9]+]], [[AF1]];
1192 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
1193 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
1194 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1195 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1197 define <2 x half> @test_fabs(<2 x half> %a) #0 {
1198 %r = call <2 x half> @llvm.fabs.f16(<2 x half> %a)
1202 ; CHECK-LABEL: test_minnum(
1203 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_minnum_param_0];
1204 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_minnum_param_1];
1205 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1206 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
1207 ; CHECK-DAG: cvt.f32.f16 [[AF0:%f[0-9]+]], [[A0]];
1208 ; CHECK-DAG: cvt.f32.f16 [[AF1:%f[0-9]+]], [[A1]];
1209 ; CHECK-DAG: cvt.f32.f16 [[BF0:%f[0-9]+]], [[B0]];
1210 ; CHECK-DAG: cvt.f32.f16 [[BF1:%f[0-9]+]], [[B1]];
1211 ; CHECK-DAG: min.f32 [[RF0:%f[0-9]+]], [[AF0]], [[BF0]];
1212 ; CHECK-DAG: min.f32 [[RF1:%f[0-9]+]], [[AF1]], [[BF1]];
1213 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
1214 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
1215 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1216 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1218 define <2 x half> @test_minnum(<2 x half> %a, <2 x half> %b) #0 {
1219 %r = call <2 x half> @llvm.minnum.f16(<2 x half> %a, <2 x half> %b)
1223 ; CHECK-LABEL: test_maxnum(
1224 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_maxnum_param_0];
1225 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_maxnum_param_1];
1226 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1227 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
1228 ; CHECK-DAG: cvt.f32.f16 [[AF0:%f[0-9]+]], [[A0]];
1229 ; CHECK-DAG: cvt.f32.f16 [[AF1:%f[0-9]+]], [[A1]];
1230 ; CHECK-DAG: cvt.f32.f16 [[BF0:%f[0-9]+]], [[B0]];
1231 ; CHECK-DAG: cvt.f32.f16 [[BF1:%f[0-9]+]], [[B1]];
1232 ; CHECK-DAG: max.f32 [[RF0:%f[0-9]+]], [[AF0]], [[BF0]];
1233 ; CHECK-DAG: max.f32 [[RF1:%f[0-9]+]], [[AF1]], [[BF1]];
1234 ; CHECK-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[RF0]];
1235 ; CHECK-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[RF1]];
1236 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1237 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1239 define <2 x half> @test_maxnum(<2 x half> %a, <2 x half> %b) #0 {
1240 %r = call <2 x half> @llvm.maxnum.f16(<2 x half> %a, <2 x half> %b)
1244 ; CHECK-LABEL: test_copysign(
1245 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_copysign_param_0];
1246 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_copysign_param_1];
1247 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1248 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
1249 ; CHECK-DAG: and.b16 [[AX0:%rs[0-9]+]], [[A0]], 32767;
1250 ; CHECK-DAG: and.b16 [[AX1:%rs[0-9]+]], [[A1]], 32767;
1251 ; CHECK-DAG: and.b16 [[BX0:%rs[0-9]+]], [[B0]], -32768;
1252 ; CHECK-DAG: and.b16 [[BX1:%rs[0-9]+]], [[B1]], -32768;
1253 ; CHECK-DAG: or.b16 [[R0:%rs[0-9]+]], [[AX0]], [[BX0]];
1254 ; CHECK-DAG: or.b16 [[R1:%rs[0-9]+]], [[AX1]], [[BX1]];
1255 ; CHECK-DAG: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1256 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1258 define <2 x half> @test_copysign(<2 x half> %a, <2 x half> %b) #0 {
1259 %r = call <2 x half> @llvm.copysign.f16(<2 x half> %a, <2 x half> %b)
1263 ; CHECK-LABEL: test_copysign_f32(
1264 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_copysign_f32_param_0];
1265 ; CHECK-DAG: ld.param.v2.f32 {[[B0:%f[0-9]+]], [[B1:%f[0-9]+]]}, [test_copysign_f32_param_1];
1266 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1267 ; CHECK-DAG: mov.b32 [[BI0:%r[0-9]+]], [[B0]];
1268 ; CHECK-DAG: mov.b32 [[BI1:%r[0-9]+]], [[B1]];
1269 ; CHECK-DAG: and.b16 [[AI0:%rs[0-9]+]], [[A0]], 32767;
1270 ; CHECK-DAG: and.b16 [[AI1:%rs[0-9]+]], [[A1]], 32767;
1271 ; CHECK-DAG: and.b32 [[BX0:%r[0-9]+]], [[BI0]], -2147483648;
1272 ; CHECK-DAG: and.b32 [[BX1:%r[0-9]+]], [[BI1]], -2147483648;
1273 ; CHECK-DAG: mov.b32 {tmp, [[BZ0:%rs[0-9]+]]}, [[BX0]]; }
1274 ; CHECK-DAG: mov.b32 {tmp, [[BZ1:%rs[0-9]+]]}, [[BX1]]; }
1275 ; CHECK-DAG: or.b16 [[R0:%rs[0-9]+]], [[AI0]], [[BZ0]];
1276 ; CHECK-DAG: or.b16 [[R1:%rs[0-9]+]], [[AI1]], [[BZ1]];
1277 ; CHECK-DAG: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1278 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1280 define <2 x half> @test_copysign_f32(<2 x half> %a, <2 x float> %b) #0 {
1281 %tb = fptrunc <2 x float> %b to <2 x half>
1282 %r = call <2 x half> @llvm.copysign.f16(<2 x half> %a, <2 x half> %tb)
1286 ; CHECK-LABEL: test_copysign_f64(
1287 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_copysign_f64_param_0];
1288 ; CHECK-DAG: ld.param.v2.f64 {[[B0:%fd[0-9]+]], [[B1:%fd[0-9]+]]}, [test_copysign_f64_param_1];
1289 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1290 ; CHECK-DAG: mov.b64 [[BI0:%rd[0-9]+]], [[B0]];
1291 ; CHECK-DAG: mov.b64 [[BI1:%rd[0-9]+]], [[B1]];
1292 ; CHECK-DAG: and.b16 [[AI0:%rs[0-9]+]], [[A0]], 32767;
1293 ; CHECK-DAG: and.b16 [[AI1:%rs[0-9]+]], [[A1]], 32767;
1294 ; CHECK-DAG: and.b64 [[BX0:%rd[0-9]+]], [[BI0]], -9223372036854775808;
1295 ; CHECK-DAG: and.b64 [[BX1:%rd[0-9]+]], [[BI1]], -9223372036854775808;
1296 ; CHECK-DAG: shr.u64 [[BY0:%rd[0-9]+]], [[BX0]], 48;
1297 ; CHECK-DAG: shr.u64 [[BY1:%rd[0-9]+]], [[BX1]], 48;
1298 ; CHECK-DAG: cvt.u16.u64 [[BZ0:%rs[0-9]+]], [[BY0]];
1299 ; CHECK-DAG: cvt.u16.u64 [[BZ1:%rs[0-9]+]], [[BY1]];
1300 ; CHECK-DAG: or.b16 [[R0:%rs[0-9]+]], [[AI0]], [[BZ0]];
1301 ; CHECK-DAG: or.b16 [[R1:%rs[0-9]+]], [[AI1]], [[BZ1]];
1302 ; CHECK-DAG: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1303 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1305 define <2 x half> @test_copysign_f64(<2 x half> %a, <2 x double> %b) #0 {
1306 %tb = fptrunc <2 x double> %b to <2 x half>
1307 %r = call <2 x half> @llvm.copysign.f16(<2 x half> %a, <2 x half> %tb)
1311 ; CHECK-LABEL: test_copysign_extended(
1312 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_copysign_extended_param_0];
1313 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_copysign_extended_param_1];
1314 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1315 ; CHECK-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
1316 ; CHECK-DAG: and.b16 [[AX0:%rs[0-9]+]], [[A0]], 32767;
1317 ; CHECK-DAG: and.b16 [[AX1:%rs[0-9]+]], [[A1]], 32767;
1318 ; CHECK-DAG: and.b16 [[BX0:%rs[0-9]+]], [[B0]], -32768;
1319 ; CHECK-DAG: and.b16 [[BX1:%rs[0-9]+]], [[B1]], -32768;
1320 ; CHECK-DAG: or.b16 [[R0:%rs[0-9]+]], [[AX0]], [[BX0]];
1321 ; CHECK-DAG: or.b16 [[R1:%rs[0-9]+]], [[AX1]], [[BX1]];
1322 ; CHECK-DAG: cvt.f32.f16 [[XR0:%f[0-9]+]], [[R0]];
1323 ; CHECK-DAG: cvt.f32.f16 [[XR1:%f[0-9]+]], [[R1]];
1324 ; CHECK: st.param.v2.f32 [func_retval0+0], {[[XR0]], [[XR1]]};
1326 define <2 x float> @test_copysign_extended(<2 x half> %a, <2 x half> %b) #0 {
1327 %r = call <2 x half> @llvm.copysign.f16(<2 x half> %a, <2 x half> %b)
1328 %xr = fpext <2 x half> %r to <2 x float>
1332 ; CHECK-LABEL: test_floor(
1333 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_floor_param_0];
1334 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
1335 ; CHECK-DAG: cvt.rmi.f16.f16 [[R1:%rs[0-9]+]], [[A1]];
1336 ; CHECK-DAG: cvt.rmi.f16.f16 [[R0:%rs[0-9]+]], [[A0]];
1337 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1338 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1340 define <2 x half> @test_floor(<2 x half> %a) #0 {
1341 %r = call <2 x half> @llvm.floor.f16(<2 x half> %a)
1345 ; CHECK-LABEL: test_ceil(
1346 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_ceil_param_0];
1347 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
1348 ; CHECK-DAG: cvt.rpi.f16.f16 [[R1:%rs[0-9]+]], [[A1]];
1349 ; CHECK-DAG: cvt.rpi.f16.f16 [[R0:%rs[0-9]+]], [[A0]];
1350 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1351 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1353 define <2 x half> @test_ceil(<2 x half> %a) #0 {
1354 %r = call <2 x half> @llvm.ceil.f16(<2 x half> %a)
1358 ; CHECK-LABEL: test_trunc(
1359 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_trunc_param_0];
1360 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
1361 ; CHECK-DAG: cvt.rzi.f16.f16 [[R1:%rs[0-9]+]], [[A1]];
1362 ; CHECK-DAG: cvt.rzi.f16.f16 [[R0:%rs[0-9]+]], [[A0]];
1363 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1364 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1366 define <2 x half> @test_trunc(<2 x half> %a) #0 {
1367 %r = call <2 x half> @llvm.trunc.f16(<2 x half> %a)
1371 ; CHECK-LABEL: test_rint(
1372 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_rint_param_0];
1373 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
1374 ; CHECK-DAG: cvt.rni.f16.f16 [[R1:%rs[0-9]+]], [[A1]];
1375 ; CHECK-DAG: cvt.rni.f16.f16 [[R0:%rs[0-9]+]], [[A0]];
1376 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1377 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1379 define <2 x half> @test_rint(<2 x half> %a) #0 {
1380 %r = call <2 x half> @llvm.rint.f16(<2 x half> %a)
1384 ; CHECK-LABEL: test_nearbyint(
1385 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_nearbyint_param_0];
1386 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
1387 ; CHECK-DAG: cvt.rni.f16.f16 [[R1:%rs[0-9]+]], [[A1]];
1388 ; CHECK-DAG: cvt.rni.f16.f16 [[R0:%rs[0-9]+]], [[A0]];
1389 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1390 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1392 define <2 x half> @test_nearbyint(<2 x half> %a) #0 {
1393 %r = call <2 x half> @llvm.nearbyint.f16(<2 x half> %a)
1397 ; CHECK-LABEL: test_roundeven(
1398 ; CHECK: ld.param.b32 [[A:%r[0-9]+]], [test_roundeven_param_0];
1399 ; CHECK-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]];
1400 ; CHECK-DAG: cvt.rni.f16.f16 [[R1:%rs[0-9]+]], [[A1]];
1401 ; CHECK-DAG: cvt.rni.f16.f16 [[R0:%rs[0-9]+]], [[A0]];
1402 ; CHECK: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1403 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1405 define <2 x half> @test_roundeven(<2 x half> %a) #0 {
1406 %r = call <2 x half> @llvm.roundeven.f16(<2 x half> %a)
1410 ; CHECK-LABEL: test_round(
1411 ; CHECK: ld.param.b32 {{.*}}, [test_round_param_0];
1412 ; check the use of sign mask and 0.5 to implement round
1413 ; CHECK: and.b32 [[R1:%r[0-9]+]], {{.*}}, -2147483648;
1414 ; CHECK: or.b32 {{.*}}, [[R1]], 1056964608;
1415 ; CHECK: and.b32 [[R2:%r[0-9]+]], {{.*}}, -2147483648;
1416 ; CHECK: or.b32 {{.*}}, [[R2]], 1056964608;
1417 ; CHECK: st.param.b32 [func_retval0+0], {{.*}};
1419 define <2 x half> @test_round(<2 x half> %a) #0 {
1420 %r = call <2 x half> @llvm.round.f16(<2 x half> %a)
1424 ; CHECK-LABEL: test_fmuladd(
1425 ; CHECK-DAG: ld.param.b32 [[A:%r[0-9]+]], [test_fmuladd_param_0];
1426 ; CHECK-DAG: ld.param.b32 [[B:%r[0-9]+]], [test_fmuladd_param_1];
1427 ; CHECK-DAG: ld.param.b32 [[C:%r[0-9]+]], [test_fmuladd_param_2];
1429 ; CHECK-F16: fma.rn.f16x2 [[R:%r[0-9]+]], [[A]], [[B]], [[C]];
1431 ; CHECK-NOF16-DAG: mov.b32 {[[A0:%rs[0-9]+]], [[A1:%rs[0-9]+]]}, [[A]]
1432 ; CHECK-NOF16-DAG: mov.b32 {[[B0:%rs[0-9]+]], [[B1:%rs[0-9]+]]}, [[B]]
1433 ; CHECK-NOF16-DAG: mov.b32 {[[C0:%rs[0-9]+]], [[C1:%rs[0-9]+]]}, [[C]]
1434 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA0:%f[0-9]+]], [[A0]]
1435 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB0:%f[0-9]+]], [[B0]]
1436 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC0:%f[0-9]+]], [[C0]]
1437 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FA1:%f[0-9]+]], [[A1]]
1438 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FB1:%f[0-9]+]], [[B1]]
1439 ; CHECK-NOF16-DAG: cvt.f32.f16 [[FC0:%f[0-9]+]], [[C0]]
1440 ; CHECK-NOF16-DAG: fma.rn.f32 [[FR0:%f[0-9]+]], [[FA0]], [[FB0]], [[FC0]];
1441 ; CHECK-NOF16-DAG: fma.rn.f32 [[FR1:%f[0-9]+]], [[FA1]], [[FB1]], [[FC1]];
1442 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R0:%rs[0-9]+]], [[FR0]]
1443 ; CHECK-NOF16-DAG: cvt.rn.f16.f32 [[R1:%rs[0-9]+]], [[FR1]]
1444 ; CHECK-NOF16: mov.b32 [[R:%r[0-9]+]], {[[R0]], [[R1]]}
1446 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
1448 define <2 x half> @test_fmuladd(<2 x half> %a, <2 x half> %b, <2 x half> %c) #0 {
1449 %r = call <2 x half> @llvm.fmuladd.f16(<2 x half> %a, <2 x half> %b, <2 x half> %c)
1453 ; CHECK-LABEL: test_shufflevector(
1454 ; CHECK: mov.b32 {%rs1, %rs2}, %r1;
1455 ; CHECK: mov.b32 %r2, {%rs2, %rs1};
1456 define <2 x half> @test_shufflevector(<2 x half> %a) #0 {
1457 %s = shufflevector <2 x half> %a, <2 x half> undef, <2 x i32> <i32 1, i32 0>
1461 ; CHECK-LABEL: test_insertelement(
1462 ; CHECK: mov.b32 {%rs2, tmp}, %r1;
1463 ; CHECK: mov.b32 %r2, {%rs2, %rs1};
1464 define <2 x half> @test_insertelement(<2 x half> %a, half %x) #0 {
1465 %i = insertelement <2 x half> %a, half %x, i64 1
1469 ; CHECK-LABEL: test_sitofp_2xi16_to_2xhalf(
1470 ; CHECK: cvt.rn.f16.s16
1471 ; CHECK: cvt.rn.f16.s16
1473 define <2 x half> @test_sitofp_2xi16_to_2xhalf(<2 x i16> %a) #0 {
1474 %r = sitofp <2 x i16> %a to <2 x half>
1478 ; CHECK-LABEL: test_uitofp_2xi16_to_2xhalf(
1479 ; CHECK: cvt.rn.f16.u16
1480 ; CHECK: cvt.rn.f16.u16
1482 define <2 x half> @test_uitofp_2xi16_to_2xhalf(<2 x i16> %a) #0 {
1483 %r = uitofp <2 x i16> %a to <2 x half>
1487 attributes #0 = { nounwind }
1488 attributes #1 = { "unsafe-fp-math" = "true" }