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 \
5 ; RUN: | FileCheck -check-prefixes CHECK,CHECK-NOFTZ,CHECK-F16-NOFTZ %s
7 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
8 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
10 ; RUN: | %ptxas-verify -arch=sm_53 \
12 ; ## Full FP16 with FTZ
13 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
14 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
15 ; RUN: -denormal-fp-math-f32=preserve-sign -mattr=+ptx60 \
16 ; RUN: | FileCheck -check-prefixes CHECK,CHECK-F16-FTZ %s
18 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
19 ; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
20 ; RUN: -denormal-fp-math-f32=preserve-sign -mattr=+ptx60 \
21 ; RUN: | %ptxas-verify -arch=sm_53 \
23 ; ## FP16 support explicitly disabled.
24 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
25 ; RUN: -O0 -disable-post-ra -frame-pointer=all --nvptx-no-f16-math \
26 ; RUN: -verify-machineinstrs -mattr=+ptx60 \
27 ; RUN: | FileCheck -check-prefixes CHECK,CHECK-NOFTZ,CHECK-NOF16 %s
29 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_53 -asm-verbose=false \
30 ; RUN: -O0 -disable-post-ra -frame-pointer=all --nvptx-no-f16-math \
31 ; RUN: | %ptxas-verify -arch=sm_53 \
33 ; ## FP16 is not supported by hardware.
34 ; RUN: llc < %s -O0 -mtriple=nvptx64-nvidia-cuda -mcpu=sm_52 -asm-verbose=false \
35 ; RUN: -disable-post-ra -frame-pointer=all -verify-machineinstrs \
36 ; RUN: | FileCheck -check-prefixes CHECK,CHECK-NOFTZ,CHECK-NOF16 %s
38 ; RUN: llc < %s -O0 -mtriple=nvptx64-nvidia-cuda -mcpu=sm_52 -asm-verbose=false \
39 ; RUN: -disable-post-ra -frame-pointer=all -verify-machineinstrs \
40 ; RUN: | %ptxas-verify -arch=sm_52 \
43 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
45 ; CHECK-LABEL: test_ret_const(
46 ; CHECK: mov.b16 [[R:%rs[0-9]+]], 0x3C00;
47 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
49 define half @test_ret_const() #0 {
53 ; CHECK-LABEL: test_fadd(
54 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fadd_param_0];
55 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fadd_param_1];
56 ; CHECK-F16-NOFTZ-NEXT: add.rn.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
57 ; CHECK-F16-FTZ-NEXT: add.rn.ftz.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
58 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
59 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
60 ; CHECK-NOF16-NEXT: add.rn.f32 [[R32:%f[0-9]+]], [[A32]], [[B32]];
61 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
62 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
64 define half @test_fadd(half %a, half %b) #0 {
69 ; CHECK-LABEL: test_fadd_v1f16(
70 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fadd_v1f16_param_0];
71 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fadd_v1f16_param_1];
72 ; CHECK-F16-NOFTZ-NEXT: add.rn.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
73 ; CHECK-F16-FTZ-NEXT: add.rn.ftz.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
74 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
75 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
76 ; CHECK-NOF16-NEXT: add.rn.f32 [[R32:%f[0-9]+]], [[A32]], [[B32]];
77 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
78 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
80 define <1 x half> @test_fadd_v1f16(<1 x half> %a, <1 x half> %b) #0 {
81 %r = fadd <1 x half> %a, %b
85 ; Check that we can lower fadd with immediate arguments.
86 ; CHECK-LABEL: test_fadd_imm_0(
87 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fadd_imm_0_param_0];
88 ; CHECK-F16-NOFTZ-DAG: mov.b16 [[A:%rs[0-9]+]], 0x3C00;
89 ; CHECK-F16-NOFTZ-NEXT: add.rn.f16 [[R:%rs[0-9]+]], [[B]], [[A]];
90 ; CHECK-F16-FTZ-DAG: mov.b16 [[A:%rs[0-9]+]], 0x3C00;
91 ; CHECK-F16-FTZ-NEXT: add.rn.ftz.f16 [[R:%rs[0-9]+]], [[B]], [[A]];
92 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
93 ; CHECK-NOF16-NEXT: add.rn.f32 [[R32:%f[0-9]+]], [[B32]], 0f3F800000;
94 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
95 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
97 define half @test_fadd_imm_0(half %b) #0 {
98 %r = fadd half 1.0, %b
102 ; CHECK-LABEL: test_fadd_imm_1(
103 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fadd_imm_1_param_0];
104 ; CHECK-F16-NOFTZ-DAG: mov.b16 [[A:%rs[0-9]+]], 0x3C00;
105 ; CHECK-F16-NOFTZ-NEXT: add.rn.f16 [[R:%rs[0-9]+]], [[B]], [[A]];
106 ; CHECK-F16-FTZ-DAG: mov.b16 [[A:%rs[0-9]+]], 0x3C00;
107 ; CHECK-F16-FTZ-NEXT: add.rn.ftz.f16 [[R:%rs[0-9]+]], [[B]], [[A]];
108 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
109 ; CHECK-NOF16-NEXT: add.rn.f32 [[R32:%f[0-9]+]], [[B32]], 0f3F800000;
110 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
111 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
113 define half @test_fadd_imm_1(half %a) #0 {
114 %r = fadd half %a, 1.0
118 ; CHECK-LABEL: test_fsub(
119 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fsub_param_0];
120 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fsub_param_1];
121 ; CHECK-F16-NOFTZ-NEXT: sub.rn.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
122 ; CHECK-F16-FTZ-NEXT: sub.rn.ftz.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
123 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
124 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
125 ; CHECK-NOF16-NEXT: sub.rn.f32 [[R32:%f[0-9]+]], [[A32]], [[B32]];
126 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
127 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
129 define half @test_fsub(half %a, half %b) #0 {
130 %r = fsub half %a, %b
134 ; CHECK-LABEL: test_fneg(
135 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fneg_param_0];
136 ; CHECK-F16-NOFTZ-NEXT: mov.b16 [[Z:%rs[0-9]+]], 0x0000
137 ; CHECK-F16-NOFTZ-NEXT: sub.rn.f16 [[R:%rs[0-9]+]], [[Z]], [[A]];
138 ; CHECK-F16-FTZ-NEXT: mov.b16 [[Z:%rs[0-9]+]], 0x0000
139 ; CHECK-F16-FTZ-NEXT: sub.rn.ftz.f16 [[R:%rs[0-9]+]], [[Z]], [[A]];
140 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
141 ; CHECK-NOF16-DAG: mov.f32 [[Z:%f[0-9]+]], 0f00000000;
142 ; CHECK-NOF16-NEXT: sub.rn.f32 [[R32:%f[0-9]+]], [[Z]], [[A32]];
143 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
144 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
146 define half @test_fneg(half %a) #0 {
147 %r = fsub half 0.0, %a
151 ; CHECK-LABEL: test_fmul(
152 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fmul_param_0];
153 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fmul_param_1];
154 ; CHECK-F16-NOFTZ-NEXT: mul.rn.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
155 ; CHECK-F16-FTZ-NEXT: mul.rn.ftz.f16 [[R:%rs[0-9]+]], [[A]], [[B]];
156 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
157 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
158 ; CHECK-NOF16-NEXT: mul.rn.f32 [[R32:%f[0-9]+]], [[A32]], [[B32]];
159 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
160 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
162 define half @test_fmul(half %a, half %b) #0 {
163 %r = fmul half %a, %b
167 ; CHECK-LABEL: test_fdiv(
168 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fdiv_param_0];
169 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fdiv_param_1];
170 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[F0:%f[0-9]+]], [[A]];
171 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[F1:%f[0-9]+]], [[B]];
172 ; CHECK-NOFTZ-NEXT: div.rn.f32 [[FR:%f[0-9]+]], [[F0]], [[F1]];
173 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[F0:%f[0-9]+]], [[A]];
174 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[F1:%f[0-9]+]], [[B]];
175 ; CHECK-F16-FTZ-NEXT: div.rn.ftz.f32 [[FR:%f[0-9]+]], [[F0]], [[F1]];
176 ; CHECK-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[FR]];
177 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
179 define half @test_fdiv(half %a, half %b) #0 {
180 %r = fdiv half %a, %b
184 ; CHECK-LABEL: test_frem(
185 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_frem_param_0];
186 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_frem_param_1];
187 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[FA:%f[0-9]+]], [[A]];
188 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[FB:%f[0-9]+]], [[B]];
189 ; CHECK-NOFTZ-NEXT: div.rn.f32 [[D:%f[0-9]+]], [[FA]], [[FB]];
190 ; CHECK-NOFTZ-NEXT: cvt.rzi.f32.f32 [[DI:%f[0-9]+]], [[D]];
191 ; CHECK-NOFTZ-NEXT: mul.f32 [[RI:%f[0-9]+]], [[DI]], [[FB]];
192 ; CHECK-NOFTZ-NEXT: sub.f32 [[RF:%f[0-9]+]], [[FA]], [[RI]];
193 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[FA:%f[0-9]+]], [[A]];
194 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[FB:%f[0-9]+]], [[B]];
195 ; CHECK-F16-FTZ-NEXT: div.rn.ftz.f32 [[D:%f[0-9]+]], [[FA]], [[FB]];
196 ; CHECK-F16-FTZ-NEXT: cvt.rzi.ftz.f32.f32 [[DI:%f[0-9]+]], [[D]];
197 ; CHECK-F16-FTZ-NEXT: mul.ftz.f32 [[RI:%f[0-9]+]], [[DI]], [[FB]];
198 ; CHECK-F16-FTZ-NEXT: sub.ftz.f32 [[RF:%f[0-9]+]], [[FA]], [[RI]];
199 ; CHECK-NEXT: testp.infinite.f32 [[ISBINF:%p[0-9]+]], [[FB]];
200 ; CHECK-NEXT: selp.f32 [[RESULT:%f[0-9]+]], [[FA]], [[RF]], [[ISBINF]];
201 ; CHECK-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RESULT]];
202 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
204 define half @test_frem(half %a, half %b) #0 {
205 %r = frem half %a, %b
209 ; CHECK-LABEL: test_store(
210 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_store_param_0];
211 ; CHECK-DAG: ld.param.u64 %[[PTR:rd[0-9]+]], [test_store_param_1];
212 ; CHECK-NEXT: st.b16 [%[[PTR]]], [[A]];
214 define void @test_store(half %a, ptr %b) #0 {
215 store half %a, ptr %b
219 ; CHECK-LABEL: test_load(
220 ; CHECK: ld.param.u64 %[[PTR:rd[0-9]+]], [test_load_param_0];
221 ; CHECK-NEXT: ld.b16 [[R:%rs[0-9]+]], [%[[PTR]]];
222 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
224 define half @test_load(ptr %a) #0 {
225 %r = load half, ptr %a
229 ; CHECK-LABEL: .visible .func test_halfp0a1(
230 ; CHECK-DAG: ld.param.u64 %[[FROM:rd?[0-9]+]], [test_halfp0a1_param_0];
231 ; CHECK-DAG: ld.param.u64 %[[TO:rd?[0-9]+]], [test_halfp0a1_param_1];
232 ; CHECK-DAG: ld.u8 [[B0:%r[sd]?[0-9]+]], [%[[FROM]]]
233 ; CHECK-DAG: st.u8 [%[[TO]]], [[B0]]
234 ; CHECK-DAG: ld.u8 [[B1:%r[sd]?[0-9]+]], [%[[FROM]]+1]
235 ; CHECK-DAG: st.u8 [%[[TO]]+1], [[B1]]
237 define void @test_halfp0a1(ptr noalias readonly %from, ptr %to) {
238 %1 = load half, ptr %from , align 1
239 store half %1, ptr %to , align 1
243 declare half @test_callee(half %a, half %b) #0
245 ; CHECK-LABEL: test_call(
246 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_call_param_0];
247 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_call_param_1];
249 ; CHECK-DAG: .param .align 2 .b8 param0[2];
250 ; CHECK-DAG: .param .align 2 .b8 param1[2];
251 ; CHECK-DAG: st.param.b16 [param0+0], [[A]];
252 ; CHECK-DAG: st.param.b16 [param1+0], [[B]];
253 ; CHECK-DAG: .param .align 2 .b8 retval0[2];
254 ; CHECK: call.uni (retval0),
255 ; CHECK-NEXT: test_callee,
257 ; CHECK-NEXT: ld.param.b16 [[R:%rs[0-9]+]], [retval0+0];
259 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
261 define half @test_call(half %a, half %b) #0 {
262 %r = call half @test_callee(half %a, half %b)
266 ; CHECK-LABEL: test_call_flipped(
267 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_call_flipped_param_0];
268 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_call_flipped_param_1];
270 ; CHECK-DAG: .param .align 2 .b8 param0[2];
271 ; CHECK-DAG: .param .align 2 .b8 param1[2];
272 ; CHECK-DAG: st.param.b16 [param0+0], [[B]];
273 ; CHECK-DAG: st.param.b16 [param1+0], [[A]];
274 ; CHECK-DAG: .param .align 2 .b8 retval0[2];
275 ; CHECK: call.uni (retval0),
276 ; CHECK-NEXT: test_callee,
278 ; CHECK-NEXT: ld.param.b16 [[R:%rs[0-9]+]], [retval0+0];
280 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
282 define half @test_call_flipped(half %a, half %b) #0 {
283 %r = call half @test_callee(half %b, half %a)
287 ; CHECK-LABEL: test_tailcall_flipped(
288 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_tailcall_flipped_param_0];
289 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_tailcall_flipped_param_1];
291 ; CHECK-DAG: .param .align 2 .b8 param0[2];
292 ; CHECK-DAG: .param .align 2 .b8 param1[2];
293 ; CHECK-DAG: st.param.b16 [param0+0], [[B]];
294 ; CHECK-DAG: st.param.b16 [param1+0], [[A]];
295 ; CHECK-DAG: .param .align 2 .b8 retval0[2];
296 ; CHECK: call.uni (retval0),
297 ; CHECK-NEXT: test_callee,
299 ; CHECK-NEXT: ld.param.b16 [[R:%rs[0-9]+]], [retval0+0];
301 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
303 define half @test_tailcall_flipped(half %a, half %b) #0 {
304 %r = tail call half @test_callee(half %b, half %a)
308 ; CHECK-LABEL: test_select(
309 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_select_param_0];
310 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_select_param_1];
311 ; CHECK-DAG: setp.eq.b16 [[PRED:%p[0-9]+]], %rs{{.*}}, 1;
312 ; CHECK-NEXT: selp.b16 [[R:%rs[0-9]+]], [[A]], [[B]], [[PRED]];
313 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
315 define half @test_select(half %a, half %b, i1 zeroext %c) #0 {
316 %r = select i1 %c, half %a, half %b
320 ; CHECK-LABEL: test_select_cc(
321 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_select_cc_param_0];
322 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_select_cc_param_1];
323 ; CHECK-DAG: ld.param.b16 [[C:%rs[0-9]+]], [test_select_cc_param_2];
324 ; CHECK-DAG: ld.param.b16 [[D:%rs[0-9]+]], [test_select_cc_param_3];
325 ; CHECK-F16-NOFTZ: setp.neu.f16 [[PRED:%p[0-9]+]], [[C]], [[D]]
326 ; CHECK-NOF16-DAG: cvt.f32.f16 [[DF:%f[0-9]+]], [[D]];
327 ; CHECK-NOF16-DAG: cvt.f32.f16 [[CF:%f[0-9]+]], [[C]];
328 ; CHECK-NOF16: setp.neu.f32 [[PRED:%p[0-9]+]], [[CF]], [[DF]]
329 ; CHECK: selp.b16 [[R:%rs[0-9]+]], [[A]], [[B]], [[PRED]];
330 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
332 define half @test_select_cc(half %a, half %b, half %c, half %d) #0 {
333 %cc = fcmp une half %c, %d
334 %r = select i1 %cc, half %a, half %b
338 ; CHECK-LABEL: test_select_cc_f32_f16(
339 ; CHECK-DAG: ld.param.f32 [[A:%f[0-9]+]], [test_select_cc_f32_f16_param_0];
340 ; CHECK-DAG: ld.param.f32 [[B:%f[0-9]+]], [test_select_cc_f32_f16_param_1];
341 ; CHECK-DAG: ld.param.b16 [[C:%rs[0-9]+]], [test_select_cc_f32_f16_param_2];
342 ; CHECK-DAG: ld.param.b16 [[D:%rs[0-9]+]], [test_select_cc_f32_f16_param_3];
343 ; CHECK-F16-NOFTZ: setp.neu.f16 [[PRED:%p[0-9]+]], [[C]], [[D]]
344 ; CHECK-F16-FTZ: setp.neu.ftz.f16 [[PRED:%p[0-9]+]], [[C]], [[D]]
345 ; CHECK-NOF16-DAG: cvt.f32.f16 [[DF:%f[0-9]+]], [[D]];
346 ; CHECK-NOF16-DAG: cvt.f32.f16 [[CF:%f[0-9]+]], [[C]];
347 ; CHECK-NOF16: setp.neu.f32 [[PRED:%p[0-9]+]], [[CF]], [[DF]]
348 ; CHECK-NEXT: selp.f32 [[R:%f[0-9]+]], [[A]], [[B]], [[PRED]];
349 ; CHECK-NEXT: st.param.f32 [func_retval0+0], [[R]];
351 define float @test_select_cc_f32_f16(float %a, float %b, half %c, half %d) #0 {
352 %cc = fcmp une half %c, %d
353 %r = select i1 %cc, float %a, float %b
357 ; CHECK-LABEL: test_select_cc_f16_f32(
358 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_select_cc_f16_f32_param_0];
359 ; CHECK-DAG: ld.param.f32 [[C:%f[0-9]+]], [test_select_cc_f16_f32_param_2];
360 ; CHECK-DAG: ld.param.f32 [[D:%f[0-9]+]], [test_select_cc_f16_f32_param_3];
361 ; CHECK-NOFTZ-DAG: setp.neu.f32 [[PRED:%p[0-9]+]], [[C]], [[D]]
362 ; CHECK-F16-FTZ-DAG: setp.neu.ftz.f32 [[PRED:%p[0-9]+]], [[C]], [[D]]
363 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_select_cc_f16_f32_param_1];
364 ; CHECK-NEXT: selp.b16 [[R:%rs[0-9]+]], [[A]], [[B]], [[PRED]];
365 ; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
367 define half @test_select_cc_f16_f32(half %a, half %b, float %c, float %d) #0 {
368 %cc = fcmp une float %c, %d
369 %r = select i1 %cc, half %a, half %b
373 ; CHECK-LABEL: test_fcmp_une(
374 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_une_param_0];
375 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_une_param_1];
376 ; CHECK-F16-NOFTZ: setp.neu.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
377 ; CHECK-F16-FTZ: setp.neu.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
378 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
379 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
380 ; CHECK-NOF16: setp.neu.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
381 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
382 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
384 define i1 @test_fcmp_une(half %a, half %b) #0 {
385 %r = fcmp une half %a, %b
389 ; CHECK-LABEL: test_fcmp_ueq(
390 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ueq_param_0];
391 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ueq_param_1];
392 ; CHECK-F16-NOFTZ: setp.equ.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
393 ; CHECK-F16-FTZ: setp.equ.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
394 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
395 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
396 ; CHECK-NOF16: setp.equ.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
397 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
398 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
400 define i1 @test_fcmp_ueq(half %a, half %b) #0 {
401 %r = fcmp ueq half %a, %b
405 ; CHECK-LABEL: test_fcmp_ugt(
406 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ugt_param_0];
407 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ugt_param_1];
408 ; CHECK-F16-NOFTZ: setp.gtu.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
409 ; CHECK-F16-FTZ: setp.gtu.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
410 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
411 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
412 ; CHECK-NOF16: setp.gtu.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
413 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
414 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
416 define i1 @test_fcmp_ugt(half %a, half %b) #0 {
417 %r = fcmp ugt half %a, %b
421 ; CHECK-LABEL: test_fcmp_uge(
422 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_uge_param_0];
423 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_uge_param_1];
424 ; CHECK-F16-NOFTZ: setp.geu.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
425 ; CHECK-F16-FTZ: setp.geu.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
426 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
427 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
428 ; CHECK-NOF16: setp.geu.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
429 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
430 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
432 define i1 @test_fcmp_uge(half %a, half %b) #0 {
433 %r = fcmp uge half %a, %b
437 ; CHECK-LABEL: test_fcmp_ult(
438 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ult_param_0];
439 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ult_param_1];
440 ; CHECK-F16-NOFTZ: setp.ltu.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
441 ; CHECK-F16-FTZ: setp.ltu.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
442 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
443 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
444 ; CHECK-NOF16: setp.ltu.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
445 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
446 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
448 define i1 @test_fcmp_ult(half %a, half %b) #0 {
449 %r = fcmp ult half %a, %b
453 ; CHECK-LABEL: test_fcmp_ule(
454 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ule_param_0];
455 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ule_param_1];
456 ; CHECK-F16-NOFTZ: setp.leu.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
457 ; CHECK-F16-FTZ: setp.leu.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
458 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
459 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
460 ; CHECK-NOF16: setp.leu.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
461 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
462 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
464 define i1 @test_fcmp_ule(half %a, half %b) #0 {
465 %r = fcmp ule half %a, %b
470 ; CHECK-LABEL: test_fcmp_uno(
471 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_uno_param_0];
472 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_uno_param_1];
473 ; CHECK-F16-NOFTZ: setp.nan.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
474 ; CHECK-F16-FTZ: setp.nan.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
475 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
476 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
477 ; CHECK-NOF16: setp.nan.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
478 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
479 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
481 define i1 @test_fcmp_uno(half %a, half %b) #0 {
482 %r = fcmp uno half %a, %b
486 ; CHECK-LABEL: test_fcmp_one(
487 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_one_param_0];
488 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_one_param_1];
489 ; CHECK-F16-NOFTZ: setp.ne.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
490 ; CHECK-F16-FTZ: setp.ne.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
491 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
492 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
493 ; CHECK-NOF16: setp.ne.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
494 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
495 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
497 define i1 @test_fcmp_one(half %a, half %b) #0 {
498 %r = fcmp one half %a, %b
502 ; CHECK-LABEL: test_fcmp_oeq(
503 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_oeq_param_0];
504 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_oeq_param_1];
505 ; CHECK-F16-NOFTZ: setp.eq.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
506 ; CHECK-F16-FTZ: setp.eq.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
507 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
508 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
509 ; CHECK-NOF16: setp.eq.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
510 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
511 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
513 define i1 @test_fcmp_oeq(half %a, half %b) #0 {
514 %r = fcmp oeq half %a, %b
518 ; CHECK-LABEL: test_fcmp_ogt(
519 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ogt_param_0];
520 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ogt_param_1];
521 ; CHECK-F16-NOFTZ: setp.gt.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
522 ; CHECK-F16-FTZ: setp.gt.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
523 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
524 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
525 ; CHECK-NOF16: setp.gt.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
526 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
527 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
529 define i1 @test_fcmp_ogt(half %a, half %b) #0 {
530 %r = fcmp ogt half %a, %b
534 ; CHECK-LABEL: test_fcmp_oge(
535 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_oge_param_0];
536 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_oge_param_1];
537 ; CHECK-F16-NOFTZ: setp.ge.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
538 ; CHECK-F16-FTZ: setp.ge.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
539 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
540 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
541 ; CHECK-NOF16: setp.ge.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
542 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
543 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
545 define i1 @test_fcmp_oge(half %a, half %b) #0 {
546 %r = fcmp oge half %a, %b
550 ; XCHECK-LABEL: test_fcmp_olt(
551 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_olt_param_0];
552 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_olt_param_1];
553 ; CHECK-F16-NOFTZ: setp.lt.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
554 ; CHECK-F16-FTZ: setp.lt.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
555 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
556 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
557 ; CHECK-NOF16: setp.lt.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
558 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
559 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
561 define i1 @test_fcmp_olt(half %a, half %b) #0 {
562 %r = fcmp olt half %a, %b
566 ; XCHECK-LABEL: test_fcmp_ole(
567 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ole_param_0];
568 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ole_param_1];
569 ; CHECK-F16-NOFTZ: setp.le.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
570 ; CHECK-F16-FTZ: setp.le.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
571 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
572 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
573 ; CHECK-NOF16: setp.le.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
574 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
575 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
577 define i1 @test_fcmp_ole(half %a, half %b) #0 {
578 %r = fcmp ole half %a, %b
582 ; CHECK-LABEL: test_fcmp_ord(
583 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fcmp_ord_param_0];
584 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fcmp_ord_param_1];
585 ; CHECK-F16-NOFTZ: setp.num.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
586 ; CHECK-F16-FTZ: setp.num.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
587 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
588 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
589 ; CHECK-NOF16: setp.num.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
590 ; CHECK-NEXT: selp.u32 [[R:%r[0-9]+]], 1, 0, [[PRED]];
591 ; CHECK-NEXT: st.param.b32 [func_retval0+0], [[R]];
593 define i1 @test_fcmp_ord(half %a, half %b) #0 {
594 %r = fcmp ord half %a, %b
598 ; CHECK-LABEL: test_br_cc(
599 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_br_cc_param_0];
600 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_br_cc_param_1];
601 ; CHECK-DAG: ld.param.u64 %[[C:rd[0-9]+]], [test_br_cc_param_2];
602 ; CHECK-DAG: ld.param.u64 %[[D:rd[0-9]+]], [test_br_cc_param_3];
603 ; CHECK-F16-NOFTZ: setp.lt.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
604 ; CHECK-F16-FTZ: setp.lt.ftz.f16 [[PRED:%p[0-9]+]], [[A]], [[B]]
605 ; CHECK-NOF16-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
606 ; CHECK-NOF16-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
607 ; CHECK-NOF16: setp.lt.f32 [[PRED:%p[0-9]+]], [[AF]], [[BF]]
608 ; CHECK-NEXT: @[[PRED]] bra [[LABEL:\$L__BB.*]];
609 ; CHECK: st.u32 [%[[C]]],
611 ; CHECK: st.u32 [%[[D]]],
613 define void @test_br_cc(half %a, half %b, ptr %p1, ptr %p2) #0 {
614 %c = fcmp uge half %a, %b
615 br i1 %c, label %then, label %else
624 ; CHECK-LABEL: test_phi(
625 ; CHECK: ld.param.u64 %[[P1:rd[0-9]+]], [test_phi_param_0];
626 ; CHECK: ld.b16 {{%rs[0-9]+}}, [%[[P1]]];
627 ; CHECK: [[LOOP:\$L__BB[0-9_]+]]:
628 ; CHECK: mov.u16 [[R:%rs[0-9]+]], [[AB:%rs[0-9]+]];
629 ; CHECK: ld.b16 [[AB:%rs[0-9]+]], [%[[P1]]];
631 ; CHECK: st.param.b64 [param0+0], %[[P1]];
632 ; CHECK: call.uni (retval0),
633 ; CHECK-NEXT: test_dummy
635 ; CHECK: setp.eq.b32 [[PRED:%p[0-9]+]], %r{{[0-9]+}}, 1;
636 ; CHECK: @[[PRED]] bra [[LOOP]];
637 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
639 define half @test_phi(ptr %p1) #0 {
641 %a = load half, ptr %p1
644 %r = phi half [%a, %entry], [%b, %loop]
645 %b = load half, ptr %p1
646 %c = call i1 @test_dummy(ptr %p1)
647 br i1 %c, label %loop, label %return
651 declare i1 @test_dummy(ptr %p1) #0
653 ; CHECK-LABEL: test_fptosi_i32(
654 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fptosi_i32_param_0];
655 ; CHECK: cvt.rzi.s32.f16 [[R:%r[0-9]+]], [[A]];
656 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
658 define i32 @test_fptosi_i32(half %a) #0 {
659 %r = fptosi half %a to i32
663 ; CHECK-LABEL: test_fptosi_i64(
664 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fptosi_i64_param_0];
665 ; CHECK: cvt.rzi.s64.f16 [[R:%rd[0-9]+]], [[A]];
666 ; CHECK: st.param.b64 [func_retval0+0], [[R]];
668 define i64 @test_fptosi_i64(half %a) #0 {
669 %r = fptosi half %a to i64
673 ; CHECK-LABEL: test_fptoui_i32(
674 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fptoui_i32_param_0];
675 ; CHECK: cvt.rzi.u32.f16 [[R:%r[0-9]+]], [[A]];
676 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
678 define i32 @test_fptoui_i32(half %a) #0 {
679 %r = fptoui half %a to i32
683 ; CHECK-LABEL: test_fptoui_i64(
684 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fptoui_i64_param_0];
685 ; CHECK: cvt.rzi.u64.f16 [[R:%rd[0-9]+]], [[A]];
686 ; CHECK: st.param.b64 [func_retval0+0], [[R]];
688 define i64 @test_fptoui_i64(half %a) #0 {
689 %r = fptoui half %a to i64
693 ; CHECK-LABEL: test_uitofp_i32(
694 ; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_uitofp_i32_param_0];
695 ; CHECK: cvt.rn.f16.u32 [[R:%rs[0-9]+]], [[A]];
696 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
698 define half @test_uitofp_i32(i32 %a) #0 {
699 %r = uitofp i32 %a to half
703 ; CHECK-LABEL: test_uitofp_i64(
704 ; CHECK: ld.param.u64 [[A:%rd[0-9]+]], [test_uitofp_i64_param_0];
705 ; CHECK: cvt.rn.f16.u64 [[R:%rs[0-9]+]], [[A]];
706 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
708 define half @test_uitofp_i64(i64 %a) #0 {
709 %r = uitofp i64 %a to half
713 ; CHECK-LABEL: test_sitofp_i32(
714 ; CHECK: ld.param.u32 [[A:%r[0-9]+]], [test_sitofp_i32_param_0];
715 ; CHECK: cvt.rn.f16.s32 [[R:%rs[0-9]+]], [[A]];
716 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
718 define half @test_sitofp_i32(i32 %a) #0 {
719 %r = sitofp i32 %a to half
723 ; CHECK-LABEL: test_sitofp_i64(
724 ; CHECK: ld.param.u64 [[A:%rd[0-9]+]], [test_sitofp_i64_param_0];
725 ; CHECK: cvt.rn.f16.s64 [[R:%rs[0-9]+]], [[A]];
726 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
728 define half @test_sitofp_i64(i64 %a) #0 {
729 %r = sitofp i64 %a to half
733 ; CHECK-LABEL: test_uitofp_i32_fadd(
734 ; CHECK-DAG: ld.param.u32 [[A:%r[0-9]+]], [test_uitofp_i32_fadd_param_0];
735 ; CHECK-DAG: cvt.rn.f16.u32 [[C:%rs[0-9]+]], [[A]];
736 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_uitofp_i32_fadd_param_1];
737 ; CHECK-F16-NOFTZ: add.rn.f16 [[R:%rs[0-9]+]], [[B]], [[C]];
738 ; CHECK-F16-FTZ: add.rn.ftz.f16 [[R:%rs[0-9]+]], [[B]], [[C]];
739 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
740 ; CHECK-NOF16-DAG: cvt.f32.f16 [[C32:%f[0-9]+]], [[C]]
741 ; CHECK-NOF16-NEXT: add.rn.f32 [[R32:%f[0-9]+]], [[B32]], [[C32]];
742 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
743 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
745 define half @test_uitofp_i32_fadd(i32 %a, half %b) #0 {
746 %c = uitofp i32 %a to half
747 %r = fadd half %b, %c
751 ; CHECK-LABEL: test_sitofp_i32_fadd(
752 ; CHECK-DAG: ld.param.u32 [[A:%r[0-9]+]], [test_sitofp_i32_fadd_param_0];
753 ; CHECK-DAG: cvt.rn.f16.s32 [[C:%rs[0-9]+]], [[A]];
754 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_sitofp_i32_fadd_param_1];
755 ; CHECK-F16-NOFTZ: add.rn.f16 [[R:%rs[0-9]+]], [[B]], [[C]];
756 ; CHECK-F16-FTZ: add.rn.ftz.f16 [[R:%rs[0-9]+]], [[B]], [[C]];
757 ; XCHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
758 ; XCHECK-NOF16-DAG: cvt.f32.f16 [[C32:%f[0-9]+]], [[C]]
759 ; XCHECK-NOF16-NEXT: add.rn.f32 [[R32:%f[0-9]+]], [[B32]], [[C32]];
760 ; XCHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
761 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
763 define half @test_sitofp_i32_fadd(i32 %a, half %b) #0 {
764 %c = sitofp i32 %a to half
765 %r = fadd half %b, %c
769 ; CHECK-LABEL: test_fptrunc_float(
770 ; CHECK: ld.param.f32 [[A:%f[0-9]+]], [test_fptrunc_float_param_0];
771 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[A]];
772 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
774 define half @test_fptrunc_float(float %a) #0 {
775 %r = fptrunc float %a to half
779 ; CHECK-LABEL: test_fptrunc_double(
780 ; CHECK: ld.param.f64 [[A:%fd[0-9]+]], [test_fptrunc_double_param_0];
781 ; CHECK: cvt.rn.f16.f64 [[R:%rs[0-9]+]], [[A]];
782 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
784 define half @test_fptrunc_double(double %a) #0 {
785 %r = fptrunc double %a to half
789 ; CHECK-LABEL: test_fpext_float(
790 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fpext_float_param_0];
791 ; CHECK-NOFTZ: cvt.f32.f16 [[R:%f[0-9]+]], [[A]];
792 ; CHECK-F16-FTZ: cvt.ftz.f32.f16 [[R:%f[0-9]+]], [[A]];
793 ; CHECK: st.param.f32 [func_retval0+0], [[R]];
795 define float @test_fpext_float(half %a) #0 {
796 %r = fpext half %a to float
800 ; CHECK-LABEL: test_fpext_double(
801 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fpext_double_param_0];
802 ; CHECK: cvt.f64.f16 [[R:%fd[0-9]+]], [[A]];
803 ; CHECK: st.param.f64 [func_retval0+0], [[R]];
805 define double @test_fpext_double(half %a) #0 {
806 %r = fpext half %a to double
811 ; CHECK-LABEL: test_bitcast_halftoi16(
812 ; CHECK: ld.param.b16 [[AH:%rs[0-9]+]], [test_bitcast_halftoi16_param_0];
813 ; CHECK: cvt.u32.u16 [[R:%r[0-9]+]], [[AH]]
814 ; CHECK: st.param.b32 [func_retval0+0], [[R]];
816 define i16 @test_bitcast_halftoi16(half %a) #0 {
817 %r = bitcast half %a to i16
821 ; CHECK-LABEL: test_bitcast_i16tohalf(
822 ; CHECK: ld.param.u16 [[AS:%rs[0-9]+]], [test_bitcast_i16tohalf_param_0];
823 ; CHECK: st.param.b16 [func_retval0+0], [[AS]];
825 define half @test_bitcast_i16tohalf(i16 %a) #0 {
826 %r = bitcast i16 %a to half
831 declare half @llvm.sqrt.f16(half %a) #0
832 declare half @llvm.powi.f16.i32(half %a, i32 %b) #0
833 declare half @llvm.sin.f16(half %a) #0
834 declare half @llvm.cos.f16(half %a) #0
835 declare half @llvm.pow.f16(half %a, half %b) #0
836 declare half @llvm.exp.f16(half %a) #0
837 declare half @llvm.exp2.f16(half %a) #0
838 declare half @llvm.log.f16(half %a) #0
839 declare half @llvm.log10.f16(half %a) #0
840 declare half @llvm.log2.f16(half %a) #0
841 declare half @llvm.fma.f16(half %a, half %b, half %c) #0
842 declare half @llvm.fabs.f16(half %a) #0
843 declare half @llvm.minnum.f16(half %a, half %b) #0
844 declare half @llvm.maxnum.f16(half %a, half %b) #0
845 declare half @llvm.copysign.f16(half %a, half %b) #0
846 declare half @llvm.floor.f16(half %a) #0
847 declare half @llvm.ceil.f16(half %a) #0
848 declare half @llvm.trunc.f16(half %a) #0
849 declare half @llvm.rint.f16(half %a) #0
850 declare half @llvm.nearbyint.f16(half %a) #0
851 declare half @llvm.round.f16(half %a) #0
852 declare half @llvm.roundeven.f16(half %a) #0
853 declare half @llvm.fmuladd.f16(half %a, half %b, half %c) #0
855 ; CHECK-LABEL: test_sqrt(
856 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_sqrt_param_0];
857 ; CHECK-NOFTZ: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
858 ; CHECK-NOFTZ: sqrt.rn.f32 [[RF:%f[0-9]+]], [[AF]];
859 ; CHECK-F16-FTZ: cvt.ftz.f32.f16 [[AF:%f[0-9]+]], [[A]];
860 ; CHECK-F16-FTZ: sqrt.rn.ftz.f32 [[RF:%f[0-9]+]], [[AF]];
861 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RF]];
862 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
864 define half @test_sqrt(half %a) #0 {
865 %r = call half @llvm.sqrt.f16(half %a)
869 ;;; Can't do this yet: requires libcall.
870 ; XCHECK-LABEL: test_powi(
871 ;define half @test_powi(half %a, i32 %b) #0 {
872 ; %r = call half @llvm.powi.f16.i32(half %a, i32 %b)
876 ; CHECK-LABEL: test_sin(
877 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_sin_param_0];
878 ; CHECK-NOFTZ: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
879 ; CHECK-F16-FTZ: cvt.ftz.f32.f16 [[AF:%f[0-9]+]], [[A]];
880 ; CHECK: sin.approx.f32 [[RF:%f[0-9]+]], [[AF]];
881 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RF]];
882 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
884 define half @test_sin(half %a) #0 #1 {
885 %r = call half @llvm.sin.f16(half %a)
889 ; CHECK-LABEL: test_cos(
890 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_cos_param_0];
891 ; CHECK-NOFTZ: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
892 ; CHECK-F16-FTZ: cvt.ftz.f32.f16 [[AF:%f[0-9]+]], [[A]];
893 ; CHECK: cos.approx.f32 [[RF:%f[0-9]+]], [[AF]];
894 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RF]];
895 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
897 define half @test_cos(half %a) #0 #1 {
898 %r = call half @llvm.cos.f16(half %a)
902 ;;; Can't do this yet: requires libcall.
903 ; XCHECK-LABEL: test_pow(
904 ;define half @test_pow(half %a, half %b) #0 {
905 ; %r = call half @llvm.pow.f16(half %a, half %b)
909 ;;; Can't do this yet: requires libcall.
910 ; XCHECK-LABEL: test_exp(
911 ;define half @test_exp(half %a) #0 {
912 ; %r = call half @llvm.exp.f16(half %a)
916 ;;; Can't do this yet: requires libcall.
917 ; XCHECK-LABEL: test_exp2(
918 ;define half @test_exp2(half %a) #0 {
919 ; %r = call half @llvm.exp2.f16(half %a)
923 ;;; Can't do this yet: requires libcall.
924 ; XCHECK-LABEL: test_log(
925 ;define half @test_log(half %a) #0 {
926 ; %r = call half @llvm.log.f16(half %a)
930 ;;; Can't do this yet: requires libcall.
931 ; XCHECK-LABEL: test_log10(
932 ;define half @test_log10(half %a) #0 {
933 ; %r = call half @llvm.log10.f16(half %a)
937 ;;; Can't do this yet: requires libcall.
938 ; XCHECK-LABEL: test_log2(
939 ;define half @test_log2(half %a) #0 {
940 ; %r = call half @llvm.log2.f16(half %a)
944 ; CHECK-LABEL: test_fma(
945 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fma_param_0];
946 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fma_param_1];
947 ; CHECK-DAG: ld.param.b16 [[C:%rs[0-9]+]], [test_fma_param_2];
948 ; CHECK-F16-NOFTZ: fma.rn.f16 [[R:%rs[0-9]+]], [[A]], [[B]], [[C]];
949 ; CHECK-F16-FTZ: fma.rn.ftz.f16 [[R:%rs[0-9]+]], [[A]], [[B]], [[C]];
950 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
951 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
952 ; CHECK-NOF16-DAG: cvt.f32.f16 [[C32:%f[0-9]+]], [[C]]
953 ; CHECK-NOF16-NEXT: fma.rn.f32 [[R32:%f[0-9]+]], [[A32]], [[B32]], [[C32]];
954 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
955 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
957 define half @test_fma(half %a, half %b, half %c) #0 {
958 %r = call half @llvm.fma.f16(half %a, half %b, half %c)
962 ; CHECK-LABEL: test_fabs(
963 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fabs_param_0];
964 ; CHECK-NOFTZ: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
965 ; CHECK-NOFTZ: abs.f32 [[RF:%f[0-9]+]], [[AF]];
966 ; CHECK-F16-FTZ: cvt.ftz.f32.f16 [[AF:%f[0-9]+]], [[A]];
967 ; CHECK-F16-FTZ: abs.ftz.f32 [[RF:%f[0-9]+]], [[AF]];
968 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RF]];
969 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
971 define half @test_fabs(half %a) #0 {
972 %r = call half @llvm.fabs.f16(half %a)
976 ; CHECK-LABEL: test_minnum(
977 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_minnum_param_0];
978 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_minnum_param_1];
979 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
980 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
981 ; CHECK-NOFTZ: min.f32 [[RF:%f[0-9]+]], [[AF]], [[BF]];
982 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[AF:%f[0-9]+]], [[A]];
983 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[BF:%f[0-9]+]], [[B]];
984 ; CHECK-F16-FTZ: min.ftz.f32 [[RF:%f[0-9]+]], [[AF]], [[BF]];
985 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RF]];
986 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
988 define half @test_minnum(half %a, half %b) #0 {
989 %r = call half @llvm.minnum.f16(half %a, half %b)
993 ; CHECK-LABEL: test_maxnum(
994 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_maxnum_param_0];
995 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_maxnum_param_1];
996 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[AF:%f[0-9]+]], [[A]];
997 ; CHECK-NOFTZ-DAG: cvt.f32.f16 [[BF:%f[0-9]+]], [[B]];
998 ; CHECK-NOFTZ: max.f32 [[RF:%f[0-9]+]], [[AF]], [[BF]];
999 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[AF:%f[0-9]+]], [[A]];
1000 ; CHECK-F16-FTZ-DAG: cvt.ftz.f32.f16 [[BF:%f[0-9]+]], [[B]];
1001 ; CHECK-F16-FTZ: max.ftz.f32 [[RF:%f[0-9]+]], [[AF]], [[BF]];
1002 ; CHECK: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[RF]];
1003 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1005 define half @test_maxnum(half %a, half %b) #0 {
1006 %r = call half @llvm.maxnum.f16(half %a, half %b)
1010 ; CHECK-LABEL: test_copysign(
1011 ; CHECK-DAG: ld.param.b16 [[AH:%rs[0-9]+]], [test_copysign_param_0];
1012 ; CHECK-DAG: ld.param.b16 [[BH:%rs[0-9]+]], [test_copysign_param_1];
1013 ; CHECK-DAG: and.b16 [[AX:%rs[0-9]+]], [[AH]], 32767;
1014 ; CHECK-DAG: and.b16 [[BX:%rs[0-9]+]], [[BH]], -32768;
1015 ; CHECK: or.b16 [[RX:%rs[0-9]+]], [[AX]], [[BX]];
1016 ; CHECK: st.param.b16 [func_retval0+0], [[RX]];
1018 define half @test_copysign(half %a, half %b) #0 {
1019 %r = call half @llvm.copysign.f16(half %a, half %b)
1023 ; CHECK-LABEL: test_copysign_f32(
1024 ; CHECK-DAG: ld.param.b16 [[AH:%rs[0-9]+]], [test_copysign_f32_param_0];
1025 ; CHECK-DAG: ld.param.f32 [[BF:%f[0-9]+]], [test_copysign_f32_param_1];
1026 ; CHECK-DAG: mov.b32 [[B:%r[0-9]+]], [[BF]];
1027 ; CHECK-DAG: and.b16 [[AX:%rs[0-9]+]], [[AH]], 32767;
1028 ; CHECK-DAG: and.b32 [[BX0:%r[0-9]+]], [[B]], -2147483648;
1029 ; CHECK-DAG: mov.b32 {tmp, [[BX2:%rs[0-9]+]]}, [[BX0]];
1030 ; CHECK: or.b16 [[RX:%rs[0-9]+]], [[AX]], [[BX2]];
1031 ; CHECK: st.param.b16 [func_retval0+0], [[RX]];
1033 define half @test_copysign_f32(half %a, float %b) #0 {
1034 %tb = fptrunc float %b to half
1035 %r = call half @llvm.copysign.f16(half %a, half %tb)
1039 ; CHECK-LABEL: test_copysign_f64(
1040 ; CHECK-DAG: ld.param.b16 [[AH:%rs[0-9]+]], [test_copysign_f64_param_0];
1041 ; CHECK-DAG: ld.param.f64 [[BD:%fd[0-9]+]], [test_copysign_f64_param_1];
1042 ; CHECK-DAG: mov.b64 [[B:%rd[0-9]+]], [[BD]];
1043 ; CHECK-DAG: and.b16 [[AX:%rs[0-9]+]], [[AH]], 32767;
1044 ; CHECK-DAG: and.b64 [[BX0:%rd[0-9]+]], [[B]], -9223372036854775808;
1045 ; CHECK-DAG: shr.u64 [[BX1:%rd[0-9]+]], [[BX0]], 48;
1046 ; CHECK-DAG: cvt.u16.u64 [[BX2:%rs[0-9]+]], [[BX1]];
1047 ; CHECK: or.b16 [[RX:%rs[0-9]+]], [[AX]], [[BX2]];
1048 ; CHECK: st.param.b16 [func_retval0+0], [[RX]];
1050 define half @test_copysign_f64(half %a, double %b) #0 {
1051 %tb = fptrunc double %b to half
1052 %r = call half @llvm.copysign.f16(half %a, half %tb)
1056 ; CHECK-LABEL: test_copysign_extended(
1057 ; CHECK-DAG: ld.param.b16 [[AH:%rs[0-9]+]], [test_copysign_extended_param_0];
1058 ; CHECK-DAG: ld.param.b16 [[BH:%rs[0-9]+]], [test_copysign_extended_param_1];
1059 ; CHECK-DAG: and.b16 [[AX:%rs[0-9]+]], [[AH]], 32767;
1060 ; CHECK-DAG: and.b16 [[BX:%rs[0-9]+]], [[BH]], -32768;
1061 ; CHECK: or.b16 [[RX:%rs[0-9]+]], [[AX]], [[BX]];
1062 ; CHECK-NOFTZ: cvt.f32.f16 [[XR:%f[0-9]+]], [[RX]];
1063 ; CHECK-F16-FTZ: cvt.ftz.f32.f16 [[XR:%f[0-9]+]], [[RX]];
1064 ; CHECK: st.param.f32 [func_retval0+0], [[XR]];
1066 define float @test_copysign_extended(half %a, half %b) #0 {
1067 %r = call half @llvm.copysign.f16(half %a, half %b)
1068 %xr = fpext half %r to float
1072 ; CHECK-LABEL: test_floor(
1073 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_floor_param_0];
1074 ; CHECK: cvt.rmi.f16.f16 [[R:%rs[0-9]+]], [[A]];
1075 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1077 define half @test_floor(half %a) #0 {
1078 %r = call half @llvm.floor.f16(half %a)
1082 ; CHECK-LABEL: test_ceil(
1083 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_ceil_param_0];
1084 ; CHECK: cvt.rpi.f16.f16 [[R:%rs[0-9]+]], [[A]];
1085 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1087 define half @test_ceil(half %a) #0 {
1088 %r = call half @llvm.ceil.f16(half %a)
1092 ; CHECK-LABEL: test_trunc(
1093 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_trunc_param_0];
1094 ; CHECK: cvt.rzi.f16.f16 [[R:%rs[0-9]+]], [[A]];
1095 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1097 define half @test_trunc(half %a) #0 {
1098 %r = call half @llvm.trunc.f16(half %a)
1102 ; CHECK-LABEL: test_rint(
1103 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_rint_param_0];
1104 ; CHECK: cvt.rni.f16.f16 [[R:%rs[0-9]+]], [[A]];
1105 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1107 define half @test_rint(half %a) #0 {
1108 %r = call half @llvm.rint.f16(half %a)
1112 ; CHECK-LABEL: test_nearbyint(
1113 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_nearbyint_param_0];
1114 ; CHECK: cvt.rni.f16.f16 [[R:%rs[0-9]+]], [[A]];
1115 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1117 define half @test_nearbyint(half %a) #0 {
1118 %r = call half @llvm.nearbyint.f16(half %a)
1122 ; CHECK-LABEL: test_roundeven(
1123 ; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_roundeven_param_0];
1124 ; CHECK: cvt.rni.f16.f16 [[R:%rs[0-9]+]], [[A]];
1125 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1127 define half @test_roundeven(half %a) #0 {
1128 %r = call half @llvm.roundeven.f16(half %a)
1132 ; CHECK-LABEL: test_round(
1133 ; CHECK: ld.param.b16 {{.*}}, [test_round_param_0];
1134 ; check the use of sign mask and 0.5 to implement round
1135 ; CHECK: and.b32 [[R:%r[0-9]+]], {{.*}}, -2147483648;
1136 ; CHECK: or.b32 {{.*}}, [[R]], 1056964608;
1137 ; CHECK: st.param.b16 [func_retval0+0], {{.*}};
1139 define half @test_round(half %a) #0 {
1140 %r = call half @llvm.round.f16(half %a)
1144 ; CHECK-LABEL: test_fmuladd(
1145 ; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fmuladd_param_0];
1146 ; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fmuladd_param_1];
1147 ; CHECK-DAG: ld.param.b16 [[C:%rs[0-9]+]], [test_fmuladd_param_2];
1148 ; CHECK-F16-NOFTZ: fma.rn.f16 [[R:%rs[0-9]+]], [[A]], [[B]], [[C]];
1149 ; CHECK-F16-FTZ: fma.rn.ftz.f16 [[R:%rs[0-9]+]], [[A]], [[B]], [[C]];
1150 ; CHECK-NOF16-DAG: cvt.f32.f16 [[A32:%f[0-9]+]], [[A]]
1151 ; CHECK-NOF16-DAG: cvt.f32.f16 [[B32:%f[0-9]+]], [[B]]
1152 ; CHECK-NOF16-DAG: cvt.f32.f16 [[C32:%f[0-9]+]], [[C]]
1153 ; CHECK-NOF16-NEXT: fma.rn.f32 [[R32:%f[0-9]+]], [[A32]], [[B32]], [[C32]];
1154 ; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
1155 ; CHECK: st.param.b16 [func_retval0+0], [[R]];
1157 define half @test_fmuladd(half %a, half %b, half %c) #0 {
1158 %r = call half @llvm.fmuladd.f16(half %a, half %b, half %c)
1162 ; CHECK-LABEL: test_neg_f16(
1163 ; CHECK-F16-NOFTZ: neg.f16
1164 ; CHECK-F16-FTZ: neg.ftz.f16
1165 ; CHECK-NOF16: xor.b16 %rs{{.*}}, %rs{{.*}}, -32768
1166 define half @test_neg_f16(half noundef %arg) #0 {
1167 %res = fneg half %arg
1171 ; CHECK-LABEL: test_neg_f16x2(
1172 ; CHECK-F16-NOFTZ: neg.f16x2
1173 ; CHECK-F16-FTZ: neg.ftz.f16x2
1174 ; CHECK-NOF16: xor.b16 %rs{{.*}}, %rs{{.*}}, -32768
1175 ; CHECK-NOF16: xor.b16 %rs{{.*}}, %rs{{.*}}, -32768
1176 define <2 x half> @test_neg_f16x2(<2 x half> noundef %arg) #0 {
1177 %res = fneg <2 x half> %arg
1181 attributes #0 = { nounwind }
1182 attributes #1 = { "unsafe-fp-math" = "true" }