1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zfh \
3 ; RUN: -verify-machineinstrs -target-abi ilp32f | \
4 ; RUN: FileCheck -check-prefixes=CHECKIZFH,RV32IZFH,RV32IFZFH %s
5 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zfh \
6 ; RUN: -verify-machineinstrs -target-abi lp64f | \
7 ; RUN: FileCheck -check-prefixes=CHECKIZFH,RV64IZFH,RV64IFZFH %s
8 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zhinx \
9 ; RUN: -verify-machineinstrs -target-abi ilp32 | \
10 ; RUN: FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s
11 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zhinx \
12 ; RUN: -verify-machineinstrs -target-abi lp64 | \
13 ; RUN: FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s
14 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+d \
15 ; RUN: -mattr=+zfh -verify-machineinstrs -target-abi ilp32d | \
16 ; RUN: FileCheck -check-prefixes=CHECKIZFH,RV32IZFH,RV32IDZFH %s
17 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+d \
18 ; RUN: -mattr=+zfh -verify-machineinstrs -target-abi lp64d | \
19 ; RUN: FileCheck -check-prefixes=CHECKIZFH,RV64IZFH,RV64IDZFH %s
20 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zdinx \
21 ; RUN: -mattr=+zhinx -verify-machineinstrs -target-abi ilp32 | \
22 ; RUN: FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s
23 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zdinx \
24 ; RUN: -mattr=+zhinx -verify-machineinstrs -target-abi lp64 | \
25 ; RUN: FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s
26 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 \
27 ; RUN: -verify-machineinstrs | \
28 ; RUN: FileCheck -check-prefix=RV32I %s
29 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 \
30 ; RUN: -verify-machineinstrs | \
31 ; RUN: FileCheck -check-prefix=RV64I %s
33 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zfhmin \
34 ; RUN: -verify-machineinstrs -target-abi ilp32f | \
35 ; RUN: FileCheck -check-prefixes=CHECKIZFHMIN,RV32IZFHMIN,RV32IFZFHMIN %s
36 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zfhmin \
37 ; RUN: -verify-machineinstrs -target-abi lp64f | \
38 ; RUN: FileCheck -check-prefixes=CHECKIZFHMIN,RV64IZFHMIN,RV64IFZFHMIN %s
39 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+d \
40 ; RUN: -mattr=+zfhmin -verify-machineinstrs -target-abi ilp32d | \
41 ; RUN: FileCheck -check-prefixes=CHECKIZFHMIN,RV32IZFHMIN,RV32IDZFHMIN %s
42 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+d \
43 ; RUN: -mattr=+zfhmin -verify-machineinstrs -target-abi lp64d | \
44 ; RUN: FileCheck -check-prefixes=CHECKIZFHMIN,RV64IZFHMIN,RV64IDZFHMIN %s
46 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zhinxmin \
47 ; RUN: -verify-machineinstrs -target-abi ilp32 | \
48 ; RUN: FileCheck -check-prefixes=CHECKIZHINXMIN,RV32IZHINXMIN %s
49 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zhinxmin \
50 ; RUN: -verify-machineinstrs -target-abi lp64 | \
51 ; RUN: FileCheck -check-prefixes=CHECKIZHINXMIN,RV64IZHINXMIN %s
52 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zdinx \
53 ; RUN: -mattr=+zhinxmin -verify-machineinstrs -target-abi ilp32 | \
54 ; RUN: FileCheck -check-prefixes=CHECKIZHINXMIN,RV32IZHINXMIN %s
55 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zdinx \
56 ; RUN: -mattr=+zhinxmin -verify-machineinstrs -target-abi lp64 | \
57 ; RUN: FileCheck -check-prefixes=CHECKIZHINXMIN,RV64IZHINXMIN %s
59 declare half @llvm.sqrt.f16(half)
61 define half @sqrt_f16(half %a) nounwind {
62 ; CHECKIZFH-LABEL: sqrt_f16:
64 ; CHECKIZFH-NEXT: fsqrt.h fa0, fa0
67 ; CHECKIZHINX-LABEL: sqrt_f16:
68 ; CHECKIZHINX: # %bb.0:
69 ; CHECKIZHINX-NEXT: fsqrt.h a0, a0
70 ; CHECKIZHINX-NEXT: ret
72 ; RV32I-LABEL: sqrt_f16:
74 ; RV32I-NEXT: addi sp, sp, -16
75 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
76 ; RV32I-NEXT: slli a0, a0, 16
77 ; RV32I-NEXT: srli a0, a0, 16
78 ; RV32I-NEXT: call __extendhfsf2
79 ; RV32I-NEXT: call sqrtf
80 ; RV32I-NEXT: call __truncsfhf2
81 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
82 ; RV32I-NEXT: addi sp, sp, 16
85 ; RV64I-LABEL: sqrt_f16:
87 ; RV64I-NEXT: addi sp, sp, -16
88 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
89 ; RV64I-NEXT: slli a0, a0, 48
90 ; RV64I-NEXT: srli a0, a0, 48
91 ; RV64I-NEXT: call __extendhfsf2
92 ; RV64I-NEXT: call sqrtf
93 ; RV64I-NEXT: call __truncsfhf2
94 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
95 ; RV64I-NEXT: addi sp, sp, 16
98 ; CHECKIZFHMIN-LABEL: sqrt_f16:
99 ; CHECKIZFHMIN: # %bb.0:
100 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
101 ; CHECKIZFHMIN-NEXT: fsqrt.s fa5, fa5
102 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
103 ; CHECKIZFHMIN-NEXT: ret
105 ; CHECKIZHINXMIN-LABEL: sqrt_f16:
106 ; CHECKIZHINXMIN: # %bb.0:
107 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
108 ; CHECKIZHINXMIN-NEXT: fsqrt.s a0, a0
109 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
110 ; CHECKIZHINXMIN-NEXT: ret
111 %1 = call half @llvm.sqrt.f16(half %a)
115 declare half @llvm.powi.f16.i32(half, i32)
117 define half @powi_f16(half %a, i32 %b) nounwind {
118 ; RV32IZFH-LABEL: powi_f16:
120 ; RV32IZFH-NEXT: addi sp, sp, -16
121 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
122 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
123 ; RV32IZFH-NEXT: call __powisf2
124 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
125 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
126 ; RV32IZFH-NEXT: addi sp, sp, 16
129 ; RV64IZFH-LABEL: powi_f16:
131 ; RV64IZFH-NEXT: addi sp, sp, -16
132 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
133 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
134 ; RV64IZFH-NEXT: sext.w a0, a0
135 ; RV64IZFH-NEXT: call __powisf2
136 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
137 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
138 ; RV64IZFH-NEXT: addi sp, sp, 16
141 ; RV32IZHINX-LABEL: powi_f16:
142 ; RV32IZHINX: # %bb.0:
143 ; RV32IZHINX-NEXT: addi sp, sp, -16
144 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
145 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
146 ; RV32IZHINX-NEXT: call __powisf2
147 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
148 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
149 ; RV32IZHINX-NEXT: addi sp, sp, 16
150 ; RV32IZHINX-NEXT: ret
152 ; RV64IZHINX-LABEL: powi_f16:
153 ; RV64IZHINX: # %bb.0:
154 ; RV64IZHINX-NEXT: addi sp, sp, -16
155 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
156 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
157 ; RV64IZHINX-NEXT: sext.w a1, a1
158 ; RV64IZHINX-NEXT: call __powisf2
159 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
160 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
161 ; RV64IZHINX-NEXT: addi sp, sp, 16
162 ; RV64IZHINX-NEXT: ret
164 ; RV32I-LABEL: powi_f16:
166 ; RV32I-NEXT: addi sp, sp, -16
167 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
168 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
169 ; RV32I-NEXT: mv s0, a1
170 ; RV32I-NEXT: slli a0, a0, 16
171 ; RV32I-NEXT: srli a0, a0, 16
172 ; RV32I-NEXT: call __extendhfsf2
173 ; RV32I-NEXT: mv a1, s0
174 ; RV32I-NEXT: call __powisf2
175 ; RV32I-NEXT: call __truncsfhf2
176 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
177 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
178 ; RV32I-NEXT: addi sp, sp, 16
181 ; RV64I-LABEL: powi_f16:
183 ; RV64I-NEXT: addi sp, sp, -16
184 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
185 ; RV64I-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
186 ; RV64I-NEXT: mv s0, a1
187 ; RV64I-NEXT: slli a0, a0, 48
188 ; RV64I-NEXT: srli a0, a0, 48
189 ; RV64I-NEXT: call __extendhfsf2
190 ; RV64I-NEXT: sext.w a1, s0
191 ; RV64I-NEXT: call __powisf2
192 ; RV64I-NEXT: call __truncsfhf2
193 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
194 ; RV64I-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
195 ; RV64I-NEXT: addi sp, sp, 16
198 ; RV32IZFHMIN-LABEL: powi_f16:
199 ; RV32IZFHMIN: # %bb.0:
200 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
201 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
202 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
203 ; RV32IZFHMIN-NEXT: call __powisf2
204 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
205 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
206 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
207 ; RV32IZFHMIN-NEXT: ret
209 ; RV64IZFHMIN-LABEL: powi_f16:
210 ; RV64IZFHMIN: # %bb.0:
211 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
212 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
213 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
214 ; RV64IZFHMIN-NEXT: sext.w a0, a0
215 ; RV64IZFHMIN-NEXT: call __powisf2
216 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
217 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
218 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
219 ; RV64IZFHMIN-NEXT: ret
221 ; RV32IZHINXMIN-LABEL: powi_f16:
222 ; RV32IZHINXMIN: # %bb.0:
223 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
224 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
225 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
226 ; RV32IZHINXMIN-NEXT: call __powisf2
227 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
228 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
229 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
230 ; RV32IZHINXMIN-NEXT: ret
232 ; RV64IZHINXMIN-LABEL: powi_f16:
233 ; RV64IZHINXMIN: # %bb.0:
234 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
235 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
236 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
237 ; RV64IZHINXMIN-NEXT: sext.w a1, a1
238 ; RV64IZHINXMIN-NEXT: call __powisf2
239 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
240 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
241 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
242 ; RV64IZHINXMIN-NEXT: ret
243 %1 = call half @llvm.powi.f16.i32(half %a, i32 %b)
247 declare half @llvm.sin.f16(half)
249 define half @sin_f16(half %a) nounwind {
250 ; RV32IZFH-LABEL: sin_f16:
252 ; RV32IZFH-NEXT: addi sp, sp, -16
253 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
254 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
255 ; RV32IZFH-NEXT: call sinf
256 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
257 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
258 ; RV32IZFH-NEXT: addi sp, sp, 16
261 ; RV64IZFH-LABEL: sin_f16:
263 ; RV64IZFH-NEXT: addi sp, sp, -16
264 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
265 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
266 ; RV64IZFH-NEXT: call sinf
267 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
268 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
269 ; RV64IZFH-NEXT: addi sp, sp, 16
272 ; RV32IZHINX-LABEL: sin_f16:
273 ; RV32IZHINX: # %bb.0:
274 ; RV32IZHINX-NEXT: addi sp, sp, -16
275 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
276 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
277 ; RV32IZHINX-NEXT: call sinf
278 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
279 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
280 ; RV32IZHINX-NEXT: addi sp, sp, 16
281 ; RV32IZHINX-NEXT: ret
283 ; RV64IZHINX-LABEL: sin_f16:
284 ; RV64IZHINX: # %bb.0:
285 ; RV64IZHINX-NEXT: addi sp, sp, -16
286 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
287 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
288 ; RV64IZHINX-NEXT: call sinf
289 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
290 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
291 ; RV64IZHINX-NEXT: addi sp, sp, 16
292 ; RV64IZHINX-NEXT: ret
294 ; RV32I-LABEL: sin_f16:
296 ; RV32I-NEXT: addi sp, sp, -16
297 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
298 ; RV32I-NEXT: slli a0, a0, 16
299 ; RV32I-NEXT: srli a0, a0, 16
300 ; RV32I-NEXT: call __extendhfsf2
301 ; RV32I-NEXT: call sinf
302 ; RV32I-NEXT: call __truncsfhf2
303 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
304 ; RV32I-NEXT: addi sp, sp, 16
307 ; RV64I-LABEL: sin_f16:
309 ; RV64I-NEXT: addi sp, sp, -16
310 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
311 ; RV64I-NEXT: slli a0, a0, 48
312 ; RV64I-NEXT: srli a0, a0, 48
313 ; RV64I-NEXT: call __extendhfsf2
314 ; RV64I-NEXT: call sinf
315 ; RV64I-NEXT: call __truncsfhf2
316 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
317 ; RV64I-NEXT: addi sp, sp, 16
320 ; RV32IZFHMIN-LABEL: sin_f16:
321 ; RV32IZFHMIN: # %bb.0:
322 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
323 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
324 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
325 ; RV32IZFHMIN-NEXT: call sinf
326 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
327 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
328 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
329 ; RV32IZFHMIN-NEXT: ret
331 ; RV64IZFHMIN-LABEL: sin_f16:
332 ; RV64IZFHMIN: # %bb.0:
333 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
334 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
335 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
336 ; RV64IZFHMIN-NEXT: call sinf
337 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
338 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
339 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
340 ; RV64IZFHMIN-NEXT: ret
342 ; RV32IZHINXMIN-LABEL: sin_f16:
343 ; RV32IZHINXMIN: # %bb.0:
344 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
345 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
346 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
347 ; RV32IZHINXMIN-NEXT: call sinf
348 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
349 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
350 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
351 ; RV32IZHINXMIN-NEXT: ret
353 ; RV64IZHINXMIN-LABEL: sin_f16:
354 ; RV64IZHINXMIN: # %bb.0:
355 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
356 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
357 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
358 ; RV64IZHINXMIN-NEXT: call sinf
359 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
360 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
361 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
362 ; RV64IZHINXMIN-NEXT: ret
363 %1 = call half @llvm.sin.f16(half %a)
367 declare half @llvm.cos.f16(half)
369 define half @cos_f16(half %a) nounwind {
370 ; RV32IZFH-LABEL: cos_f16:
372 ; RV32IZFH-NEXT: addi sp, sp, -16
373 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
374 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
375 ; RV32IZFH-NEXT: call cosf
376 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
377 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
378 ; RV32IZFH-NEXT: addi sp, sp, 16
381 ; RV64IZFH-LABEL: cos_f16:
383 ; RV64IZFH-NEXT: addi sp, sp, -16
384 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
385 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
386 ; RV64IZFH-NEXT: call cosf
387 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
388 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
389 ; RV64IZFH-NEXT: addi sp, sp, 16
392 ; RV32IZHINX-LABEL: cos_f16:
393 ; RV32IZHINX: # %bb.0:
394 ; RV32IZHINX-NEXT: addi sp, sp, -16
395 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
396 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
397 ; RV32IZHINX-NEXT: call cosf
398 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
399 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
400 ; RV32IZHINX-NEXT: addi sp, sp, 16
401 ; RV32IZHINX-NEXT: ret
403 ; RV64IZHINX-LABEL: cos_f16:
404 ; RV64IZHINX: # %bb.0:
405 ; RV64IZHINX-NEXT: addi sp, sp, -16
406 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
407 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
408 ; RV64IZHINX-NEXT: call cosf
409 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
410 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
411 ; RV64IZHINX-NEXT: addi sp, sp, 16
412 ; RV64IZHINX-NEXT: ret
414 ; RV32I-LABEL: cos_f16:
416 ; RV32I-NEXT: addi sp, sp, -16
417 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
418 ; RV32I-NEXT: slli a0, a0, 16
419 ; RV32I-NEXT: srli a0, a0, 16
420 ; RV32I-NEXT: call __extendhfsf2
421 ; RV32I-NEXT: call cosf
422 ; RV32I-NEXT: call __truncsfhf2
423 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
424 ; RV32I-NEXT: addi sp, sp, 16
427 ; RV64I-LABEL: cos_f16:
429 ; RV64I-NEXT: addi sp, sp, -16
430 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
431 ; RV64I-NEXT: slli a0, a0, 48
432 ; RV64I-NEXT: srli a0, a0, 48
433 ; RV64I-NEXT: call __extendhfsf2
434 ; RV64I-NEXT: call cosf
435 ; RV64I-NEXT: call __truncsfhf2
436 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
437 ; RV64I-NEXT: addi sp, sp, 16
440 ; RV32IZFHMIN-LABEL: cos_f16:
441 ; RV32IZFHMIN: # %bb.0:
442 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
443 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
444 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
445 ; RV32IZFHMIN-NEXT: call cosf
446 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
447 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
448 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
449 ; RV32IZFHMIN-NEXT: ret
451 ; RV64IZFHMIN-LABEL: cos_f16:
452 ; RV64IZFHMIN: # %bb.0:
453 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
454 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
455 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
456 ; RV64IZFHMIN-NEXT: call cosf
457 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
458 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
459 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
460 ; RV64IZFHMIN-NEXT: ret
462 ; RV32IZHINXMIN-LABEL: cos_f16:
463 ; RV32IZHINXMIN: # %bb.0:
464 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
465 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
466 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
467 ; RV32IZHINXMIN-NEXT: call cosf
468 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
469 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
470 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
471 ; RV32IZHINXMIN-NEXT: ret
473 ; RV64IZHINXMIN-LABEL: cos_f16:
474 ; RV64IZHINXMIN: # %bb.0:
475 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
476 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
477 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
478 ; RV64IZHINXMIN-NEXT: call cosf
479 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
480 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
481 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
482 ; RV64IZHINXMIN-NEXT: ret
483 %1 = call half @llvm.cos.f16(half %a)
487 ; The sin+cos combination results in an FSINCOS SelectionDAG node.
488 define half @sincos_f16(half %a) nounwind {
489 ; RV32IFZFH-LABEL: sincos_f16:
490 ; RV32IFZFH: # %bb.0:
491 ; RV32IFZFH-NEXT: addi sp, sp, -16
492 ; RV32IFZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
493 ; RV32IFZFH-NEXT: fsw fs0, 8(sp) # 4-byte Folded Spill
494 ; RV32IFZFH-NEXT: fsw fs1, 4(sp) # 4-byte Folded Spill
495 ; RV32IFZFH-NEXT: fcvt.s.h fs0, fa0
496 ; RV32IFZFH-NEXT: fmv.s fa0, fs0
497 ; RV32IFZFH-NEXT: call sinf
498 ; RV32IFZFH-NEXT: fcvt.h.s fs1, fa0
499 ; RV32IFZFH-NEXT: fmv.s fa0, fs0
500 ; RV32IFZFH-NEXT: call cosf
501 ; RV32IFZFH-NEXT: fcvt.h.s fa5, fa0
502 ; RV32IFZFH-NEXT: fadd.h fa0, fs1, fa5
503 ; RV32IFZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
504 ; RV32IFZFH-NEXT: flw fs0, 8(sp) # 4-byte Folded Reload
505 ; RV32IFZFH-NEXT: flw fs1, 4(sp) # 4-byte Folded Reload
506 ; RV32IFZFH-NEXT: addi sp, sp, 16
507 ; RV32IFZFH-NEXT: ret
509 ; RV64IFZFH-LABEL: sincos_f16:
510 ; RV64IFZFH: # %bb.0:
511 ; RV64IFZFH-NEXT: addi sp, sp, -16
512 ; RV64IFZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
513 ; RV64IFZFH-NEXT: fsw fs0, 4(sp) # 4-byte Folded Spill
514 ; RV64IFZFH-NEXT: fsw fs1, 0(sp) # 4-byte Folded Spill
515 ; RV64IFZFH-NEXT: fcvt.s.h fs0, fa0
516 ; RV64IFZFH-NEXT: fmv.s fa0, fs0
517 ; RV64IFZFH-NEXT: call sinf
518 ; RV64IFZFH-NEXT: fcvt.h.s fs1, fa0
519 ; RV64IFZFH-NEXT: fmv.s fa0, fs0
520 ; RV64IFZFH-NEXT: call cosf
521 ; RV64IFZFH-NEXT: fcvt.h.s fa5, fa0
522 ; RV64IFZFH-NEXT: fadd.h fa0, fs1, fa5
523 ; RV64IFZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
524 ; RV64IFZFH-NEXT: flw fs0, 4(sp) # 4-byte Folded Reload
525 ; RV64IFZFH-NEXT: flw fs1, 0(sp) # 4-byte Folded Reload
526 ; RV64IFZFH-NEXT: addi sp, sp, 16
527 ; RV64IFZFH-NEXT: ret
529 ; RV32IZHINX-LABEL: sincos_f16:
530 ; RV32IZHINX: # %bb.0:
531 ; RV32IZHINX-NEXT: addi sp, sp, -16
532 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
533 ; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
534 ; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
535 ; RV32IZHINX-NEXT: fcvt.s.h s0, a0
536 ; RV32IZHINX-NEXT: mv a0, s0
537 ; RV32IZHINX-NEXT: call sinf
538 ; RV32IZHINX-NEXT: fcvt.h.s s1, a0
539 ; RV32IZHINX-NEXT: mv a0, s0
540 ; RV32IZHINX-NEXT: call cosf
541 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
542 ; RV32IZHINX-NEXT: fadd.h a0, s1, a0
543 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
544 ; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
545 ; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
546 ; RV32IZHINX-NEXT: addi sp, sp, 16
547 ; RV32IZHINX-NEXT: ret
549 ; RV64IZHINX-LABEL: sincos_f16:
550 ; RV64IZHINX: # %bb.0:
551 ; RV64IZHINX-NEXT: addi sp, sp, -32
552 ; RV64IZHINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
553 ; RV64IZHINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
554 ; RV64IZHINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
555 ; RV64IZHINX-NEXT: fcvt.s.h s0, a0
556 ; RV64IZHINX-NEXT: mv a0, s0
557 ; RV64IZHINX-NEXT: call sinf
558 ; RV64IZHINX-NEXT: fcvt.h.s s1, a0
559 ; RV64IZHINX-NEXT: mv a0, s0
560 ; RV64IZHINX-NEXT: call cosf
561 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
562 ; RV64IZHINX-NEXT: fadd.h a0, s1, a0
563 ; RV64IZHINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
564 ; RV64IZHINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
565 ; RV64IZHINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
566 ; RV64IZHINX-NEXT: addi sp, sp, 32
567 ; RV64IZHINX-NEXT: ret
569 ; RV32IDZFH-LABEL: sincos_f16:
570 ; RV32IDZFH: # %bb.0:
571 ; RV32IDZFH-NEXT: addi sp, sp, -32
572 ; RV32IDZFH-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
573 ; RV32IDZFH-NEXT: fsd fs0, 16(sp) # 8-byte Folded Spill
574 ; RV32IDZFH-NEXT: fsd fs1, 8(sp) # 8-byte Folded Spill
575 ; RV32IDZFH-NEXT: fcvt.s.h fs0, fa0
576 ; RV32IDZFH-NEXT: fmv.s fa0, fs0
577 ; RV32IDZFH-NEXT: call sinf
578 ; RV32IDZFH-NEXT: fcvt.h.s fs1, fa0
579 ; RV32IDZFH-NEXT: fmv.s fa0, fs0
580 ; RV32IDZFH-NEXT: call cosf
581 ; RV32IDZFH-NEXT: fcvt.h.s fa5, fa0
582 ; RV32IDZFH-NEXT: fadd.h fa0, fs1, fa5
583 ; RV32IDZFH-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
584 ; RV32IDZFH-NEXT: fld fs0, 16(sp) # 8-byte Folded Reload
585 ; RV32IDZFH-NEXT: fld fs1, 8(sp) # 8-byte Folded Reload
586 ; RV32IDZFH-NEXT: addi sp, sp, 32
587 ; RV32IDZFH-NEXT: ret
589 ; RV64IDZFH-LABEL: sincos_f16:
590 ; RV64IDZFH: # %bb.0:
591 ; RV64IDZFH-NEXT: addi sp, sp, -32
592 ; RV64IDZFH-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
593 ; RV64IDZFH-NEXT: fsd fs0, 16(sp) # 8-byte Folded Spill
594 ; RV64IDZFH-NEXT: fsd fs1, 8(sp) # 8-byte Folded Spill
595 ; RV64IDZFH-NEXT: fcvt.s.h fs0, fa0
596 ; RV64IDZFH-NEXT: fmv.s fa0, fs0
597 ; RV64IDZFH-NEXT: call sinf
598 ; RV64IDZFH-NEXT: fcvt.h.s fs1, fa0
599 ; RV64IDZFH-NEXT: fmv.s fa0, fs0
600 ; RV64IDZFH-NEXT: call cosf
601 ; RV64IDZFH-NEXT: fcvt.h.s fa5, fa0
602 ; RV64IDZFH-NEXT: fadd.h fa0, fs1, fa5
603 ; RV64IDZFH-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
604 ; RV64IDZFH-NEXT: fld fs0, 16(sp) # 8-byte Folded Reload
605 ; RV64IDZFH-NEXT: fld fs1, 8(sp) # 8-byte Folded Reload
606 ; RV64IDZFH-NEXT: addi sp, sp, 32
607 ; RV64IDZFH-NEXT: ret
609 ; RV32I-LABEL: sincos_f16:
611 ; RV32I-NEXT: addi sp, sp, -16
612 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
613 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
614 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
615 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
616 ; RV32I-NEXT: lui a1, 16
617 ; RV32I-NEXT: addi s2, a1, -1
618 ; RV32I-NEXT: and a0, a0, s2
619 ; RV32I-NEXT: call __extendhfsf2
620 ; RV32I-NEXT: mv s0, a0
621 ; RV32I-NEXT: call sinf
622 ; RV32I-NEXT: call __truncsfhf2
623 ; RV32I-NEXT: mv s1, a0
624 ; RV32I-NEXT: mv a0, s0
625 ; RV32I-NEXT: call cosf
626 ; RV32I-NEXT: call __truncsfhf2
627 ; RV32I-NEXT: mv s0, a0
628 ; RV32I-NEXT: and a0, s1, s2
629 ; RV32I-NEXT: call __extendhfsf2
630 ; RV32I-NEXT: mv s1, a0
631 ; RV32I-NEXT: and a0, s0, s2
632 ; RV32I-NEXT: call __extendhfsf2
633 ; RV32I-NEXT: mv a1, a0
634 ; RV32I-NEXT: mv a0, s1
635 ; RV32I-NEXT: call __addsf3
636 ; RV32I-NEXT: call __truncsfhf2
637 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
638 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
639 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
640 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
641 ; RV32I-NEXT: addi sp, sp, 16
644 ; RV64I-LABEL: sincos_f16:
646 ; RV64I-NEXT: addi sp, sp, -32
647 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
648 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
649 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
650 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
651 ; RV64I-NEXT: lui a1, 16
652 ; RV64I-NEXT: addiw s2, a1, -1
653 ; RV64I-NEXT: and a0, a0, s2
654 ; RV64I-NEXT: call __extendhfsf2
655 ; RV64I-NEXT: mv s0, a0
656 ; RV64I-NEXT: call sinf
657 ; RV64I-NEXT: call __truncsfhf2
658 ; RV64I-NEXT: mv s1, a0
659 ; RV64I-NEXT: mv a0, s0
660 ; RV64I-NEXT: call cosf
661 ; RV64I-NEXT: call __truncsfhf2
662 ; RV64I-NEXT: mv s0, a0
663 ; RV64I-NEXT: and a0, s1, s2
664 ; RV64I-NEXT: call __extendhfsf2
665 ; RV64I-NEXT: mv s1, a0
666 ; RV64I-NEXT: and a0, s0, s2
667 ; RV64I-NEXT: call __extendhfsf2
668 ; RV64I-NEXT: mv a1, a0
669 ; RV64I-NEXT: mv a0, s1
670 ; RV64I-NEXT: call __addsf3
671 ; RV64I-NEXT: call __truncsfhf2
672 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
673 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
674 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
675 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
676 ; RV64I-NEXT: addi sp, sp, 32
679 ; RV32IFZFHMIN-LABEL: sincos_f16:
680 ; RV32IFZFHMIN: # %bb.0:
681 ; RV32IFZFHMIN-NEXT: addi sp, sp, -16
682 ; RV32IFZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
683 ; RV32IFZFHMIN-NEXT: fsw fs0, 8(sp) # 4-byte Folded Spill
684 ; RV32IFZFHMIN-NEXT: fsw fs1, 4(sp) # 4-byte Folded Spill
685 ; RV32IFZFHMIN-NEXT: fcvt.s.h fs0, fa0
686 ; RV32IFZFHMIN-NEXT: fmv.s fa0, fs0
687 ; RV32IFZFHMIN-NEXT: call sinf
688 ; RV32IFZFHMIN-NEXT: fcvt.h.s fs1, fa0
689 ; RV32IFZFHMIN-NEXT: fmv.s fa0, fs0
690 ; RV32IFZFHMIN-NEXT: call cosf
691 ; RV32IFZFHMIN-NEXT: fcvt.h.s fa5, fa0
692 ; RV32IFZFHMIN-NEXT: fcvt.s.h fa5, fa5
693 ; RV32IFZFHMIN-NEXT: fcvt.s.h fa4, fs1
694 ; RV32IFZFHMIN-NEXT: fadd.s fa5, fa4, fa5
695 ; RV32IFZFHMIN-NEXT: fcvt.h.s fa0, fa5
696 ; RV32IFZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
697 ; RV32IFZFHMIN-NEXT: flw fs0, 8(sp) # 4-byte Folded Reload
698 ; RV32IFZFHMIN-NEXT: flw fs1, 4(sp) # 4-byte Folded Reload
699 ; RV32IFZFHMIN-NEXT: addi sp, sp, 16
700 ; RV32IFZFHMIN-NEXT: ret
702 ; RV64IFZFHMIN-LABEL: sincos_f16:
703 ; RV64IFZFHMIN: # %bb.0:
704 ; RV64IFZFHMIN-NEXT: addi sp, sp, -16
705 ; RV64IFZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
706 ; RV64IFZFHMIN-NEXT: fsw fs0, 4(sp) # 4-byte Folded Spill
707 ; RV64IFZFHMIN-NEXT: fsw fs1, 0(sp) # 4-byte Folded Spill
708 ; RV64IFZFHMIN-NEXT: fcvt.s.h fs0, fa0
709 ; RV64IFZFHMIN-NEXT: fmv.s fa0, fs0
710 ; RV64IFZFHMIN-NEXT: call sinf
711 ; RV64IFZFHMIN-NEXT: fcvt.h.s fs1, fa0
712 ; RV64IFZFHMIN-NEXT: fmv.s fa0, fs0
713 ; RV64IFZFHMIN-NEXT: call cosf
714 ; RV64IFZFHMIN-NEXT: fcvt.h.s fa5, fa0
715 ; RV64IFZFHMIN-NEXT: fcvt.s.h fa5, fa5
716 ; RV64IFZFHMIN-NEXT: fcvt.s.h fa4, fs1
717 ; RV64IFZFHMIN-NEXT: fadd.s fa5, fa4, fa5
718 ; RV64IFZFHMIN-NEXT: fcvt.h.s fa0, fa5
719 ; RV64IFZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
720 ; RV64IFZFHMIN-NEXT: flw fs0, 4(sp) # 4-byte Folded Reload
721 ; RV64IFZFHMIN-NEXT: flw fs1, 0(sp) # 4-byte Folded Reload
722 ; RV64IFZFHMIN-NEXT: addi sp, sp, 16
723 ; RV64IFZFHMIN-NEXT: ret
725 ; RV32IDZFHMIN-LABEL: sincos_f16:
726 ; RV32IDZFHMIN: # %bb.0:
727 ; RV32IDZFHMIN-NEXT: addi sp, sp, -32
728 ; RV32IDZFHMIN-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
729 ; RV32IDZFHMIN-NEXT: fsd fs0, 16(sp) # 8-byte Folded Spill
730 ; RV32IDZFHMIN-NEXT: fsd fs1, 8(sp) # 8-byte Folded Spill
731 ; RV32IDZFHMIN-NEXT: fcvt.s.h fs0, fa0
732 ; RV32IDZFHMIN-NEXT: fmv.s fa0, fs0
733 ; RV32IDZFHMIN-NEXT: call sinf
734 ; RV32IDZFHMIN-NEXT: fcvt.h.s fs1, fa0
735 ; RV32IDZFHMIN-NEXT: fmv.s fa0, fs0
736 ; RV32IDZFHMIN-NEXT: call cosf
737 ; RV32IDZFHMIN-NEXT: fcvt.h.s fa5, fa0
738 ; RV32IDZFHMIN-NEXT: fcvt.s.h fa5, fa5
739 ; RV32IDZFHMIN-NEXT: fcvt.s.h fa4, fs1
740 ; RV32IDZFHMIN-NEXT: fadd.s fa5, fa4, fa5
741 ; RV32IDZFHMIN-NEXT: fcvt.h.s fa0, fa5
742 ; RV32IDZFHMIN-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
743 ; RV32IDZFHMIN-NEXT: fld fs0, 16(sp) # 8-byte Folded Reload
744 ; RV32IDZFHMIN-NEXT: fld fs1, 8(sp) # 8-byte Folded Reload
745 ; RV32IDZFHMIN-NEXT: addi sp, sp, 32
746 ; RV32IDZFHMIN-NEXT: ret
748 ; RV64IDZFHMIN-LABEL: sincos_f16:
749 ; RV64IDZFHMIN: # %bb.0:
750 ; RV64IDZFHMIN-NEXT: addi sp, sp, -32
751 ; RV64IDZFHMIN-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
752 ; RV64IDZFHMIN-NEXT: fsd fs0, 16(sp) # 8-byte Folded Spill
753 ; RV64IDZFHMIN-NEXT: fsd fs1, 8(sp) # 8-byte Folded Spill
754 ; RV64IDZFHMIN-NEXT: fcvt.s.h fs0, fa0
755 ; RV64IDZFHMIN-NEXT: fmv.s fa0, fs0
756 ; RV64IDZFHMIN-NEXT: call sinf
757 ; RV64IDZFHMIN-NEXT: fcvt.h.s fs1, fa0
758 ; RV64IDZFHMIN-NEXT: fmv.s fa0, fs0
759 ; RV64IDZFHMIN-NEXT: call cosf
760 ; RV64IDZFHMIN-NEXT: fcvt.h.s fa5, fa0
761 ; RV64IDZFHMIN-NEXT: fcvt.s.h fa5, fa5
762 ; RV64IDZFHMIN-NEXT: fcvt.s.h fa4, fs1
763 ; RV64IDZFHMIN-NEXT: fadd.s fa5, fa4, fa5
764 ; RV64IDZFHMIN-NEXT: fcvt.h.s fa0, fa5
765 ; RV64IDZFHMIN-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
766 ; RV64IDZFHMIN-NEXT: fld fs0, 16(sp) # 8-byte Folded Reload
767 ; RV64IDZFHMIN-NEXT: fld fs1, 8(sp) # 8-byte Folded Reload
768 ; RV64IDZFHMIN-NEXT: addi sp, sp, 32
769 ; RV64IDZFHMIN-NEXT: ret
771 ; RV32IZHINXMIN-LABEL: sincos_f16:
772 ; RV32IZHINXMIN: # %bb.0:
773 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
774 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
775 ; RV32IZHINXMIN-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
776 ; RV32IZHINXMIN-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
777 ; RV32IZHINXMIN-NEXT: fcvt.s.h s0, a0
778 ; RV32IZHINXMIN-NEXT: mv a0, s0
779 ; RV32IZHINXMIN-NEXT: call sinf
780 ; RV32IZHINXMIN-NEXT: fcvt.h.s s1, a0
781 ; RV32IZHINXMIN-NEXT: mv a0, s0
782 ; RV32IZHINXMIN-NEXT: call cosf
783 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
784 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
785 ; RV32IZHINXMIN-NEXT: fcvt.s.h a1, s1
786 ; RV32IZHINXMIN-NEXT: fadd.s a0, a1, a0
787 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
788 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
789 ; RV32IZHINXMIN-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
790 ; RV32IZHINXMIN-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
791 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
792 ; RV32IZHINXMIN-NEXT: ret
794 ; RV64IZHINXMIN-LABEL: sincos_f16:
795 ; RV64IZHINXMIN: # %bb.0:
796 ; RV64IZHINXMIN-NEXT: addi sp, sp, -32
797 ; RV64IZHINXMIN-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
798 ; RV64IZHINXMIN-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
799 ; RV64IZHINXMIN-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
800 ; RV64IZHINXMIN-NEXT: fcvt.s.h s0, a0
801 ; RV64IZHINXMIN-NEXT: mv a0, s0
802 ; RV64IZHINXMIN-NEXT: call sinf
803 ; RV64IZHINXMIN-NEXT: fcvt.h.s s1, a0
804 ; RV64IZHINXMIN-NEXT: mv a0, s0
805 ; RV64IZHINXMIN-NEXT: call cosf
806 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
807 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
808 ; RV64IZHINXMIN-NEXT: fcvt.s.h a1, s1
809 ; RV64IZHINXMIN-NEXT: fadd.s a0, a1, a0
810 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
811 ; RV64IZHINXMIN-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
812 ; RV64IZHINXMIN-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
813 ; RV64IZHINXMIN-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
814 ; RV64IZHINXMIN-NEXT: addi sp, sp, 32
815 ; RV64IZHINXMIN-NEXT: ret
816 %1 = call half @llvm.sin.f16(half %a)
817 %2 = call half @llvm.cos.f16(half %a)
818 %3 = fadd half %1, %2
822 declare half @llvm.pow.f16(half, half)
824 define half @pow_f16(half %a, half %b) nounwind {
825 ; RV32IZFH-LABEL: pow_f16:
827 ; RV32IZFH-NEXT: addi sp, sp, -16
828 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
829 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
830 ; RV32IZFH-NEXT: fcvt.s.h fa1, fa1
831 ; RV32IZFH-NEXT: call powf
832 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
833 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
834 ; RV32IZFH-NEXT: addi sp, sp, 16
837 ; RV64IZFH-LABEL: pow_f16:
839 ; RV64IZFH-NEXT: addi sp, sp, -16
840 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
841 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
842 ; RV64IZFH-NEXT: fcvt.s.h fa1, fa1
843 ; RV64IZFH-NEXT: call powf
844 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
845 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
846 ; RV64IZFH-NEXT: addi sp, sp, 16
849 ; RV32IZHINX-LABEL: pow_f16:
850 ; RV32IZHINX: # %bb.0:
851 ; RV32IZHINX-NEXT: addi sp, sp, -16
852 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
853 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
854 ; RV32IZHINX-NEXT: fcvt.s.h a1, a1
855 ; RV32IZHINX-NEXT: call powf
856 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
857 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
858 ; RV32IZHINX-NEXT: addi sp, sp, 16
859 ; RV32IZHINX-NEXT: ret
861 ; RV64IZHINX-LABEL: pow_f16:
862 ; RV64IZHINX: # %bb.0:
863 ; RV64IZHINX-NEXT: addi sp, sp, -16
864 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
865 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
866 ; RV64IZHINX-NEXT: fcvt.s.h a1, a1
867 ; RV64IZHINX-NEXT: call powf
868 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
869 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
870 ; RV64IZHINX-NEXT: addi sp, sp, 16
871 ; RV64IZHINX-NEXT: ret
873 ; RV32I-LABEL: pow_f16:
875 ; RV32I-NEXT: addi sp, sp, -16
876 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
877 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
878 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
879 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
880 ; RV32I-NEXT: mv s0, a1
881 ; RV32I-NEXT: lui a1, 16
882 ; RV32I-NEXT: addi s2, a1, -1
883 ; RV32I-NEXT: and a0, a0, s2
884 ; RV32I-NEXT: call __extendhfsf2
885 ; RV32I-NEXT: mv s1, a0
886 ; RV32I-NEXT: and a0, s0, s2
887 ; RV32I-NEXT: call __extendhfsf2
888 ; RV32I-NEXT: mv a1, a0
889 ; RV32I-NEXT: mv a0, s1
890 ; RV32I-NEXT: call powf
891 ; RV32I-NEXT: call __truncsfhf2
892 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
893 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
894 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
895 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
896 ; RV32I-NEXT: addi sp, sp, 16
899 ; RV64I-LABEL: pow_f16:
901 ; RV64I-NEXT: addi sp, sp, -32
902 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
903 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
904 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
905 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
906 ; RV64I-NEXT: mv s0, a1
907 ; RV64I-NEXT: lui a1, 16
908 ; RV64I-NEXT: addiw s2, a1, -1
909 ; RV64I-NEXT: and a0, a0, s2
910 ; RV64I-NEXT: call __extendhfsf2
911 ; RV64I-NEXT: mv s1, a0
912 ; RV64I-NEXT: and a0, s0, s2
913 ; RV64I-NEXT: call __extendhfsf2
914 ; RV64I-NEXT: mv a1, a0
915 ; RV64I-NEXT: mv a0, s1
916 ; RV64I-NEXT: call powf
917 ; RV64I-NEXT: call __truncsfhf2
918 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
919 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
920 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
921 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
922 ; RV64I-NEXT: addi sp, sp, 32
925 ; RV32IZFHMIN-LABEL: pow_f16:
926 ; RV32IZFHMIN: # %bb.0:
927 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
928 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
929 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
930 ; RV32IZFHMIN-NEXT: fcvt.s.h fa1, fa1
931 ; RV32IZFHMIN-NEXT: call powf
932 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
933 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
934 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
935 ; RV32IZFHMIN-NEXT: ret
937 ; RV64IZFHMIN-LABEL: pow_f16:
938 ; RV64IZFHMIN: # %bb.0:
939 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
940 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
941 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
942 ; RV64IZFHMIN-NEXT: fcvt.s.h fa1, fa1
943 ; RV64IZFHMIN-NEXT: call powf
944 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
945 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
946 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
947 ; RV64IZFHMIN-NEXT: ret
949 ; RV32IZHINXMIN-LABEL: pow_f16:
950 ; RV32IZHINXMIN: # %bb.0:
951 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
952 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
953 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
954 ; RV32IZHINXMIN-NEXT: fcvt.s.h a1, a1
955 ; RV32IZHINXMIN-NEXT: call powf
956 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
957 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
958 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
959 ; RV32IZHINXMIN-NEXT: ret
961 ; RV64IZHINXMIN-LABEL: pow_f16:
962 ; RV64IZHINXMIN: # %bb.0:
963 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
964 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
965 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
966 ; RV64IZHINXMIN-NEXT: fcvt.s.h a1, a1
967 ; RV64IZHINXMIN-NEXT: call powf
968 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
969 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
970 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
971 ; RV64IZHINXMIN-NEXT: ret
972 %1 = call half @llvm.pow.f16(half %a, half %b)
976 declare half @llvm.exp.f16(half)
978 define half @exp_f16(half %a) nounwind {
979 ; RV32IZFH-LABEL: exp_f16:
981 ; RV32IZFH-NEXT: addi sp, sp, -16
982 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
983 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
984 ; RV32IZFH-NEXT: call expf
985 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
986 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
987 ; RV32IZFH-NEXT: addi sp, sp, 16
990 ; RV64IZFH-LABEL: exp_f16:
992 ; RV64IZFH-NEXT: addi sp, sp, -16
993 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
994 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
995 ; RV64IZFH-NEXT: call expf
996 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
997 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
998 ; RV64IZFH-NEXT: addi sp, sp, 16
1001 ; RV32IZHINX-LABEL: exp_f16:
1002 ; RV32IZHINX: # %bb.0:
1003 ; RV32IZHINX-NEXT: addi sp, sp, -16
1004 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1005 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
1006 ; RV32IZHINX-NEXT: call expf
1007 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
1008 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1009 ; RV32IZHINX-NEXT: addi sp, sp, 16
1010 ; RV32IZHINX-NEXT: ret
1012 ; RV64IZHINX-LABEL: exp_f16:
1013 ; RV64IZHINX: # %bb.0:
1014 ; RV64IZHINX-NEXT: addi sp, sp, -16
1015 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1016 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
1017 ; RV64IZHINX-NEXT: call expf
1018 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
1019 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1020 ; RV64IZHINX-NEXT: addi sp, sp, 16
1021 ; RV64IZHINX-NEXT: ret
1023 ; RV32I-LABEL: exp_f16:
1025 ; RV32I-NEXT: addi sp, sp, -16
1026 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1027 ; RV32I-NEXT: slli a0, a0, 16
1028 ; RV32I-NEXT: srli a0, a0, 16
1029 ; RV32I-NEXT: call __extendhfsf2
1030 ; RV32I-NEXT: call expf
1031 ; RV32I-NEXT: call __truncsfhf2
1032 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1033 ; RV32I-NEXT: addi sp, sp, 16
1036 ; RV64I-LABEL: exp_f16:
1038 ; RV64I-NEXT: addi sp, sp, -16
1039 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1040 ; RV64I-NEXT: slli a0, a0, 48
1041 ; RV64I-NEXT: srli a0, a0, 48
1042 ; RV64I-NEXT: call __extendhfsf2
1043 ; RV64I-NEXT: call expf
1044 ; RV64I-NEXT: call __truncsfhf2
1045 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1046 ; RV64I-NEXT: addi sp, sp, 16
1049 ; RV32IZFHMIN-LABEL: exp_f16:
1050 ; RV32IZFHMIN: # %bb.0:
1051 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
1052 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1053 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1054 ; RV32IZFHMIN-NEXT: call expf
1055 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1056 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1057 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
1058 ; RV32IZFHMIN-NEXT: ret
1060 ; RV64IZFHMIN-LABEL: exp_f16:
1061 ; RV64IZFHMIN: # %bb.0:
1062 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
1063 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1064 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1065 ; RV64IZFHMIN-NEXT: call expf
1066 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1067 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1068 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
1069 ; RV64IZFHMIN-NEXT: ret
1071 ; RV32IZHINXMIN-LABEL: exp_f16:
1072 ; RV32IZHINXMIN: # %bb.0:
1073 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
1074 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1075 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
1076 ; RV32IZHINXMIN-NEXT: call expf
1077 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
1078 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1079 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
1080 ; RV32IZHINXMIN-NEXT: ret
1082 ; RV64IZHINXMIN-LABEL: exp_f16:
1083 ; RV64IZHINXMIN: # %bb.0:
1084 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
1085 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1086 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
1087 ; RV64IZHINXMIN-NEXT: call expf
1088 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
1089 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1090 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
1091 ; RV64IZHINXMIN-NEXT: ret
1092 %1 = call half @llvm.exp.f16(half %a)
1096 declare half @llvm.exp2.f16(half)
1098 define half @exp2_f16(half %a) nounwind {
1099 ; RV32IZFH-LABEL: exp2_f16:
1100 ; RV32IZFH: # %bb.0:
1101 ; RV32IZFH-NEXT: addi sp, sp, -16
1102 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1103 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
1104 ; RV32IZFH-NEXT: call exp2f
1105 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
1106 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1107 ; RV32IZFH-NEXT: addi sp, sp, 16
1108 ; RV32IZFH-NEXT: ret
1110 ; RV64IZFH-LABEL: exp2_f16:
1111 ; RV64IZFH: # %bb.0:
1112 ; RV64IZFH-NEXT: addi sp, sp, -16
1113 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1114 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
1115 ; RV64IZFH-NEXT: call exp2f
1116 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
1117 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1118 ; RV64IZFH-NEXT: addi sp, sp, 16
1119 ; RV64IZFH-NEXT: ret
1121 ; RV32IZHINX-LABEL: exp2_f16:
1122 ; RV32IZHINX: # %bb.0:
1123 ; RV32IZHINX-NEXT: addi sp, sp, -16
1124 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1125 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
1126 ; RV32IZHINX-NEXT: call exp2f
1127 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
1128 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1129 ; RV32IZHINX-NEXT: addi sp, sp, 16
1130 ; RV32IZHINX-NEXT: ret
1132 ; RV64IZHINX-LABEL: exp2_f16:
1133 ; RV64IZHINX: # %bb.0:
1134 ; RV64IZHINX-NEXT: addi sp, sp, -16
1135 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1136 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
1137 ; RV64IZHINX-NEXT: call exp2f
1138 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
1139 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1140 ; RV64IZHINX-NEXT: addi sp, sp, 16
1141 ; RV64IZHINX-NEXT: ret
1143 ; RV32I-LABEL: exp2_f16:
1145 ; RV32I-NEXT: addi sp, sp, -16
1146 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1147 ; RV32I-NEXT: slli a0, a0, 16
1148 ; RV32I-NEXT: srli a0, a0, 16
1149 ; RV32I-NEXT: call __extendhfsf2
1150 ; RV32I-NEXT: call exp2f
1151 ; RV32I-NEXT: call __truncsfhf2
1152 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1153 ; RV32I-NEXT: addi sp, sp, 16
1156 ; RV64I-LABEL: exp2_f16:
1158 ; RV64I-NEXT: addi sp, sp, -16
1159 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1160 ; RV64I-NEXT: slli a0, a0, 48
1161 ; RV64I-NEXT: srli a0, a0, 48
1162 ; RV64I-NEXT: call __extendhfsf2
1163 ; RV64I-NEXT: call exp2f
1164 ; RV64I-NEXT: call __truncsfhf2
1165 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1166 ; RV64I-NEXT: addi sp, sp, 16
1169 ; RV32IZFHMIN-LABEL: exp2_f16:
1170 ; RV32IZFHMIN: # %bb.0:
1171 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
1172 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1173 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1174 ; RV32IZFHMIN-NEXT: call exp2f
1175 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1176 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1177 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
1178 ; RV32IZFHMIN-NEXT: ret
1180 ; RV64IZFHMIN-LABEL: exp2_f16:
1181 ; RV64IZFHMIN: # %bb.0:
1182 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
1183 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1184 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1185 ; RV64IZFHMIN-NEXT: call exp2f
1186 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1187 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1188 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
1189 ; RV64IZFHMIN-NEXT: ret
1191 ; RV32IZHINXMIN-LABEL: exp2_f16:
1192 ; RV32IZHINXMIN: # %bb.0:
1193 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
1194 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1195 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
1196 ; RV32IZHINXMIN-NEXT: call exp2f
1197 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
1198 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1199 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
1200 ; RV32IZHINXMIN-NEXT: ret
1202 ; RV64IZHINXMIN-LABEL: exp2_f16:
1203 ; RV64IZHINXMIN: # %bb.0:
1204 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
1205 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1206 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
1207 ; RV64IZHINXMIN-NEXT: call exp2f
1208 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
1209 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1210 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
1211 ; RV64IZHINXMIN-NEXT: ret
1212 %1 = call half @llvm.exp2.f16(half %a)
1216 declare half @llvm.log.f16(half)
1218 define half @log_f16(half %a) nounwind {
1219 ; RV32IZFH-LABEL: log_f16:
1220 ; RV32IZFH: # %bb.0:
1221 ; RV32IZFH-NEXT: addi sp, sp, -16
1222 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1223 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
1224 ; RV32IZFH-NEXT: call logf
1225 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
1226 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1227 ; RV32IZFH-NEXT: addi sp, sp, 16
1228 ; RV32IZFH-NEXT: ret
1230 ; RV64IZFH-LABEL: log_f16:
1231 ; RV64IZFH: # %bb.0:
1232 ; RV64IZFH-NEXT: addi sp, sp, -16
1233 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1234 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
1235 ; RV64IZFH-NEXT: call logf
1236 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
1237 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1238 ; RV64IZFH-NEXT: addi sp, sp, 16
1239 ; RV64IZFH-NEXT: ret
1241 ; RV32IZHINX-LABEL: log_f16:
1242 ; RV32IZHINX: # %bb.0:
1243 ; RV32IZHINX-NEXT: addi sp, sp, -16
1244 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1245 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
1246 ; RV32IZHINX-NEXT: call logf
1247 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
1248 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1249 ; RV32IZHINX-NEXT: addi sp, sp, 16
1250 ; RV32IZHINX-NEXT: ret
1252 ; RV64IZHINX-LABEL: log_f16:
1253 ; RV64IZHINX: # %bb.0:
1254 ; RV64IZHINX-NEXT: addi sp, sp, -16
1255 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1256 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
1257 ; RV64IZHINX-NEXT: call logf
1258 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
1259 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1260 ; RV64IZHINX-NEXT: addi sp, sp, 16
1261 ; RV64IZHINX-NEXT: ret
1263 ; RV32I-LABEL: log_f16:
1265 ; RV32I-NEXT: addi sp, sp, -16
1266 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1267 ; RV32I-NEXT: slli a0, a0, 16
1268 ; RV32I-NEXT: srli a0, a0, 16
1269 ; RV32I-NEXT: call __extendhfsf2
1270 ; RV32I-NEXT: call logf
1271 ; RV32I-NEXT: call __truncsfhf2
1272 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1273 ; RV32I-NEXT: addi sp, sp, 16
1276 ; RV64I-LABEL: log_f16:
1278 ; RV64I-NEXT: addi sp, sp, -16
1279 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1280 ; RV64I-NEXT: slli a0, a0, 48
1281 ; RV64I-NEXT: srli a0, a0, 48
1282 ; RV64I-NEXT: call __extendhfsf2
1283 ; RV64I-NEXT: call logf
1284 ; RV64I-NEXT: call __truncsfhf2
1285 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1286 ; RV64I-NEXT: addi sp, sp, 16
1289 ; RV32IZFHMIN-LABEL: log_f16:
1290 ; RV32IZFHMIN: # %bb.0:
1291 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
1292 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1293 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1294 ; RV32IZFHMIN-NEXT: call logf
1295 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1296 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1297 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
1298 ; RV32IZFHMIN-NEXT: ret
1300 ; RV64IZFHMIN-LABEL: log_f16:
1301 ; RV64IZFHMIN: # %bb.0:
1302 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
1303 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1304 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1305 ; RV64IZFHMIN-NEXT: call logf
1306 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1307 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1308 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
1309 ; RV64IZFHMIN-NEXT: ret
1311 ; RV32IZHINXMIN-LABEL: log_f16:
1312 ; RV32IZHINXMIN: # %bb.0:
1313 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
1314 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1315 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
1316 ; RV32IZHINXMIN-NEXT: call logf
1317 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
1318 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1319 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
1320 ; RV32IZHINXMIN-NEXT: ret
1322 ; RV64IZHINXMIN-LABEL: log_f16:
1323 ; RV64IZHINXMIN: # %bb.0:
1324 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
1325 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1326 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
1327 ; RV64IZHINXMIN-NEXT: call logf
1328 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
1329 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1330 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
1331 ; RV64IZHINXMIN-NEXT: ret
1332 %1 = call half @llvm.log.f16(half %a)
1336 declare half @llvm.log10.f16(half)
1338 define half @log10_f16(half %a) nounwind {
1339 ; RV32IZFH-LABEL: log10_f16:
1340 ; RV32IZFH: # %bb.0:
1341 ; RV32IZFH-NEXT: addi sp, sp, -16
1342 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1343 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
1344 ; RV32IZFH-NEXT: call log10f
1345 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
1346 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1347 ; RV32IZFH-NEXT: addi sp, sp, 16
1348 ; RV32IZFH-NEXT: ret
1350 ; RV64IZFH-LABEL: log10_f16:
1351 ; RV64IZFH: # %bb.0:
1352 ; RV64IZFH-NEXT: addi sp, sp, -16
1353 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1354 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
1355 ; RV64IZFH-NEXT: call log10f
1356 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
1357 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1358 ; RV64IZFH-NEXT: addi sp, sp, 16
1359 ; RV64IZFH-NEXT: ret
1361 ; RV32IZHINX-LABEL: log10_f16:
1362 ; RV32IZHINX: # %bb.0:
1363 ; RV32IZHINX-NEXT: addi sp, sp, -16
1364 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1365 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
1366 ; RV32IZHINX-NEXT: call log10f
1367 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
1368 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1369 ; RV32IZHINX-NEXT: addi sp, sp, 16
1370 ; RV32IZHINX-NEXT: ret
1372 ; RV64IZHINX-LABEL: log10_f16:
1373 ; RV64IZHINX: # %bb.0:
1374 ; RV64IZHINX-NEXT: addi sp, sp, -16
1375 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1376 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
1377 ; RV64IZHINX-NEXT: call log10f
1378 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
1379 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1380 ; RV64IZHINX-NEXT: addi sp, sp, 16
1381 ; RV64IZHINX-NEXT: ret
1383 ; RV32I-LABEL: log10_f16:
1385 ; RV32I-NEXT: addi sp, sp, -16
1386 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1387 ; RV32I-NEXT: slli a0, a0, 16
1388 ; RV32I-NEXT: srli a0, a0, 16
1389 ; RV32I-NEXT: call __extendhfsf2
1390 ; RV32I-NEXT: call log10f
1391 ; RV32I-NEXT: call __truncsfhf2
1392 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1393 ; RV32I-NEXT: addi sp, sp, 16
1396 ; RV64I-LABEL: log10_f16:
1398 ; RV64I-NEXT: addi sp, sp, -16
1399 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1400 ; RV64I-NEXT: slli a0, a0, 48
1401 ; RV64I-NEXT: srli a0, a0, 48
1402 ; RV64I-NEXT: call __extendhfsf2
1403 ; RV64I-NEXT: call log10f
1404 ; RV64I-NEXT: call __truncsfhf2
1405 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1406 ; RV64I-NEXT: addi sp, sp, 16
1409 ; RV32IZFHMIN-LABEL: log10_f16:
1410 ; RV32IZFHMIN: # %bb.0:
1411 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
1412 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1413 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1414 ; RV32IZFHMIN-NEXT: call log10f
1415 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1416 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1417 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
1418 ; RV32IZFHMIN-NEXT: ret
1420 ; RV64IZFHMIN-LABEL: log10_f16:
1421 ; RV64IZFHMIN: # %bb.0:
1422 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
1423 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1424 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1425 ; RV64IZFHMIN-NEXT: call log10f
1426 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1427 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1428 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
1429 ; RV64IZFHMIN-NEXT: ret
1431 ; RV32IZHINXMIN-LABEL: log10_f16:
1432 ; RV32IZHINXMIN: # %bb.0:
1433 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
1434 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1435 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
1436 ; RV32IZHINXMIN-NEXT: call log10f
1437 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
1438 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1439 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
1440 ; RV32IZHINXMIN-NEXT: ret
1442 ; RV64IZHINXMIN-LABEL: log10_f16:
1443 ; RV64IZHINXMIN: # %bb.0:
1444 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
1445 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1446 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
1447 ; RV64IZHINXMIN-NEXT: call log10f
1448 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
1449 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1450 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
1451 ; RV64IZHINXMIN-NEXT: ret
1452 %1 = call half @llvm.log10.f16(half %a)
1456 declare half @llvm.log2.f16(half)
1458 define half @log2_f16(half %a) nounwind {
1459 ; RV32IZFH-LABEL: log2_f16:
1460 ; RV32IZFH: # %bb.0:
1461 ; RV32IZFH-NEXT: addi sp, sp, -16
1462 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1463 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
1464 ; RV32IZFH-NEXT: call log2f
1465 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
1466 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1467 ; RV32IZFH-NEXT: addi sp, sp, 16
1468 ; RV32IZFH-NEXT: ret
1470 ; RV64IZFH-LABEL: log2_f16:
1471 ; RV64IZFH: # %bb.0:
1472 ; RV64IZFH-NEXT: addi sp, sp, -16
1473 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1474 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
1475 ; RV64IZFH-NEXT: call log2f
1476 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
1477 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1478 ; RV64IZFH-NEXT: addi sp, sp, 16
1479 ; RV64IZFH-NEXT: ret
1481 ; RV32IZHINX-LABEL: log2_f16:
1482 ; RV32IZHINX: # %bb.0:
1483 ; RV32IZHINX-NEXT: addi sp, sp, -16
1484 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1485 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
1486 ; RV32IZHINX-NEXT: call log2f
1487 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
1488 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1489 ; RV32IZHINX-NEXT: addi sp, sp, 16
1490 ; RV32IZHINX-NEXT: ret
1492 ; RV64IZHINX-LABEL: log2_f16:
1493 ; RV64IZHINX: # %bb.0:
1494 ; RV64IZHINX-NEXT: addi sp, sp, -16
1495 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1496 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
1497 ; RV64IZHINX-NEXT: call log2f
1498 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
1499 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1500 ; RV64IZHINX-NEXT: addi sp, sp, 16
1501 ; RV64IZHINX-NEXT: ret
1503 ; RV32I-LABEL: log2_f16:
1505 ; RV32I-NEXT: addi sp, sp, -16
1506 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1507 ; RV32I-NEXT: slli a0, a0, 16
1508 ; RV32I-NEXT: srli a0, a0, 16
1509 ; RV32I-NEXT: call __extendhfsf2
1510 ; RV32I-NEXT: call log2f
1511 ; RV32I-NEXT: call __truncsfhf2
1512 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1513 ; RV32I-NEXT: addi sp, sp, 16
1516 ; RV64I-LABEL: log2_f16:
1518 ; RV64I-NEXT: addi sp, sp, -16
1519 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1520 ; RV64I-NEXT: slli a0, a0, 48
1521 ; RV64I-NEXT: srli a0, a0, 48
1522 ; RV64I-NEXT: call __extendhfsf2
1523 ; RV64I-NEXT: call log2f
1524 ; RV64I-NEXT: call __truncsfhf2
1525 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1526 ; RV64I-NEXT: addi sp, sp, 16
1529 ; RV32IZFHMIN-LABEL: log2_f16:
1530 ; RV32IZFHMIN: # %bb.0:
1531 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
1532 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1533 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1534 ; RV32IZFHMIN-NEXT: call log2f
1535 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1536 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1537 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
1538 ; RV32IZFHMIN-NEXT: ret
1540 ; RV64IZFHMIN-LABEL: log2_f16:
1541 ; RV64IZFHMIN: # %bb.0:
1542 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
1543 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1544 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
1545 ; RV64IZFHMIN-NEXT: call log2f
1546 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
1547 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1548 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
1549 ; RV64IZFHMIN-NEXT: ret
1551 ; RV32IZHINXMIN-LABEL: log2_f16:
1552 ; RV32IZHINXMIN: # %bb.0:
1553 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
1554 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1555 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
1556 ; RV32IZHINXMIN-NEXT: call log2f
1557 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
1558 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1559 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
1560 ; RV32IZHINXMIN-NEXT: ret
1562 ; RV64IZHINXMIN-LABEL: log2_f16:
1563 ; RV64IZHINXMIN: # %bb.0:
1564 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
1565 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1566 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
1567 ; RV64IZHINXMIN-NEXT: call log2f
1568 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
1569 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1570 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
1571 ; RV64IZHINXMIN-NEXT: ret
1572 %1 = call half @llvm.log2.f16(half %a)
1576 declare half @llvm.fma.f16(half, half, half)
1578 define half @fma_f16(half %a, half %b, half %c) nounwind {
1579 ; CHECKIZFH-LABEL: fma_f16:
1580 ; CHECKIZFH: # %bb.0:
1581 ; CHECKIZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2
1582 ; CHECKIZFH-NEXT: ret
1584 ; CHECKIZHINX-LABEL: fma_f16:
1585 ; CHECKIZHINX: # %bb.0:
1586 ; CHECKIZHINX-NEXT: fmadd.h a0, a0, a1, a2
1587 ; CHECKIZHINX-NEXT: ret
1589 ; RV32I-LABEL: fma_f16:
1591 ; RV32I-NEXT: addi sp, sp, -32
1592 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
1593 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
1594 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
1595 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
1596 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
1597 ; RV32I-NEXT: mv s0, a2
1598 ; RV32I-NEXT: mv s1, a1
1599 ; RV32I-NEXT: lui a1, 16
1600 ; RV32I-NEXT: addi s3, a1, -1
1601 ; RV32I-NEXT: and a0, a0, s3
1602 ; RV32I-NEXT: call __extendhfsf2
1603 ; RV32I-NEXT: mv s2, a0
1604 ; RV32I-NEXT: and a0, s1, s3
1605 ; RV32I-NEXT: call __extendhfsf2
1606 ; RV32I-NEXT: mv s1, a0
1607 ; RV32I-NEXT: and a0, s0, s3
1608 ; RV32I-NEXT: call __extendhfsf2
1609 ; RV32I-NEXT: mv a2, a0
1610 ; RV32I-NEXT: mv a0, s2
1611 ; RV32I-NEXT: mv a1, s1
1612 ; RV32I-NEXT: call fmaf
1613 ; RV32I-NEXT: call __truncsfhf2
1614 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
1615 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
1616 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
1617 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
1618 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
1619 ; RV32I-NEXT: addi sp, sp, 32
1622 ; RV64I-LABEL: fma_f16:
1624 ; RV64I-NEXT: addi sp, sp, -48
1625 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
1626 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
1627 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
1628 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
1629 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
1630 ; RV64I-NEXT: mv s0, a2
1631 ; RV64I-NEXT: mv s1, a1
1632 ; RV64I-NEXT: lui a1, 16
1633 ; RV64I-NEXT: addiw s3, a1, -1
1634 ; RV64I-NEXT: and a0, a0, s3
1635 ; RV64I-NEXT: call __extendhfsf2
1636 ; RV64I-NEXT: mv s2, a0
1637 ; RV64I-NEXT: and a0, s1, s3
1638 ; RV64I-NEXT: call __extendhfsf2
1639 ; RV64I-NEXT: mv s1, a0
1640 ; RV64I-NEXT: and a0, s0, s3
1641 ; RV64I-NEXT: call __extendhfsf2
1642 ; RV64I-NEXT: mv a2, a0
1643 ; RV64I-NEXT: mv a0, s2
1644 ; RV64I-NEXT: mv a1, s1
1645 ; RV64I-NEXT: call fmaf
1646 ; RV64I-NEXT: call __truncsfhf2
1647 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
1648 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
1649 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
1650 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
1651 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
1652 ; RV64I-NEXT: addi sp, sp, 48
1655 ; CHECKIZFHMIN-LABEL: fma_f16:
1656 ; CHECKIZFHMIN: # %bb.0:
1657 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa2
1658 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa1
1659 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa3, fa0
1660 ; CHECKIZFHMIN-NEXT: fmadd.s fa5, fa3, fa4, fa5
1661 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
1662 ; CHECKIZFHMIN-NEXT: ret
1664 ; CHECKIZHINXMIN-LABEL: fma_f16:
1665 ; CHECKIZHINXMIN: # %bb.0:
1666 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a2, a2
1667 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a1
1668 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
1669 ; CHECKIZHINXMIN-NEXT: fmadd.s a0, a0, a1, a2
1670 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
1671 ; CHECKIZHINXMIN-NEXT: ret
1672 %1 = call half @llvm.fma.f16(half %a, half %b, half %c)
1676 declare half @llvm.fmuladd.f16(half, half, half)
1678 define half @fmuladd_f16(half %a, half %b, half %c) nounwind {
1679 ; CHECKIZFH-LABEL: fmuladd_f16:
1680 ; CHECKIZFH: # %bb.0:
1681 ; CHECKIZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2
1682 ; CHECKIZFH-NEXT: ret
1684 ; CHECKIZHINX-LABEL: fmuladd_f16:
1685 ; CHECKIZHINX: # %bb.0:
1686 ; CHECKIZHINX-NEXT: fmadd.h a0, a0, a1, a2
1687 ; CHECKIZHINX-NEXT: ret
1689 ; RV32I-LABEL: fmuladd_f16:
1691 ; RV32I-NEXT: addi sp, sp, -32
1692 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
1693 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
1694 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
1695 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
1696 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
1697 ; RV32I-NEXT: mv s0, a2
1698 ; RV32I-NEXT: mv s1, a1
1699 ; RV32I-NEXT: lui a1, 16
1700 ; RV32I-NEXT: addi s3, a1, -1
1701 ; RV32I-NEXT: and a0, a0, s3
1702 ; RV32I-NEXT: call __extendhfsf2
1703 ; RV32I-NEXT: mv s2, a0
1704 ; RV32I-NEXT: and a0, s1, s3
1705 ; RV32I-NEXT: call __extendhfsf2
1706 ; RV32I-NEXT: mv a1, a0
1707 ; RV32I-NEXT: mv a0, s2
1708 ; RV32I-NEXT: call __mulsf3
1709 ; RV32I-NEXT: call __truncsfhf2
1710 ; RV32I-NEXT: mv s1, a0
1711 ; RV32I-NEXT: and a0, s0, s3
1712 ; RV32I-NEXT: call __extendhfsf2
1713 ; RV32I-NEXT: mv s0, a0
1714 ; RV32I-NEXT: and a0, s1, s3
1715 ; RV32I-NEXT: call __extendhfsf2
1716 ; RV32I-NEXT: mv a1, s0
1717 ; RV32I-NEXT: call __addsf3
1718 ; RV32I-NEXT: call __truncsfhf2
1719 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
1720 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
1721 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
1722 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
1723 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
1724 ; RV32I-NEXT: addi sp, sp, 32
1727 ; RV64I-LABEL: fmuladd_f16:
1729 ; RV64I-NEXT: addi sp, sp, -48
1730 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
1731 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
1732 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
1733 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
1734 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
1735 ; RV64I-NEXT: mv s0, a2
1736 ; RV64I-NEXT: mv s1, a1
1737 ; RV64I-NEXT: lui a1, 16
1738 ; RV64I-NEXT: addiw s3, a1, -1
1739 ; RV64I-NEXT: and a0, a0, s3
1740 ; RV64I-NEXT: call __extendhfsf2
1741 ; RV64I-NEXT: mv s2, a0
1742 ; RV64I-NEXT: and a0, s1, s3
1743 ; RV64I-NEXT: call __extendhfsf2
1744 ; RV64I-NEXT: mv a1, a0
1745 ; RV64I-NEXT: mv a0, s2
1746 ; RV64I-NEXT: call __mulsf3
1747 ; RV64I-NEXT: call __truncsfhf2
1748 ; RV64I-NEXT: mv s1, a0
1749 ; RV64I-NEXT: and a0, s0, s3
1750 ; RV64I-NEXT: call __extendhfsf2
1751 ; RV64I-NEXT: mv s0, a0
1752 ; RV64I-NEXT: and a0, s1, s3
1753 ; RV64I-NEXT: call __extendhfsf2
1754 ; RV64I-NEXT: mv a1, s0
1755 ; RV64I-NEXT: call __addsf3
1756 ; RV64I-NEXT: call __truncsfhf2
1757 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
1758 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
1759 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
1760 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
1761 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
1762 ; RV64I-NEXT: addi sp, sp, 48
1765 ; CHECKIZFHMIN-LABEL: fmuladd_f16:
1766 ; CHECKIZFHMIN: # %bb.0:
1767 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa1
1768 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa0
1769 ; CHECKIZFHMIN-NEXT: fmul.s fa5, fa4, fa5
1770 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa5, fa5
1771 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa5
1772 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa2
1773 ; CHECKIZFHMIN-NEXT: fadd.s fa5, fa5, fa4
1774 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
1775 ; CHECKIZFHMIN-NEXT: ret
1777 ; CHECKIZHINXMIN-LABEL: fmuladd_f16:
1778 ; CHECKIZHINXMIN: # %bb.0:
1779 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a1
1780 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
1781 ; CHECKIZHINXMIN-NEXT: fmul.s a0, a0, a1
1782 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
1783 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
1784 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a2
1785 ; CHECKIZHINXMIN-NEXT: fadd.s a0, a0, a1
1786 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
1787 ; CHECKIZHINXMIN-NEXT: ret
1788 %1 = call half @llvm.fmuladd.f16(half %a, half %b, half %c)
1792 declare half @llvm.fabs.f16(half)
1794 define half @fabs_f16(half %a) nounwind {
1795 ; CHECKIZFH-LABEL: fabs_f16:
1796 ; CHECKIZFH: # %bb.0:
1797 ; CHECKIZFH-NEXT: fabs.h fa0, fa0
1798 ; CHECKIZFH-NEXT: ret
1800 ; CHECKIZHINX-LABEL: fabs_f16:
1801 ; CHECKIZHINX: # %bb.0:
1802 ; CHECKIZHINX-NEXT: fabs.h a0, a0
1803 ; CHECKIZHINX-NEXT: ret
1805 ; RV32I-LABEL: fabs_f16:
1807 ; RV32I-NEXT: slli a0, a0, 17
1808 ; RV32I-NEXT: srli a0, a0, 17
1811 ; RV64I-LABEL: fabs_f16:
1813 ; RV64I-NEXT: slli a0, a0, 49
1814 ; RV64I-NEXT: srli a0, a0, 49
1817 ; RV32IZFHMIN-LABEL: fabs_f16:
1818 ; RV32IZFHMIN: # %bb.0:
1819 ; RV32IZFHMIN-NEXT: fmv.x.h a0, fa0
1820 ; RV32IZFHMIN-NEXT: slli a0, a0, 17
1821 ; RV32IZFHMIN-NEXT: srli a0, a0, 17
1822 ; RV32IZFHMIN-NEXT: fmv.h.x fa0, a0
1823 ; RV32IZFHMIN-NEXT: ret
1825 ; RV64IZFHMIN-LABEL: fabs_f16:
1826 ; RV64IZFHMIN: # %bb.0:
1827 ; RV64IZFHMIN-NEXT: fmv.x.h a0, fa0
1828 ; RV64IZFHMIN-NEXT: slli a0, a0, 49
1829 ; RV64IZFHMIN-NEXT: srli a0, a0, 49
1830 ; RV64IZFHMIN-NEXT: fmv.h.x fa0, a0
1831 ; RV64IZFHMIN-NEXT: ret
1833 ; RV32IZHINXMIN-LABEL: fabs_f16:
1834 ; RV32IZHINXMIN: # %bb.0:
1835 ; RV32IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h def $x10
1836 ; RV32IZHINXMIN-NEXT: slli a0, a0, 17
1837 ; RV32IZHINXMIN-NEXT: srli a0, a0, 17
1838 ; RV32IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h killed $x10
1839 ; RV32IZHINXMIN-NEXT: ret
1841 ; RV64IZHINXMIN-LABEL: fabs_f16:
1842 ; RV64IZHINXMIN: # %bb.0:
1843 ; RV64IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h def $x10
1844 ; RV64IZHINXMIN-NEXT: slli a0, a0, 49
1845 ; RV64IZHINXMIN-NEXT: srli a0, a0, 49
1846 ; RV64IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h killed $x10
1847 ; RV64IZHINXMIN-NEXT: ret
1848 %1 = call half @llvm.fabs.f16(half %a)
1852 declare half @llvm.minnum.f16(half, half)
1854 define half @minnum_f16(half %a, half %b) nounwind {
1855 ; CHECKIZFH-LABEL: minnum_f16:
1856 ; CHECKIZFH: # %bb.0:
1857 ; CHECKIZFH-NEXT: fmin.h fa0, fa0, fa1
1858 ; CHECKIZFH-NEXT: ret
1860 ; CHECKIZHINX-LABEL: minnum_f16:
1861 ; CHECKIZHINX: # %bb.0:
1862 ; CHECKIZHINX-NEXT: fmin.h a0, a0, a1
1863 ; CHECKIZHINX-NEXT: ret
1865 ; RV32I-LABEL: minnum_f16:
1867 ; RV32I-NEXT: addi sp, sp, -16
1868 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1869 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1870 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
1871 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
1872 ; RV32I-NEXT: mv s0, a1
1873 ; RV32I-NEXT: lui a1, 16
1874 ; RV32I-NEXT: addi s2, a1, -1
1875 ; RV32I-NEXT: and a0, a0, s2
1876 ; RV32I-NEXT: call __extendhfsf2
1877 ; RV32I-NEXT: mv s1, a0
1878 ; RV32I-NEXT: and a0, s0, s2
1879 ; RV32I-NEXT: call __extendhfsf2
1880 ; RV32I-NEXT: mv a1, a0
1881 ; RV32I-NEXT: mv a0, s1
1882 ; RV32I-NEXT: call fminf
1883 ; RV32I-NEXT: call __truncsfhf2
1884 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1885 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1886 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
1887 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
1888 ; RV32I-NEXT: addi sp, sp, 16
1891 ; RV64I-LABEL: minnum_f16:
1893 ; RV64I-NEXT: addi sp, sp, -32
1894 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
1895 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
1896 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
1897 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
1898 ; RV64I-NEXT: mv s0, a1
1899 ; RV64I-NEXT: lui a1, 16
1900 ; RV64I-NEXT: addiw s2, a1, -1
1901 ; RV64I-NEXT: and a0, a0, s2
1902 ; RV64I-NEXT: call __extendhfsf2
1903 ; RV64I-NEXT: mv s1, a0
1904 ; RV64I-NEXT: and a0, s0, s2
1905 ; RV64I-NEXT: call __extendhfsf2
1906 ; RV64I-NEXT: mv a1, a0
1907 ; RV64I-NEXT: mv a0, s1
1908 ; RV64I-NEXT: call fminf
1909 ; RV64I-NEXT: call __truncsfhf2
1910 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
1911 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
1912 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
1913 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
1914 ; RV64I-NEXT: addi sp, sp, 32
1917 ; CHECKIZFHMIN-LABEL: minnum_f16:
1918 ; CHECKIZFHMIN: # %bb.0:
1919 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa1
1920 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa0
1921 ; CHECKIZFHMIN-NEXT: fmin.s fa5, fa4, fa5
1922 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
1923 ; CHECKIZFHMIN-NEXT: ret
1925 ; CHECKIZHINXMIN-LABEL: minnum_f16:
1926 ; CHECKIZHINXMIN: # %bb.0:
1927 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a1
1928 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
1929 ; CHECKIZHINXMIN-NEXT: fmin.s a0, a0, a1
1930 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
1931 ; CHECKIZHINXMIN-NEXT: ret
1932 %1 = call half @llvm.minnum.f16(half %a, half %b)
1936 declare half @llvm.maxnum.f16(half, half)
1938 define half @maxnum_f16(half %a, half %b) nounwind {
1939 ; CHECKIZFH-LABEL: maxnum_f16:
1940 ; CHECKIZFH: # %bb.0:
1941 ; CHECKIZFH-NEXT: fmax.h fa0, fa0, fa1
1942 ; CHECKIZFH-NEXT: ret
1944 ; CHECKIZHINX-LABEL: maxnum_f16:
1945 ; CHECKIZHINX: # %bb.0:
1946 ; CHECKIZHINX-NEXT: fmax.h a0, a0, a1
1947 ; CHECKIZHINX-NEXT: ret
1949 ; RV32I-LABEL: maxnum_f16:
1951 ; RV32I-NEXT: addi sp, sp, -16
1952 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1953 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1954 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
1955 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
1956 ; RV32I-NEXT: mv s0, a1
1957 ; RV32I-NEXT: lui a1, 16
1958 ; RV32I-NEXT: addi s2, a1, -1
1959 ; RV32I-NEXT: and a0, a0, s2
1960 ; RV32I-NEXT: call __extendhfsf2
1961 ; RV32I-NEXT: mv s1, a0
1962 ; RV32I-NEXT: and a0, s0, s2
1963 ; RV32I-NEXT: call __extendhfsf2
1964 ; RV32I-NEXT: mv a1, a0
1965 ; RV32I-NEXT: mv a0, s1
1966 ; RV32I-NEXT: call fmaxf
1967 ; RV32I-NEXT: call __truncsfhf2
1968 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1969 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1970 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
1971 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
1972 ; RV32I-NEXT: addi sp, sp, 16
1975 ; RV64I-LABEL: maxnum_f16:
1977 ; RV64I-NEXT: addi sp, sp, -32
1978 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
1979 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
1980 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
1981 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
1982 ; RV64I-NEXT: mv s0, a1
1983 ; RV64I-NEXT: lui a1, 16
1984 ; RV64I-NEXT: addiw s2, a1, -1
1985 ; RV64I-NEXT: and a0, a0, s2
1986 ; RV64I-NEXT: call __extendhfsf2
1987 ; RV64I-NEXT: mv s1, a0
1988 ; RV64I-NEXT: and a0, s0, s2
1989 ; RV64I-NEXT: call __extendhfsf2
1990 ; RV64I-NEXT: mv a1, a0
1991 ; RV64I-NEXT: mv a0, s1
1992 ; RV64I-NEXT: call fmaxf
1993 ; RV64I-NEXT: call __truncsfhf2
1994 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
1995 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
1996 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
1997 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
1998 ; RV64I-NEXT: addi sp, sp, 32
2001 ; CHECKIZFHMIN-LABEL: maxnum_f16:
2002 ; CHECKIZFHMIN: # %bb.0:
2003 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa1
2004 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa0
2005 ; CHECKIZFHMIN-NEXT: fmax.s fa5, fa4, fa5
2006 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2007 ; CHECKIZFHMIN-NEXT: ret
2009 ; CHECKIZHINXMIN-LABEL: maxnum_f16:
2010 ; CHECKIZHINXMIN: # %bb.0:
2011 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a1
2012 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2013 ; CHECKIZHINXMIN-NEXT: fmax.s a0, a0, a1
2014 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2015 ; CHECKIZHINXMIN-NEXT: ret
2016 %1 = call half @llvm.maxnum.f16(half %a, half %b)
2020 ; TODO: FMINNAN and FMAXNAN aren't handled in
2021 ; SelectionDAGLegalize::ExpandNode.
2023 ; declare half @llvm.minimum.f16(half, half)
2025 ; define half @fminimum_f16(half %a, half %b) nounwind {
2026 ; %1 = call half @llvm.minimum.f16(half %a, half %b)
2030 ; declare half @llvm.maximum.f16(half, half)
2032 ; define half @fmaximum_f16(half %a, half %b) nounwind {
2033 ; %1 = call half @llvm.maximum.f16(half %a, half %b)
2037 declare half @llvm.copysign.f16(half, half)
2039 define half @copysign_f16(half %a, half %b) nounwind {
2040 ; CHECKIZFH-LABEL: copysign_f16:
2041 ; CHECKIZFH: # %bb.0:
2042 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa0, fa1
2043 ; CHECKIZFH-NEXT: ret
2045 ; CHECKIZHINX-LABEL: copysign_f16:
2046 ; CHECKIZHINX: # %bb.0:
2047 ; CHECKIZHINX-NEXT: fsgnj.h a0, a0, a1
2048 ; CHECKIZHINX-NEXT: ret
2050 ; RV32I-LABEL: copysign_f16:
2052 ; RV32I-NEXT: lui a2, 1048568
2053 ; RV32I-NEXT: slli a0, a0, 17
2054 ; RV32I-NEXT: and a1, a1, a2
2055 ; RV32I-NEXT: srli a0, a0, 17
2056 ; RV32I-NEXT: or a0, a0, a1
2059 ; RV64I-LABEL: copysign_f16:
2061 ; RV64I-NEXT: lui a2, 1048568
2062 ; RV64I-NEXT: slli a0, a0, 49
2063 ; RV64I-NEXT: and a1, a1, a2
2064 ; RV64I-NEXT: srli a0, a0, 49
2065 ; RV64I-NEXT: or a0, a0, a1
2068 ; RV32IZFHMIN-LABEL: copysign_f16:
2069 ; RV32IZFHMIN: # %bb.0:
2070 ; RV32IZFHMIN-NEXT: fmv.x.h a0, fa1
2071 ; RV32IZFHMIN-NEXT: lui a1, 1048568
2072 ; RV32IZFHMIN-NEXT: and a0, a0, a1
2073 ; RV32IZFHMIN-NEXT: fmv.x.h a1, fa0
2074 ; RV32IZFHMIN-NEXT: slli a1, a1, 17
2075 ; RV32IZFHMIN-NEXT: srli a1, a1, 17
2076 ; RV32IZFHMIN-NEXT: or a0, a1, a0
2077 ; RV32IZFHMIN-NEXT: fmv.h.x fa0, a0
2078 ; RV32IZFHMIN-NEXT: ret
2080 ; RV64IZFHMIN-LABEL: copysign_f16:
2081 ; RV64IZFHMIN: # %bb.0:
2082 ; RV64IZFHMIN-NEXT: fmv.x.h a0, fa1
2083 ; RV64IZFHMIN-NEXT: lui a1, 1048568
2084 ; RV64IZFHMIN-NEXT: and a0, a0, a1
2085 ; RV64IZFHMIN-NEXT: fmv.x.h a1, fa0
2086 ; RV64IZFHMIN-NEXT: slli a1, a1, 49
2087 ; RV64IZFHMIN-NEXT: srli a1, a1, 49
2088 ; RV64IZFHMIN-NEXT: or a0, a1, a0
2089 ; RV64IZFHMIN-NEXT: fmv.h.x fa0, a0
2090 ; RV64IZFHMIN-NEXT: ret
2092 ; RV32IZHINXMIN-LABEL: copysign_f16:
2093 ; RV32IZHINXMIN: # %bb.0:
2094 ; RV32IZHINXMIN-NEXT: # kill: def $x11_h killed $x11_h def $x11
2095 ; RV32IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h def $x10
2096 ; RV32IZHINXMIN-NEXT: lui a2, 1048568
2097 ; RV32IZHINXMIN-NEXT: slli a0, a0, 17
2098 ; RV32IZHINXMIN-NEXT: and a1, a1, a2
2099 ; RV32IZHINXMIN-NEXT: srli a0, a0, 17
2100 ; RV32IZHINXMIN-NEXT: or a0, a0, a1
2101 ; RV32IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h killed $x10
2102 ; RV32IZHINXMIN-NEXT: ret
2104 ; RV64IZHINXMIN-LABEL: copysign_f16:
2105 ; RV64IZHINXMIN: # %bb.0:
2106 ; RV64IZHINXMIN-NEXT: # kill: def $x11_h killed $x11_h def $x11
2107 ; RV64IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h def $x10
2108 ; RV64IZHINXMIN-NEXT: lui a2, 1048568
2109 ; RV64IZHINXMIN-NEXT: slli a0, a0, 49
2110 ; RV64IZHINXMIN-NEXT: and a1, a1, a2
2111 ; RV64IZHINXMIN-NEXT: srli a0, a0, 49
2112 ; RV64IZHINXMIN-NEXT: or a0, a0, a1
2113 ; RV64IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h killed $x10
2114 ; RV64IZHINXMIN-NEXT: ret
2115 %1 = call half @llvm.copysign.f16(half %a, half %b)
2119 declare half @llvm.floor.f16(half)
2121 define half @floor_f16(half %a) nounwind {
2122 ; CHECKIZFH-LABEL: floor_f16:
2123 ; CHECKIZFH: # %bb.0:
2124 ; CHECKIZFH-NEXT: lui a0, %hi(.LCPI17_0)
2125 ; CHECKIZFH-NEXT: flh fa5, %lo(.LCPI17_0)(a0)
2126 ; CHECKIZFH-NEXT: fabs.h fa4, fa0
2127 ; CHECKIZFH-NEXT: flt.h a0, fa4, fa5
2128 ; CHECKIZFH-NEXT: beqz a0, .LBB17_2
2129 ; CHECKIZFH-NEXT: # %bb.1:
2130 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rdn
2131 ; CHECKIZFH-NEXT: fcvt.h.w fa5, a0, rdn
2132 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa5, fa0
2133 ; CHECKIZFH-NEXT: .LBB17_2:
2134 ; CHECKIZFH-NEXT: ret
2136 ; CHECKIZHINX-LABEL: floor_f16:
2137 ; CHECKIZHINX: # %bb.0:
2138 ; CHECKIZHINX-NEXT: li a1, 25
2139 ; CHECKIZHINX-NEXT: slli a1, a1, 10
2140 ; CHECKIZHINX-NEXT: fabs.h a2, a0
2141 ; CHECKIZHINX-NEXT: flt.h a1, a2, a1
2142 ; CHECKIZHINX-NEXT: beqz a1, .LBB17_2
2143 ; CHECKIZHINX-NEXT: # %bb.1:
2144 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rdn
2145 ; CHECKIZHINX-NEXT: fcvt.h.w a1, a1, rdn
2146 ; CHECKIZHINX-NEXT: fsgnj.h a0, a1, a0
2147 ; CHECKIZHINX-NEXT: .LBB17_2:
2148 ; CHECKIZHINX-NEXT: ret
2150 ; RV32I-LABEL: floor_f16:
2152 ; RV32I-NEXT: addi sp, sp, -16
2153 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2154 ; RV32I-NEXT: slli a0, a0, 16
2155 ; RV32I-NEXT: srli a0, a0, 16
2156 ; RV32I-NEXT: call __extendhfsf2
2157 ; RV32I-NEXT: call floorf
2158 ; RV32I-NEXT: call __truncsfhf2
2159 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2160 ; RV32I-NEXT: addi sp, sp, 16
2163 ; RV64I-LABEL: floor_f16:
2165 ; RV64I-NEXT: addi sp, sp, -16
2166 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2167 ; RV64I-NEXT: slli a0, a0, 48
2168 ; RV64I-NEXT: srli a0, a0, 48
2169 ; RV64I-NEXT: call __extendhfsf2
2170 ; RV64I-NEXT: call floorf
2171 ; RV64I-NEXT: call __truncsfhf2
2172 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2173 ; RV64I-NEXT: addi sp, sp, 16
2176 ; CHECKIZFHMIN-LABEL: floor_f16:
2177 ; CHECKIZFHMIN: # %bb.0:
2178 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
2179 ; CHECKIZFHMIN-NEXT: lui a0, 307200
2180 ; CHECKIZFHMIN-NEXT: fmv.w.x fa4, a0
2181 ; CHECKIZFHMIN-NEXT: fabs.s fa3, fa5
2182 ; CHECKIZFHMIN-NEXT: flt.s a0, fa3, fa4
2183 ; CHECKIZFHMIN-NEXT: beqz a0, .LBB17_2
2184 ; CHECKIZFHMIN-NEXT: # %bb.1:
2185 ; CHECKIZFHMIN-NEXT: fcvt.w.s a0, fa5, rdn
2186 ; CHECKIZFHMIN-NEXT: fcvt.s.w fa4, a0, rdn
2187 ; CHECKIZFHMIN-NEXT: fsgnj.s fa5, fa4, fa5
2188 ; CHECKIZFHMIN-NEXT: .LBB17_2:
2189 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2190 ; CHECKIZFHMIN-NEXT: ret
2192 ; CHECKIZHINXMIN-LABEL: floor_f16:
2193 ; CHECKIZHINXMIN: # %bb.0:
2194 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2195 ; CHECKIZHINXMIN-NEXT: lui a1, 307200
2196 ; CHECKIZHINXMIN-NEXT: fabs.s a2, a0
2197 ; CHECKIZHINXMIN-NEXT: flt.s a1, a2, a1
2198 ; CHECKIZHINXMIN-NEXT: beqz a1, .LBB17_2
2199 ; CHECKIZHINXMIN-NEXT: # %bb.1:
2200 ; CHECKIZHINXMIN-NEXT: fcvt.w.s a1, a0, rdn
2201 ; CHECKIZHINXMIN-NEXT: fcvt.s.w a1, a1, rdn
2202 ; CHECKIZHINXMIN-NEXT: fsgnj.s a0, a1, a0
2203 ; CHECKIZHINXMIN-NEXT: .LBB17_2:
2204 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2205 ; CHECKIZHINXMIN-NEXT: ret
2206 %1 = call half @llvm.floor.f16(half %a)
2210 declare half @llvm.ceil.f16(half)
2212 define half @ceil_f16(half %a) nounwind {
2213 ; CHECKIZFH-LABEL: ceil_f16:
2214 ; CHECKIZFH: # %bb.0:
2215 ; CHECKIZFH-NEXT: lui a0, %hi(.LCPI18_0)
2216 ; CHECKIZFH-NEXT: flh fa5, %lo(.LCPI18_0)(a0)
2217 ; CHECKIZFH-NEXT: fabs.h fa4, fa0
2218 ; CHECKIZFH-NEXT: flt.h a0, fa4, fa5
2219 ; CHECKIZFH-NEXT: beqz a0, .LBB18_2
2220 ; CHECKIZFH-NEXT: # %bb.1:
2221 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rup
2222 ; CHECKIZFH-NEXT: fcvt.h.w fa5, a0, rup
2223 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa5, fa0
2224 ; CHECKIZFH-NEXT: .LBB18_2:
2225 ; CHECKIZFH-NEXT: ret
2227 ; CHECKIZHINX-LABEL: ceil_f16:
2228 ; CHECKIZHINX: # %bb.0:
2229 ; CHECKIZHINX-NEXT: li a1, 25
2230 ; CHECKIZHINX-NEXT: slli a1, a1, 10
2231 ; CHECKIZHINX-NEXT: fabs.h a2, a0
2232 ; CHECKIZHINX-NEXT: flt.h a1, a2, a1
2233 ; CHECKIZHINX-NEXT: beqz a1, .LBB18_2
2234 ; CHECKIZHINX-NEXT: # %bb.1:
2235 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rup
2236 ; CHECKIZHINX-NEXT: fcvt.h.w a1, a1, rup
2237 ; CHECKIZHINX-NEXT: fsgnj.h a0, a1, a0
2238 ; CHECKIZHINX-NEXT: .LBB18_2:
2239 ; CHECKIZHINX-NEXT: ret
2241 ; RV32I-LABEL: ceil_f16:
2243 ; RV32I-NEXT: addi sp, sp, -16
2244 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2245 ; RV32I-NEXT: slli a0, a0, 16
2246 ; RV32I-NEXT: srli a0, a0, 16
2247 ; RV32I-NEXT: call __extendhfsf2
2248 ; RV32I-NEXT: call ceilf
2249 ; RV32I-NEXT: call __truncsfhf2
2250 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2251 ; RV32I-NEXT: addi sp, sp, 16
2254 ; RV64I-LABEL: ceil_f16:
2256 ; RV64I-NEXT: addi sp, sp, -16
2257 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2258 ; RV64I-NEXT: slli a0, a0, 48
2259 ; RV64I-NEXT: srli a0, a0, 48
2260 ; RV64I-NEXT: call __extendhfsf2
2261 ; RV64I-NEXT: call ceilf
2262 ; RV64I-NEXT: call __truncsfhf2
2263 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2264 ; RV64I-NEXT: addi sp, sp, 16
2267 ; CHECKIZFHMIN-LABEL: ceil_f16:
2268 ; CHECKIZFHMIN: # %bb.0:
2269 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
2270 ; CHECKIZFHMIN-NEXT: lui a0, 307200
2271 ; CHECKIZFHMIN-NEXT: fmv.w.x fa4, a0
2272 ; CHECKIZFHMIN-NEXT: fabs.s fa3, fa5
2273 ; CHECKIZFHMIN-NEXT: flt.s a0, fa3, fa4
2274 ; CHECKIZFHMIN-NEXT: beqz a0, .LBB18_2
2275 ; CHECKIZFHMIN-NEXT: # %bb.1:
2276 ; CHECKIZFHMIN-NEXT: fcvt.w.s a0, fa5, rup
2277 ; CHECKIZFHMIN-NEXT: fcvt.s.w fa4, a0, rup
2278 ; CHECKIZFHMIN-NEXT: fsgnj.s fa5, fa4, fa5
2279 ; CHECKIZFHMIN-NEXT: .LBB18_2:
2280 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2281 ; CHECKIZFHMIN-NEXT: ret
2283 ; CHECKIZHINXMIN-LABEL: ceil_f16:
2284 ; CHECKIZHINXMIN: # %bb.0:
2285 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2286 ; CHECKIZHINXMIN-NEXT: lui a1, 307200
2287 ; CHECKIZHINXMIN-NEXT: fabs.s a2, a0
2288 ; CHECKIZHINXMIN-NEXT: flt.s a1, a2, a1
2289 ; CHECKIZHINXMIN-NEXT: beqz a1, .LBB18_2
2290 ; CHECKIZHINXMIN-NEXT: # %bb.1:
2291 ; CHECKIZHINXMIN-NEXT: fcvt.w.s a1, a0, rup
2292 ; CHECKIZHINXMIN-NEXT: fcvt.s.w a1, a1, rup
2293 ; CHECKIZHINXMIN-NEXT: fsgnj.s a0, a1, a0
2294 ; CHECKIZHINXMIN-NEXT: .LBB18_2:
2295 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2296 ; CHECKIZHINXMIN-NEXT: ret
2297 %1 = call half @llvm.ceil.f16(half %a)
2301 declare half @llvm.trunc.f16(half)
2303 define half @trunc_f16(half %a) nounwind {
2304 ; CHECKIZFH-LABEL: trunc_f16:
2305 ; CHECKIZFH: # %bb.0:
2306 ; CHECKIZFH-NEXT: lui a0, %hi(.LCPI19_0)
2307 ; CHECKIZFH-NEXT: flh fa5, %lo(.LCPI19_0)(a0)
2308 ; CHECKIZFH-NEXT: fabs.h fa4, fa0
2309 ; CHECKIZFH-NEXT: flt.h a0, fa4, fa5
2310 ; CHECKIZFH-NEXT: beqz a0, .LBB19_2
2311 ; CHECKIZFH-NEXT: # %bb.1:
2312 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz
2313 ; CHECKIZFH-NEXT: fcvt.h.w fa5, a0, rtz
2314 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa5, fa0
2315 ; CHECKIZFH-NEXT: .LBB19_2:
2316 ; CHECKIZFH-NEXT: ret
2318 ; CHECKIZHINX-LABEL: trunc_f16:
2319 ; CHECKIZHINX: # %bb.0:
2320 ; CHECKIZHINX-NEXT: li a1, 25
2321 ; CHECKIZHINX-NEXT: slli a1, a1, 10
2322 ; CHECKIZHINX-NEXT: fabs.h a2, a0
2323 ; CHECKIZHINX-NEXT: flt.h a1, a2, a1
2324 ; CHECKIZHINX-NEXT: beqz a1, .LBB19_2
2325 ; CHECKIZHINX-NEXT: # %bb.1:
2326 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rtz
2327 ; CHECKIZHINX-NEXT: fcvt.h.w a1, a1, rtz
2328 ; CHECKIZHINX-NEXT: fsgnj.h a0, a1, a0
2329 ; CHECKIZHINX-NEXT: .LBB19_2:
2330 ; CHECKIZHINX-NEXT: ret
2332 ; RV32I-LABEL: trunc_f16:
2334 ; RV32I-NEXT: addi sp, sp, -16
2335 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2336 ; RV32I-NEXT: slli a0, a0, 16
2337 ; RV32I-NEXT: srli a0, a0, 16
2338 ; RV32I-NEXT: call __extendhfsf2
2339 ; RV32I-NEXT: call truncf
2340 ; RV32I-NEXT: call __truncsfhf2
2341 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2342 ; RV32I-NEXT: addi sp, sp, 16
2345 ; RV64I-LABEL: trunc_f16:
2347 ; RV64I-NEXT: addi sp, sp, -16
2348 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2349 ; RV64I-NEXT: slli a0, a0, 48
2350 ; RV64I-NEXT: srli a0, a0, 48
2351 ; RV64I-NEXT: call __extendhfsf2
2352 ; RV64I-NEXT: call truncf
2353 ; RV64I-NEXT: call __truncsfhf2
2354 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2355 ; RV64I-NEXT: addi sp, sp, 16
2358 ; CHECKIZFHMIN-LABEL: trunc_f16:
2359 ; CHECKIZFHMIN: # %bb.0:
2360 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
2361 ; CHECKIZFHMIN-NEXT: lui a0, 307200
2362 ; CHECKIZFHMIN-NEXT: fmv.w.x fa4, a0
2363 ; CHECKIZFHMIN-NEXT: fabs.s fa3, fa5
2364 ; CHECKIZFHMIN-NEXT: flt.s a0, fa3, fa4
2365 ; CHECKIZFHMIN-NEXT: beqz a0, .LBB19_2
2366 ; CHECKIZFHMIN-NEXT: # %bb.1:
2367 ; CHECKIZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
2368 ; CHECKIZFHMIN-NEXT: fcvt.s.w fa4, a0, rtz
2369 ; CHECKIZFHMIN-NEXT: fsgnj.s fa5, fa4, fa5
2370 ; CHECKIZFHMIN-NEXT: .LBB19_2:
2371 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2372 ; CHECKIZFHMIN-NEXT: ret
2374 ; CHECKIZHINXMIN-LABEL: trunc_f16:
2375 ; CHECKIZHINXMIN: # %bb.0:
2376 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2377 ; CHECKIZHINXMIN-NEXT: lui a1, 307200
2378 ; CHECKIZHINXMIN-NEXT: fabs.s a2, a0
2379 ; CHECKIZHINXMIN-NEXT: flt.s a1, a2, a1
2380 ; CHECKIZHINXMIN-NEXT: beqz a1, .LBB19_2
2381 ; CHECKIZHINXMIN-NEXT: # %bb.1:
2382 ; CHECKIZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
2383 ; CHECKIZHINXMIN-NEXT: fcvt.s.w a1, a1, rtz
2384 ; CHECKIZHINXMIN-NEXT: fsgnj.s a0, a1, a0
2385 ; CHECKIZHINXMIN-NEXT: .LBB19_2:
2386 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2387 ; CHECKIZHINXMIN-NEXT: ret
2388 %1 = call half @llvm.trunc.f16(half %a)
2392 declare half @llvm.rint.f16(half)
2394 define half @rint_f16(half %a) nounwind {
2395 ; CHECKIZFH-LABEL: rint_f16:
2396 ; CHECKIZFH: # %bb.0:
2397 ; CHECKIZFH-NEXT: lui a0, %hi(.LCPI20_0)
2398 ; CHECKIZFH-NEXT: flh fa5, %lo(.LCPI20_0)(a0)
2399 ; CHECKIZFH-NEXT: fabs.h fa4, fa0
2400 ; CHECKIZFH-NEXT: flt.h a0, fa4, fa5
2401 ; CHECKIZFH-NEXT: beqz a0, .LBB20_2
2402 ; CHECKIZFH-NEXT: # %bb.1:
2403 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0
2404 ; CHECKIZFH-NEXT: fcvt.h.w fa5, a0
2405 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa5, fa0
2406 ; CHECKIZFH-NEXT: .LBB20_2:
2407 ; CHECKIZFH-NEXT: ret
2409 ; CHECKIZHINX-LABEL: rint_f16:
2410 ; CHECKIZHINX: # %bb.0:
2411 ; CHECKIZHINX-NEXT: li a1, 25
2412 ; CHECKIZHINX-NEXT: slli a1, a1, 10
2413 ; CHECKIZHINX-NEXT: fabs.h a2, a0
2414 ; CHECKIZHINX-NEXT: flt.h a1, a2, a1
2415 ; CHECKIZHINX-NEXT: beqz a1, .LBB20_2
2416 ; CHECKIZHINX-NEXT: # %bb.1:
2417 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0
2418 ; CHECKIZHINX-NEXT: fcvt.h.w a1, a1
2419 ; CHECKIZHINX-NEXT: fsgnj.h a0, a1, a0
2420 ; CHECKIZHINX-NEXT: .LBB20_2:
2421 ; CHECKIZHINX-NEXT: ret
2423 ; RV32I-LABEL: rint_f16:
2425 ; RV32I-NEXT: addi sp, sp, -16
2426 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2427 ; RV32I-NEXT: slli a0, a0, 16
2428 ; RV32I-NEXT: srli a0, a0, 16
2429 ; RV32I-NEXT: call __extendhfsf2
2430 ; RV32I-NEXT: call rintf
2431 ; RV32I-NEXT: call __truncsfhf2
2432 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2433 ; RV32I-NEXT: addi sp, sp, 16
2436 ; RV64I-LABEL: rint_f16:
2438 ; RV64I-NEXT: addi sp, sp, -16
2439 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2440 ; RV64I-NEXT: slli a0, a0, 48
2441 ; RV64I-NEXT: srli a0, a0, 48
2442 ; RV64I-NEXT: call __extendhfsf2
2443 ; RV64I-NEXT: call rintf
2444 ; RV64I-NEXT: call __truncsfhf2
2445 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2446 ; RV64I-NEXT: addi sp, sp, 16
2449 ; CHECKIZFHMIN-LABEL: rint_f16:
2450 ; CHECKIZFHMIN: # %bb.0:
2451 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
2452 ; CHECKIZFHMIN-NEXT: lui a0, 307200
2453 ; CHECKIZFHMIN-NEXT: fmv.w.x fa4, a0
2454 ; CHECKIZFHMIN-NEXT: fabs.s fa3, fa5
2455 ; CHECKIZFHMIN-NEXT: flt.s a0, fa3, fa4
2456 ; CHECKIZFHMIN-NEXT: beqz a0, .LBB20_2
2457 ; CHECKIZFHMIN-NEXT: # %bb.1:
2458 ; CHECKIZFHMIN-NEXT: fcvt.w.s a0, fa5
2459 ; CHECKIZFHMIN-NEXT: fcvt.s.w fa4, a0
2460 ; CHECKIZFHMIN-NEXT: fsgnj.s fa5, fa4, fa5
2461 ; CHECKIZFHMIN-NEXT: .LBB20_2:
2462 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2463 ; CHECKIZFHMIN-NEXT: ret
2465 ; CHECKIZHINXMIN-LABEL: rint_f16:
2466 ; CHECKIZHINXMIN: # %bb.0:
2467 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2468 ; CHECKIZHINXMIN-NEXT: lui a1, 307200
2469 ; CHECKIZHINXMIN-NEXT: fabs.s a2, a0
2470 ; CHECKIZHINXMIN-NEXT: flt.s a1, a2, a1
2471 ; CHECKIZHINXMIN-NEXT: beqz a1, .LBB20_2
2472 ; CHECKIZHINXMIN-NEXT: # %bb.1:
2473 ; CHECKIZHINXMIN-NEXT: fcvt.w.s a1, a0
2474 ; CHECKIZHINXMIN-NEXT: fcvt.s.w a1, a1
2475 ; CHECKIZHINXMIN-NEXT: fsgnj.s a0, a1, a0
2476 ; CHECKIZHINXMIN-NEXT: .LBB20_2:
2477 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2478 ; CHECKIZHINXMIN-NEXT: ret
2479 %1 = call half @llvm.rint.f16(half %a)
2483 declare half @llvm.nearbyint.f16(half)
2485 define half @nearbyint_f16(half %a) nounwind {
2486 ; RV32IZFH-LABEL: nearbyint_f16:
2487 ; RV32IZFH: # %bb.0:
2488 ; RV32IZFH-NEXT: addi sp, sp, -16
2489 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2490 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
2491 ; RV32IZFH-NEXT: call nearbyintf
2492 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
2493 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2494 ; RV32IZFH-NEXT: addi sp, sp, 16
2495 ; RV32IZFH-NEXT: ret
2497 ; RV64IZFH-LABEL: nearbyint_f16:
2498 ; RV64IZFH: # %bb.0:
2499 ; RV64IZFH-NEXT: addi sp, sp, -16
2500 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2501 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
2502 ; RV64IZFH-NEXT: call nearbyintf
2503 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
2504 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2505 ; RV64IZFH-NEXT: addi sp, sp, 16
2506 ; RV64IZFH-NEXT: ret
2508 ; RV32IZHINX-LABEL: nearbyint_f16:
2509 ; RV32IZHINX: # %bb.0:
2510 ; RV32IZHINX-NEXT: addi sp, sp, -16
2511 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2512 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
2513 ; RV32IZHINX-NEXT: call nearbyintf
2514 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
2515 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2516 ; RV32IZHINX-NEXT: addi sp, sp, 16
2517 ; RV32IZHINX-NEXT: ret
2519 ; RV64IZHINX-LABEL: nearbyint_f16:
2520 ; RV64IZHINX: # %bb.0:
2521 ; RV64IZHINX-NEXT: addi sp, sp, -16
2522 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2523 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
2524 ; RV64IZHINX-NEXT: call nearbyintf
2525 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
2526 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2527 ; RV64IZHINX-NEXT: addi sp, sp, 16
2528 ; RV64IZHINX-NEXT: ret
2530 ; RV32I-LABEL: nearbyint_f16:
2532 ; RV32I-NEXT: addi sp, sp, -16
2533 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2534 ; RV32I-NEXT: slli a0, a0, 16
2535 ; RV32I-NEXT: srli a0, a0, 16
2536 ; RV32I-NEXT: call __extendhfsf2
2537 ; RV32I-NEXT: call nearbyintf
2538 ; RV32I-NEXT: call __truncsfhf2
2539 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2540 ; RV32I-NEXT: addi sp, sp, 16
2543 ; RV64I-LABEL: nearbyint_f16:
2545 ; RV64I-NEXT: addi sp, sp, -16
2546 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2547 ; RV64I-NEXT: slli a0, a0, 48
2548 ; RV64I-NEXT: srli a0, a0, 48
2549 ; RV64I-NEXT: call __extendhfsf2
2550 ; RV64I-NEXT: call nearbyintf
2551 ; RV64I-NEXT: call __truncsfhf2
2552 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2553 ; RV64I-NEXT: addi sp, sp, 16
2556 ; RV32IZFHMIN-LABEL: nearbyint_f16:
2557 ; RV32IZFHMIN: # %bb.0:
2558 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
2559 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2560 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
2561 ; RV32IZFHMIN-NEXT: call nearbyintf
2562 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
2563 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2564 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
2565 ; RV32IZFHMIN-NEXT: ret
2567 ; RV64IZFHMIN-LABEL: nearbyint_f16:
2568 ; RV64IZFHMIN: # %bb.0:
2569 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
2570 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2571 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
2572 ; RV64IZFHMIN-NEXT: call nearbyintf
2573 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
2574 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2575 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
2576 ; RV64IZFHMIN-NEXT: ret
2578 ; RV32IZHINXMIN-LABEL: nearbyint_f16:
2579 ; RV32IZHINXMIN: # %bb.0:
2580 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
2581 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2582 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
2583 ; RV32IZHINXMIN-NEXT: call nearbyintf
2584 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
2585 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2586 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
2587 ; RV32IZHINXMIN-NEXT: ret
2589 ; RV64IZHINXMIN-LABEL: nearbyint_f16:
2590 ; RV64IZHINXMIN: # %bb.0:
2591 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
2592 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2593 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
2594 ; RV64IZHINXMIN-NEXT: call nearbyintf
2595 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
2596 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2597 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
2598 ; RV64IZHINXMIN-NEXT: ret
2599 %1 = call half @llvm.nearbyint.f16(half %a)
2603 declare half @llvm.round.f16(half)
2605 define half @round_f16(half %a) nounwind {
2606 ; CHECKIZFH-LABEL: round_f16:
2607 ; CHECKIZFH: # %bb.0:
2608 ; CHECKIZFH-NEXT: lui a0, %hi(.LCPI22_0)
2609 ; CHECKIZFH-NEXT: flh fa5, %lo(.LCPI22_0)(a0)
2610 ; CHECKIZFH-NEXT: fabs.h fa4, fa0
2611 ; CHECKIZFH-NEXT: flt.h a0, fa4, fa5
2612 ; CHECKIZFH-NEXT: beqz a0, .LBB22_2
2613 ; CHECKIZFH-NEXT: # %bb.1:
2614 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rmm
2615 ; CHECKIZFH-NEXT: fcvt.h.w fa5, a0, rmm
2616 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa5, fa0
2617 ; CHECKIZFH-NEXT: .LBB22_2:
2618 ; CHECKIZFH-NEXT: ret
2620 ; CHECKIZHINX-LABEL: round_f16:
2621 ; CHECKIZHINX: # %bb.0:
2622 ; CHECKIZHINX-NEXT: li a1, 25
2623 ; CHECKIZHINX-NEXT: slli a1, a1, 10
2624 ; CHECKIZHINX-NEXT: fabs.h a2, a0
2625 ; CHECKIZHINX-NEXT: flt.h a1, a2, a1
2626 ; CHECKIZHINX-NEXT: beqz a1, .LBB22_2
2627 ; CHECKIZHINX-NEXT: # %bb.1:
2628 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rmm
2629 ; CHECKIZHINX-NEXT: fcvt.h.w a1, a1, rmm
2630 ; CHECKIZHINX-NEXT: fsgnj.h a0, a1, a0
2631 ; CHECKIZHINX-NEXT: .LBB22_2:
2632 ; CHECKIZHINX-NEXT: ret
2634 ; RV32I-LABEL: round_f16:
2636 ; RV32I-NEXT: addi sp, sp, -16
2637 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2638 ; RV32I-NEXT: slli a0, a0, 16
2639 ; RV32I-NEXT: srli a0, a0, 16
2640 ; RV32I-NEXT: call __extendhfsf2
2641 ; RV32I-NEXT: call roundf
2642 ; RV32I-NEXT: call __truncsfhf2
2643 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2644 ; RV32I-NEXT: addi sp, sp, 16
2647 ; RV64I-LABEL: round_f16:
2649 ; RV64I-NEXT: addi sp, sp, -16
2650 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2651 ; RV64I-NEXT: slli a0, a0, 48
2652 ; RV64I-NEXT: srli a0, a0, 48
2653 ; RV64I-NEXT: call __extendhfsf2
2654 ; RV64I-NEXT: call roundf
2655 ; RV64I-NEXT: call __truncsfhf2
2656 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2657 ; RV64I-NEXT: addi sp, sp, 16
2660 ; CHECKIZFHMIN-LABEL: round_f16:
2661 ; CHECKIZFHMIN: # %bb.0:
2662 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
2663 ; CHECKIZFHMIN-NEXT: lui a0, 307200
2664 ; CHECKIZFHMIN-NEXT: fmv.w.x fa4, a0
2665 ; CHECKIZFHMIN-NEXT: fabs.s fa3, fa5
2666 ; CHECKIZFHMIN-NEXT: flt.s a0, fa3, fa4
2667 ; CHECKIZFHMIN-NEXT: beqz a0, .LBB22_2
2668 ; CHECKIZFHMIN-NEXT: # %bb.1:
2669 ; CHECKIZFHMIN-NEXT: fcvt.w.s a0, fa5, rmm
2670 ; CHECKIZFHMIN-NEXT: fcvt.s.w fa4, a0, rmm
2671 ; CHECKIZFHMIN-NEXT: fsgnj.s fa5, fa4, fa5
2672 ; CHECKIZFHMIN-NEXT: .LBB22_2:
2673 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2674 ; CHECKIZFHMIN-NEXT: ret
2676 ; CHECKIZHINXMIN-LABEL: round_f16:
2677 ; CHECKIZHINXMIN: # %bb.0:
2678 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2679 ; CHECKIZHINXMIN-NEXT: lui a1, 307200
2680 ; CHECKIZHINXMIN-NEXT: fabs.s a2, a0
2681 ; CHECKIZHINXMIN-NEXT: flt.s a1, a2, a1
2682 ; CHECKIZHINXMIN-NEXT: beqz a1, .LBB22_2
2683 ; CHECKIZHINXMIN-NEXT: # %bb.1:
2684 ; CHECKIZHINXMIN-NEXT: fcvt.w.s a1, a0, rmm
2685 ; CHECKIZHINXMIN-NEXT: fcvt.s.w a1, a1, rmm
2686 ; CHECKIZHINXMIN-NEXT: fsgnj.s a0, a1, a0
2687 ; CHECKIZHINXMIN-NEXT: .LBB22_2:
2688 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2689 ; CHECKIZHINXMIN-NEXT: ret
2690 %1 = call half @llvm.round.f16(half %a)
2694 declare half @llvm.roundeven.f16(half)
2696 define half @roundeven_f16(half %a) nounwind {
2697 ; CHECKIZFH-LABEL: roundeven_f16:
2698 ; CHECKIZFH: # %bb.0:
2699 ; CHECKIZFH-NEXT: lui a0, %hi(.LCPI23_0)
2700 ; CHECKIZFH-NEXT: flh fa5, %lo(.LCPI23_0)(a0)
2701 ; CHECKIZFH-NEXT: fabs.h fa4, fa0
2702 ; CHECKIZFH-NEXT: flt.h a0, fa4, fa5
2703 ; CHECKIZFH-NEXT: beqz a0, .LBB23_2
2704 ; CHECKIZFH-NEXT: # %bb.1:
2705 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rne
2706 ; CHECKIZFH-NEXT: fcvt.h.w fa5, a0, rne
2707 ; CHECKIZFH-NEXT: fsgnj.h fa0, fa5, fa0
2708 ; CHECKIZFH-NEXT: .LBB23_2:
2709 ; CHECKIZFH-NEXT: ret
2711 ; CHECKIZHINX-LABEL: roundeven_f16:
2712 ; CHECKIZHINX: # %bb.0:
2713 ; CHECKIZHINX-NEXT: li a1, 25
2714 ; CHECKIZHINX-NEXT: slli a1, a1, 10
2715 ; CHECKIZHINX-NEXT: fabs.h a2, a0
2716 ; CHECKIZHINX-NEXT: flt.h a1, a2, a1
2717 ; CHECKIZHINX-NEXT: beqz a1, .LBB23_2
2718 ; CHECKIZHINX-NEXT: # %bb.1:
2719 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rne
2720 ; CHECKIZHINX-NEXT: fcvt.h.w a1, a1, rne
2721 ; CHECKIZHINX-NEXT: fsgnj.h a0, a1, a0
2722 ; CHECKIZHINX-NEXT: .LBB23_2:
2723 ; CHECKIZHINX-NEXT: ret
2725 ; RV32I-LABEL: roundeven_f16:
2727 ; RV32I-NEXT: addi sp, sp, -16
2728 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2729 ; RV32I-NEXT: slli a0, a0, 16
2730 ; RV32I-NEXT: srli a0, a0, 16
2731 ; RV32I-NEXT: call __extendhfsf2
2732 ; RV32I-NEXT: call roundevenf
2733 ; RV32I-NEXT: call __truncsfhf2
2734 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2735 ; RV32I-NEXT: addi sp, sp, 16
2738 ; RV64I-LABEL: roundeven_f16:
2740 ; RV64I-NEXT: addi sp, sp, -16
2741 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2742 ; RV64I-NEXT: slli a0, a0, 48
2743 ; RV64I-NEXT: srli a0, a0, 48
2744 ; RV64I-NEXT: call __extendhfsf2
2745 ; RV64I-NEXT: call roundevenf
2746 ; RV64I-NEXT: call __truncsfhf2
2747 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2748 ; RV64I-NEXT: addi sp, sp, 16
2751 ; CHECKIZFHMIN-LABEL: roundeven_f16:
2752 ; CHECKIZFHMIN: # %bb.0:
2753 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa0
2754 ; CHECKIZFHMIN-NEXT: lui a0, 307200
2755 ; CHECKIZFHMIN-NEXT: fmv.w.x fa4, a0
2756 ; CHECKIZFHMIN-NEXT: fabs.s fa3, fa5
2757 ; CHECKIZFHMIN-NEXT: flt.s a0, fa3, fa4
2758 ; CHECKIZFHMIN-NEXT: beqz a0, .LBB23_2
2759 ; CHECKIZFHMIN-NEXT: # %bb.1:
2760 ; CHECKIZFHMIN-NEXT: fcvt.w.s a0, fa5, rne
2761 ; CHECKIZFHMIN-NEXT: fcvt.s.w fa4, a0, rne
2762 ; CHECKIZFHMIN-NEXT: fsgnj.s fa5, fa4, fa5
2763 ; CHECKIZFHMIN-NEXT: .LBB23_2:
2764 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
2765 ; CHECKIZFHMIN-NEXT: ret
2767 ; CHECKIZHINXMIN-LABEL: roundeven_f16:
2768 ; CHECKIZHINXMIN: # %bb.0:
2769 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
2770 ; CHECKIZHINXMIN-NEXT: lui a1, 307200
2771 ; CHECKIZHINXMIN-NEXT: fabs.s a2, a0
2772 ; CHECKIZHINXMIN-NEXT: flt.s a1, a2, a1
2773 ; CHECKIZHINXMIN-NEXT: beqz a1, .LBB23_2
2774 ; CHECKIZHINXMIN-NEXT: # %bb.1:
2775 ; CHECKIZHINXMIN-NEXT: fcvt.w.s a1, a0, rne
2776 ; CHECKIZHINXMIN-NEXT: fcvt.s.w a1, a1, rne
2777 ; CHECKIZHINXMIN-NEXT: fsgnj.s a0, a1, a0
2778 ; CHECKIZHINXMIN-NEXT: .LBB23_2:
2779 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
2780 ; CHECKIZHINXMIN-NEXT: ret
2781 %1 = call half @llvm.roundeven.f16(half %a)
2785 declare i1 @llvm.is.fpclass.f16(half, i32)
2786 define i1 @isnan_d_fpclass(half %x) {
2787 ; CHECKIZFH-LABEL: isnan_d_fpclass:
2788 ; CHECKIZFH: # %bb.0:
2789 ; CHECKIZFH-NEXT: fclass.h a0, fa0
2790 ; CHECKIZFH-NEXT: andi a0, a0, 768
2791 ; CHECKIZFH-NEXT: snez a0, a0
2792 ; CHECKIZFH-NEXT: ret
2794 ; CHECKIZHINX-LABEL: isnan_d_fpclass:
2795 ; CHECKIZHINX: # %bb.0:
2796 ; CHECKIZHINX-NEXT: fclass.h a0, a0
2797 ; CHECKIZHINX-NEXT: andi a0, a0, 768
2798 ; CHECKIZHINX-NEXT: snez a0, a0
2799 ; CHECKIZHINX-NEXT: ret
2801 ; RV32I-LABEL: isnan_d_fpclass:
2803 ; RV32I-NEXT: slli a0, a0, 17
2804 ; RV32I-NEXT: li a1, 31
2805 ; RV32I-NEXT: srli a0, a0, 17
2806 ; RV32I-NEXT: slli a1, a1, 10
2807 ; RV32I-NEXT: slt a0, a1, a0
2810 ; RV64I-LABEL: isnan_d_fpclass:
2812 ; RV64I-NEXT: slli a0, a0, 49
2813 ; RV64I-NEXT: li a1, 31
2814 ; RV64I-NEXT: srli a0, a0, 49
2815 ; RV64I-NEXT: slli a1, a1, 10
2816 ; RV64I-NEXT: slt a0, a1, a0
2819 ; RV32IZFHMIN-LABEL: isnan_d_fpclass:
2820 ; RV32IZFHMIN: # %bb.0:
2821 ; RV32IZFHMIN-NEXT: fmv.x.h a0, fa0
2822 ; RV32IZFHMIN-NEXT: li a1, 31
2823 ; RV32IZFHMIN-NEXT: slli a0, a0, 17
2824 ; RV32IZFHMIN-NEXT: srli a0, a0, 17
2825 ; RV32IZFHMIN-NEXT: slli a1, a1, 10
2826 ; RV32IZFHMIN-NEXT: slt a0, a1, a0
2827 ; RV32IZFHMIN-NEXT: ret
2829 ; RV64IZFHMIN-LABEL: isnan_d_fpclass:
2830 ; RV64IZFHMIN: # %bb.0:
2831 ; RV64IZFHMIN-NEXT: fmv.x.h a0, fa0
2832 ; RV64IZFHMIN-NEXT: li a1, 31
2833 ; RV64IZFHMIN-NEXT: slli a0, a0, 49
2834 ; RV64IZFHMIN-NEXT: srli a0, a0, 49
2835 ; RV64IZFHMIN-NEXT: slli a1, a1, 10
2836 ; RV64IZFHMIN-NEXT: slt a0, a1, a0
2837 ; RV64IZFHMIN-NEXT: ret
2839 ; RV32IZHINXMIN-LABEL: isnan_d_fpclass:
2840 ; RV32IZHINXMIN: # %bb.0:
2841 ; RV32IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h def $x10
2842 ; RV32IZHINXMIN-NEXT: slli a0, a0, 17
2843 ; RV32IZHINXMIN-NEXT: li a1, 31
2844 ; RV32IZHINXMIN-NEXT: srli a0, a0, 17
2845 ; RV32IZHINXMIN-NEXT: slli a1, a1, 10
2846 ; RV32IZHINXMIN-NEXT: slt a0, a1, a0
2847 ; RV32IZHINXMIN-NEXT: ret
2849 ; RV64IZHINXMIN-LABEL: isnan_d_fpclass:
2850 ; RV64IZHINXMIN: # %bb.0:
2851 ; RV64IZHINXMIN-NEXT: # kill: def $x10_h killed $x10_h def $x10
2852 ; RV64IZHINXMIN-NEXT: slli a0, a0, 49
2853 ; RV64IZHINXMIN-NEXT: li a1, 31
2854 ; RV64IZHINXMIN-NEXT: srli a0, a0, 49
2855 ; RV64IZHINXMIN-NEXT: slli a1, a1, 10
2856 ; RV64IZHINXMIN-NEXT: slt a0, a1, a0
2857 ; RV64IZHINXMIN-NEXT: ret
2858 %1 = call i1 @llvm.is.fpclass.f16(half %x, i32 3) ; nan
2862 declare half @llvm.tan.f16(half)
2864 define half @tan_f16(half %a) nounwind {
2865 ; RV32IZFH-LABEL: tan_f16:
2866 ; RV32IZFH: # %bb.0:
2867 ; RV32IZFH-NEXT: addi sp, sp, -16
2868 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2869 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
2870 ; RV32IZFH-NEXT: call tanf
2871 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
2872 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2873 ; RV32IZFH-NEXT: addi sp, sp, 16
2874 ; RV32IZFH-NEXT: ret
2876 ; RV64IZFH-LABEL: tan_f16:
2877 ; RV64IZFH: # %bb.0:
2878 ; RV64IZFH-NEXT: addi sp, sp, -16
2879 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2880 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
2881 ; RV64IZFH-NEXT: call tanf
2882 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
2883 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2884 ; RV64IZFH-NEXT: addi sp, sp, 16
2885 ; RV64IZFH-NEXT: ret
2887 ; RV32IZHINX-LABEL: tan_f16:
2888 ; RV32IZHINX: # %bb.0:
2889 ; RV32IZHINX-NEXT: addi sp, sp, -16
2890 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2891 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
2892 ; RV32IZHINX-NEXT: call tanf
2893 ; RV32IZHINX-NEXT: fcvt.h.s a0, a0
2894 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2895 ; RV32IZHINX-NEXT: addi sp, sp, 16
2896 ; RV32IZHINX-NEXT: ret
2898 ; RV64IZHINX-LABEL: tan_f16:
2899 ; RV64IZHINX: # %bb.0:
2900 ; RV64IZHINX-NEXT: addi sp, sp, -16
2901 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2902 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
2903 ; RV64IZHINX-NEXT: call tanf
2904 ; RV64IZHINX-NEXT: fcvt.h.s a0, a0
2905 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2906 ; RV64IZHINX-NEXT: addi sp, sp, 16
2907 ; RV64IZHINX-NEXT: ret
2909 ; RV32I-LABEL: tan_f16:
2911 ; RV32I-NEXT: addi sp, sp, -16
2912 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2913 ; RV32I-NEXT: slli a0, a0, 16
2914 ; RV32I-NEXT: srli a0, a0, 16
2915 ; RV32I-NEXT: call __extendhfsf2
2916 ; RV32I-NEXT: call tanf
2917 ; RV32I-NEXT: call __truncsfhf2
2918 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2919 ; RV32I-NEXT: addi sp, sp, 16
2922 ; RV64I-LABEL: tan_f16:
2924 ; RV64I-NEXT: addi sp, sp, -16
2925 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2926 ; RV64I-NEXT: slli a0, a0, 48
2927 ; RV64I-NEXT: srli a0, a0, 48
2928 ; RV64I-NEXT: call __extendhfsf2
2929 ; RV64I-NEXT: call tanf
2930 ; RV64I-NEXT: call __truncsfhf2
2931 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2932 ; RV64I-NEXT: addi sp, sp, 16
2935 ; RV32IZFHMIN-LABEL: tan_f16:
2936 ; RV32IZFHMIN: # %bb.0:
2937 ; RV32IZFHMIN-NEXT: addi sp, sp, -16
2938 ; RV32IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2939 ; RV32IZFHMIN-NEXT: fcvt.s.h fa0, fa0
2940 ; RV32IZFHMIN-NEXT: call tanf
2941 ; RV32IZFHMIN-NEXT: fcvt.h.s fa0, fa0
2942 ; RV32IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2943 ; RV32IZFHMIN-NEXT: addi sp, sp, 16
2944 ; RV32IZFHMIN-NEXT: ret
2946 ; RV64IZFHMIN-LABEL: tan_f16:
2947 ; RV64IZFHMIN: # %bb.0:
2948 ; RV64IZFHMIN-NEXT: addi sp, sp, -16
2949 ; RV64IZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2950 ; RV64IZFHMIN-NEXT: fcvt.s.h fa0, fa0
2951 ; RV64IZFHMIN-NEXT: call tanf
2952 ; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa0
2953 ; RV64IZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2954 ; RV64IZFHMIN-NEXT: addi sp, sp, 16
2955 ; RV64IZFHMIN-NEXT: ret
2957 ; RV32IZHINXMIN-LABEL: tan_f16:
2958 ; RV32IZHINXMIN: # %bb.0:
2959 ; RV32IZHINXMIN-NEXT: addi sp, sp, -16
2960 ; RV32IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2961 ; RV32IZHINXMIN-NEXT: fcvt.s.h a0, a0
2962 ; RV32IZHINXMIN-NEXT: call tanf
2963 ; RV32IZHINXMIN-NEXT: fcvt.h.s a0, a0
2964 ; RV32IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2965 ; RV32IZHINXMIN-NEXT: addi sp, sp, 16
2966 ; RV32IZHINXMIN-NEXT: ret
2968 ; RV64IZHINXMIN-LABEL: tan_f16:
2969 ; RV64IZHINXMIN: # %bb.0:
2970 ; RV64IZHINXMIN-NEXT: addi sp, sp, -16
2971 ; RV64IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2972 ; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
2973 ; RV64IZHINXMIN-NEXT: call tanf
2974 ; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
2975 ; RV64IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2976 ; RV64IZHINXMIN-NEXT: addi sp, sp, 16
2977 ; RV64IZHINXMIN-NEXT: ret
2978 %1 = call half @llvm.tan.f16(half %a)
2982 declare half @llvm.maximumnum.f16(half, half)
2984 define half @maximumnum_half(half %x, half %y) {
2985 ; CHECKIZFH-LABEL: maximumnum_half:
2986 ; CHECKIZFH: # %bb.0:
2987 ; CHECKIZFH-NEXT: fmax.h fa0, fa0, fa1
2988 ; CHECKIZFH-NEXT: ret
2990 ; CHECKIZHINX-LABEL: maximumnum_half:
2991 ; CHECKIZHINX: # %bb.0:
2992 ; CHECKIZHINX-NEXT: fmax.h a0, a0, a1
2993 ; CHECKIZHINX-NEXT: ret
2995 ; RV32I-LABEL: maximumnum_half:
2997 ; RV32I-NEXT: addi sp, sp, -16
2998 ; RV32I-NEXT: .cfi_def_cfa_offset 16
2999 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3000 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3001 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3002 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
3003 ; RV32I-NEXT: .cfi_offset ra, -4
3004 ; RV32I-NEXT: .cfi_offset s0, -8
3005 ; RV32I-NEXT: .cfi_offset s1, -12
3006 ; RV32I-NEXT: .cfi_offset s2, -16
3007 ; RV32I-NEXT: mv s0, a1
3008 ; RV32I-NEXT: lui a1, 16
3009 ; RV32I-NEXT: addi s2, a1, -1
3010 ; RV32I-NEXT: and a0, a0, s2
3011 ; RV32I-NEXT: call __extendhfsf2
3012 ; RV32I-NEXT: mv s1, a0
3013 ; RV32I-NEXT: and a0, s0, s2
3014 ; RV32I-NEXT: call __extendhfsf2
3015 ; RV32I-NEXT: mv a1, a0
3016 ; RV32I-NEXT: mv a0, s1
3017 ; RV32I-NEXT: call fmaximum_numf
3018 ; RV32I-NEXT: call __truncsfhf2
3019 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3020 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3021 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3022 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
3023 ; RV32I-NEXT: .cfi_restore ra
3024 ; RV32I-NEXT: .cfi_restore s0
3025 ; RV32I-NEXT: .cfi_restore s1
3026 ; RV32I-NEXT: .cfi_restore s2
3027 ; RV32I-NEXT: addi sp, sp, 16
3028 ; RV32I-NEXT: .cfi_def_cfa_offset 0
3031 ; RV64I-LABEL: maximumnum_half:
3033 ; RV64I-NEXT: addi sp, sp, -32
3034 ; RV64I-NEXT: .cfi_def_cfa_offset 32
3035 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
3036 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
3037 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
3038 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
3039 ; RV64I-NEXT: .cfi_offset ra, -8
3040 ; RV64I-NEXT: .cfi_offset s0, -16
3041 ; RV64I-NEXT: .cfi_offset s1, -24
3042 ; RV64I-NEXT: .cfi_offset s2, -32
3043 ; RV64I-NEXT: mv s0, a1
3044 ; RV64I-NEXT: lui a1, 16
3045 ; RV64I-NEXT: addiw s2, a1, -1
3046 ; RV64I-NEXT: and a0, a0, s2
3047 ; RV64I-NEXT: call __extendhfsf2
3048 ; RV64I-NEXT: mv s1, a0
3049 ; RV64I-NEXT: and a0, s0, s2
3050 ; RV64I-NEXT: call __extendhfsf2
3051 ; RV64I-NEXT: mv a1, a0
3052 ; RV64I-NEXT: mv a0, s1
3053 ; RV64I-NEXT: call fmaximum_numf
3054 ; RV64I-NEXT: call __truncsfhf2
3055 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
3056 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
3057 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
3058 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
3059 ; RV64I-NEXT: .cfi_restore ra
3060 ; RV64I-NEXT: .cfi_restore s0
3061 ; RV64I-NEXT: .cfi_restore s1
3062 ; RV64I-NEXT: .cfi_restore s2
3063 ; RV64I-NEXT: addi sp, sp, 32
3064 ; RV64I-NEXT: .cfi_def_cfa_offset 0
3067 ; CHECKIZFHMIN-LABEL: maximumnum_half:
3068 ; CHECKIZFHMIN: # %bb.0:
3069 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa1
3070 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa0
3071 ; CHECKIZFHMIN-NEXT: fmax.s fa5, fa4, fa5
3072 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
3073 ; CHECKIZFHMIN-NEXT: ret
3075 ; CHECKIZHINXMIN-LABEL: maximumnum_half:
3076 ; CHECKIZHINXMIN: # %bb.0:
3077 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a1
3078 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
3079 ; CHECKIZHINXMIN-NEXT: fmax.s a0, a0, a1
3080 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
3081 ; CHECKIZHINXMIN-NEXT: ret
3082 %z = call half @llvm.maximumnum.f16(half %x, half %y)
3086 declare half @llvm.minimumnum.f16(half, half)
3088 define half @minimumnum_half(half %x, half %y) {
3089 ; CHECKIZFH-LABEL: minimumnum_half:
3090 ; CHECKIZFH: # %bb.0:
3091 ; CHECKIZFH-NEXT: fmin.h fa0, fa0, fa1
3092 ; CHECKIZFH-NEXT: ret
3094 ; CHECKIZHINX-LABEL: minimumnum_half:
3095 ; CHECKIZHINX: # %bb.0:
3096 ; CHECKIZHINX-NEXT: fmin.h a0, a0, a1
3097 ; CHECKIZHINX-NEXT: ret
3099 ; RV32I-LABEL: minimumnum_half:
3101 ; RV32I-NEXT: addi sp, sp, -16
3102 ; RV32I-NEXT: .cfi_def_cfa_offset 16
3103 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3104 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3105 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3106 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
3107 ; RV32I-NEXT: .cfi_offset ra, -4
3108 ; RV32I-NEXT: .cfi_offset s0, -8
3109 ; RV32I-NEXT: .cfi_offset s1, -12
3110 ; RV32I-NEXT: .cfi_offset s2, -16
3111 ; RV32I-NEXT: mv s0, a1
3112 ; RV32I-NEXT: lui a1, 16
3113 ; RV32I-NEXT: addi s2, a1, -1
3114 ; RV32I-NEXT: and a0, a0, s2
3115 ; RV32I-NEXT: call __extendhfsf2
3116 ; RV32I-NEXT: mv s1, a0
3117 ; RV32I-NEXT: and a0, s0, s2
3118 ; RV32I-NEXT: call __extendhfsf2
3119 ; RV32I-NEXT: mv a1, a0
3120 ; RV32I-NEXT: mv a0, s1
3121 ; RV32I-NEXT: call fminimum_numf
3122 ; RV32I-NEXT: call __truncsfhf2
3123 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3124 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3125 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3126 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
3127 ; RV32I-NEXT: .cfi_restore ra
3128 ; RV32I-NEXT: .cfi_restore s0
3129 ; RV32I-NEXT: .cfi_restore s1
3130 ; RV32I-NEXT: .cfi_restore s2
3131 ; RV32I-NEXT: addi sp, sp, 16
3132 ; RV32I-NEXT: .cfi_def_cfa_offset 0
3135 ; RV64I-LABEL: minimumnum_half:
3137 ; RV64I-NEXT: addi sp, sp, -32
3138 ; RV64I-NEXT: .cfi_def_cfa_offset 32
3139 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
3140 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
3141 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
3142 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
3143 ; RV64I-NEXT: .cfi_offset ra, -8
3144 ; RV64I-NEXT: .cfi_offset s0, -16
3145 ; RV64I-NEXT: .cfi_offset s1, -24
3146 ; RV64I-NEXT: .cfi_offset s2, -32
3147 ; RV64I-NEXT: mv s0, a1
3148 ; RV64I-NEXT: lui a1, 16
3149 ; RV64I-NEXT: addiw s2, a1, -1
3150 ; RV64I-NEXT: and a0, a0, s2
3151 ; RV64I-NEXT: call __extendhfsf2
3152 ; RV64I-NEXT: mv s1, a0
3153 ; RV64I-NEXT: and a0, s0, s2
3154 ; RV64I-NEXT: call __extendhfsf2
3155 ; RV64I-NEXT: mv a1, a0
3156 ; RV64I-NEXT: mv a0, s1
3157 ; RV64I-NEXT: call fminimum_numf
3158 ; RV64I-NEXT: call __truncsfhf2
3159 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
3160 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
3161 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
3162 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
3163 ; RV64I-NEXT: .cfi_restore ra
3164 ; RV64I-NEXT: .cfi_restore s0
3165 ; RV64I-NEXT: .cfi_restore s1
3166 ; RV64I-NEXT: .cfi_restore s2
3167 ; RV64I-NEXT: addi sp, sp, 32
3168 ; RV64I-NEXT: .cfi_def_cfa_offset 0
3171 ; CHECKIZFHMIN-LABEL: minimumnum_half:
3172 ; CHECKIZFHMIN: # %bb.0:
3173 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa5, fa1
3174 ; CHECKIZFHMIN-NEXT: fcvt.s.h fa4, fa0
3175 ; CHECKIZFHMIN-NEXT: fmin.s fa5, fa4, fa5
3176 ; CHECKIZFHMIN-NEXT: fcvt.h.s fa0, fa5
3177 ; CHECKIZFHMIN-NEXT: ret
3179 ; CHECKIZHINXMIN-LABEL: minimumnum_half:
3180 ; CHECKIZHINXMIN: # %bb.0:
3181 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a1, a1
3182 ; CHECKIZHINXMIN-NEXT: fcvt.s.h a0, a0
3183 ; CHECKIZHINXMIN-NEXT: fmin.s a0, a0, a1
3184 ; CHECKIZHINXMIN-NEXT: fcvt.h.s a0, a0
3185 ; CHECKIZHINXMIN-NEXT: ret
3186 %z = call half @llvm.minimumnum.f16(half %x, half %y)