1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+zfh -verify-machineinstrs \
3 ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefixes=CHECKIZFH,RV32IZFH %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \
5 ; RUN: -target-abi lp64f < %s | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh -verify-machineinstrs \
7 ; RUN: -target-abi ilp32d < %s | FileCheck -check-prefix=RV32IDZFH %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh -verify-machineinstrs \
9 ; RUN: -target-abi lp64d < %s | FileCheck -check-prefix=RV64IDZFH %s
10 ; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \
11 ; RUN: -target-abi ilp32 < %s | FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s
12 ; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \
13 ; RUN: -target-abi lp64 < %s | FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s
14 ; RUN: llc -mtriple=riscv32 -mattr=+zdinx,+zhinx -verify-machineinstrs \
15 ; RUN: -target-abi ilp32 < %s | FileCheck -check-prefixes=CHECKIZDINXZHINX,RV32IZDINXZHINX %s
16 ; RUN: llc -mtriple=riscv64 -mattr=+zdinx,+zhinx -verify-machineinstrs \
17 ; RUN: -target-abi lp64 < %s | FileCheck -check-prefixes=CHECKIZDINXZHINX,RV64IZDINXZHINX %s
18 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs \
19 ; RUN: < %s | FileCheck -check-prefix=RV32I %s
20 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs \
21 ; RUN: < %s | FileCheck -check-prefix=RV64I %s
22 ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi=ilp32 -verify-machineinstrs \
23 ; RUN: < %s | FileCheck %s -check-prefix=RV32ID-ILP32
24 ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi=lp64 -verify-machineinstrs \
25 ; RUN: < %s | FileCheck %s -check-prefix=RV64ID-LP64
26 ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi=ilp32d -verify-machineinstrs \
27 ; RUN: < %s | FileCheck %s -check-prefix=RV32ID
28 ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi=lp64d -verify-machineinstrs \
29 ; RUN: < %s | FileCheck %s -check-prefix=RV64ID
30 ; RUN: llc -mtriple=riscv32 -mattr=+zfhmin -verify-machineinstrs \
31 ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefixes=CHECK32-IZFHMIN,RV32IFZFHMIN %s
32 ; RUN: llc -mtriple=riscv64 -mattr=+zfhmin -verify-machineinstrs \
33 ; RUN: -target-abi lp64f < %s | FileCheck -check-prefixes=CHECK64-IZFHMIN,RV64IFZFHMIN %s
34 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfhmin -verify-machineinstrs \
35 ; RUN: -target-abi ilp32d < %s | FileCheck -check-prefixes=CHECK32-IZFHMIN,RV32IDZFHMIN %s
36 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfhmin -verify-machineinstrs \
37 ; RUN: -target-abi lp64d < %s | FileCheck -check-prefixes=CHECK64-IZFHMIN,RV64IDZFHMIN %s
38 ; RUN: llc -mtriple=riscv32 -mattr=+zhinxmin -verify-machineinstrs \
39 ; RUN: -target-abi ilp32 < %s | FileCheck -check-prefixes=CHECK32-IZHINXMIN %s
40 ; RUN: llc -mtriple=riscv64 -mattr=+zhinxmin -verify-machineinstrs \
41 ; RUN: -target-abi lp64 < %s | FileCheck -check-prefixes=CHECK64-IZHINXMIN %s
42 ; RUN: llc -mtriple=riscv32 -mattr=+zdinx,+zhinxmin -verify-machineinstrs \
43 ; RUN: -target-abi ilp32 < %s | FileCheck -check-prefixes=CHECK32-IZDINXZHINXMIN %s
44 ; RUN: llc -mtriple=riscv64 -mattr=+zdinx,+zhinxmin -verify-machineinstrs \
45 ; RUN: -target-abi lp64 < %s | FileCheck -check-prefixes=CHECK64-IZDINXZHINXMIN %s
47 define i16 @fcvt_si_h(half %a) nounwind {
48 ; RV32IZFH-LABEL: fcvt_si_h:
50 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rtz
53 ; RV64IZFH-LABEL: fcvt_si_h:
55 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
58 ; RV32IDZFH-LABEL: fcvt_si_h:
60 ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
63 ; RV64IDZFH-LABEL: fcvt_si_h:
65 ; RV64IDZFH-NEXT: fcvt.l.h a0, fa0, rtz
68 ; RV32IZHINX-LABEL: fcvt_si_h:
69 ; RV32IZHINX: # %bb.0:
70 ; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz
71 ; RV32IZHINX-NEXT: ret
73 ; RV64IZHINX-LABEL: fcvt_si_h:
74 ; RV64IZHINX: # %bb.0:
75 ; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz
76 ; RV64IZHINX-NEXT: ret
78 ; RV32IZDINXZHINX-LABEL: fcvt_si_h:
79 ; RV32IZDINXZHINX: # %bb.0:
80 ; RV32IZDINXZHINX-NEXT: fcvt.w.h a0, a0, rtz
81 ; RV32IZDINXZHINX-NEXT: ret
83 ; RV64IZDINXZHINX-LABEL: fcvt_si_h:
84 ; RV64IZDINXZHINX: # %bb.0:
85 ; RV64IZDINXZHINX-NEXT: fcvt.l.h a0, a0, rtz
86 ; RV64IZDINXZHINX-NEXT: ret
88 ; RV32I-LABEL: fcvt_si_h:
90 ; RV32I-NEXT: addi sp, sp, -16
91 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
92 ; RV32I-NEXT: slli a0, a0, 16
93 ; RV32I-NEXT: srli a0, a0, 16
94 ; RV32I-NEXT: call __extendhfsf2
95 ; RV32I-NEXT: call __fixsfsi
96 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
97 ; RV32I-NEXT: addi sp, sp, 16
100 ; RV64I-LABEL: fcvt_si_h:
102 ; RV64I-NEXT: addi sp, sp, -16
103 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
104 ; RV64I-NEXT: slli a0, a0, 48
105 ; RV64I-NEXT: srli a0, a0, 48
106 ; RV64I-NEXT: call __extendhfsf2
107 ; RV64I-NEXT: call __fixsfdi
108 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
109 ; RV64I-NEXT: addi sp, sp, 16
112 ; RV32ID-ILP32-LABEL: fcvt_si_h:
113 ; RV32ID-ILP32: # %bb.0:
114 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
115 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
116 ; RV32ID-ILP32-NEXT: call __extendhfsf2
117 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
118 ; RV32ID-ILP32-NEXT: fcvt.w.s a0, fa5, rtz
119 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
120 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
121 ; RV32ID-ILP32-NEXT: ret
123 ; RV64ID-LP64-LABEL: fcvt_si_h:
124 ; RV64ID-LP64: # %bb.0:
125 ; RV64ID-LP64-NEXT: addi sp, sp, -16
126 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
127 ; RV64ID-LP64-NEXT: call __extendhfsf2
128 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
129 ; RV64ID-LP64-NEXT: fcvt.l.s a0, fa5, rtz
130 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
131 ; RV64ID-LP64-NEXT: addi sp, sp, 16
132 ; RV64ID-LP64-NEXT: ret
134 ; RV32ID-LABEL: fcvt_si_h:
136 ; RV32ID-NEXT: addi sp, sp, -16
137 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
138 ; RV32ID-NEXT: call __extendhfsf2
139 ; RV32ID-NEXT: fcvt.w.s a0, fa0, rtz
140 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
141 ; RV32ID-NEXT: addi sp, sp, 16
144 ; RV64ID-LABEL: fcvt_si_h:
146 ; RV64ID-NEXT: addi sp, sp, -16
147 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
148 ; RV64ID-NEXT: call __extendhfsf2
149 ; RV64ID-NEXT: fcvt.l.s a0, fa0, rtz
150 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
151 ; RV64ID-NEXT: addi sp, sp, 16
154 ; CHECK32-IZFHMIN-LABEL: fcvt_si_h:
155 ; CHECK32-IZFHMIN: # %bb.0:
156 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
157 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
158 ; CHECK32-IZFHMIN-NEXT: ret
160 ; CHECK64-IZFHMIN-LABEL: fcvt_si_h:
161 ; CHECK64-IZFHMIN: # %bb.0:
162 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
163 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a0, fa5, rtz
164 ; CHECK64-IZFHMIN-NEXT: ret
166 ; CHECK32-IZHINXMIN-LABEL: fcvt_si_h:
167 ; CHECK32-IZHINXMIN: # %bb.0:
168 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
169 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
170 ; CHECK32-IZHINXMIN-NEXT: ret
172 ; CHECK64-IZHINXMIN-LABEL: fcvt_si_h:
173 ; CHECK64-IZHINXMIN: # %bb.0:
174 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
175 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
176 ; CHECK64-IZHINXMIN-NEXT: ret
178 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_si_h:
179 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
180 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
181 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
182 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
184 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_si_h:
185 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
186 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
187 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
188 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
189 %1 = fptosi half %a to i16
193 define i16 @fcvt_si_h_sat(half %a) nounwind {
194 ; RV32IZFH-LABEL: fcvt_si_h_sat:
195 ; RV32IZFH: # %bb.0: # %start
196 ; RV32IZFH-NEXT: fcvt.s.h fa5, fa0
197 ; RV32IZFH-NEXT: feq.s a0, fa5, fa5
198 ; RV32IZFH-NEXT: neg a0, a0
199 ; RV32IZFH-NEXT: lui a1, %hi(.LCPI1_0)
200 ; RV32IZFH-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
201 ; RV32IZFH-NEXT: lui a1, 815104
202 ; RV32IZFH-NEXT: fmv.w.x fa3, a1
203 ; RV32IZFH-NEXT: fmax.s fa5, fa5, fa3
204 ; RV32IZFH-NEXT: fmin.s fa5, fa5, fa4
205 ; RV32IZFH-NEXT: fcvt.w.s a1, fa5, rtz
206 ; RV32IZFH-NEXT: and a0, a0, a1
209 ; RV64IZFH-LABEL: fcvt_si_h_sat:
210 ; RV64IZFH: # %bb.0: # %start
211 ; RV64IZFH-NEXT: fcvt.s.h fa5, fa0
212 ; RV64IZFH-NEXT: feq.s a0, fa5, fa5
213 ; RV64IZFH-NEXT: lui a1, %hi(.LCPI1_0)
214 ; RV64IZFH-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
215 ; RV64IZFH-NEXT: lui a1, 815104
216 ; RV64IZFH-NEXT: fmv.w.x fa3, a1
217 ; RV64IZFH-NEXT: fmax.s fa5, fa5, fa3
218 ; RV64IZFH-NEXT: neg a0, a0
219 ; RV64IZFH-NEXT: fmin.s fa5, fa5, fa4
220 ; RV64IZFH-NEXT: fcvt.l.s a1, fa5, rtz
221 ; RV64IZFH-NEXT: and a0, a0, a1
224 ; RV32IDZFH-LABEL: fcvt_si_h_sat:
225 ; RV32IDZFH: # %bb.0: # %start
226 ; RV32IDZFH-NEXT: fcvt.s.h fa5, fa0
227 ; RV32IDZFH-NEXT: feq.s a0, fa5, fa5
228 ; RV32IDZFH-NEXT: neg a0, a0
229 ; RV32IDZFH-NEXT: lui a1, %hi(.LCPI1_0)
230 ; RV32IDZFH-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
231 ; RV32IDZFH-NEXT: lui a1, 815104
232 ; RV32IDZFH-NEXT: fmv.w.x fa3, a1
233 ; RV32IDZFH-NEXT: fmax.s fa5, fa5, fa3
234 ; RV32IDZFH-NEXT: fmin.s fa5, fa5, fa4
235 ; RV32IDZFH-NEXT: fcvt.w.s a1, fa5, rtz
236 ; RV32IDZFH-NEXT: and a0, a0, a1
237 ; RV32IDZFH-NEXT: ret
239 ; RV64IDZFH-LABEL: fcvt_si_h_sat:
240 ; RV64IDZFH: # %bb.0: # %start
241 ; RV64IDZFH-NEXT: fcvt.s.h fa5, fa0
242 ; RV64IDZFH-NEXT: feq.s a0, fa5, fa5
243 ; RV64IDZFH-NEXT: lui a1, %hi(.LCPI1_0)
244 ; RV64IDZFH-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
245 ; RV64IDZFH-NEXT: lui a1, 815104
246 ; RV64IDZFH-NEXT: fmv.w.x fa3, a1
247 ; RV64IDZFH-NEXT: fmax.s fa5, fa5, fa3
248 ; RV64IDZFH-NEXT: neg a0, a0
249 ; RV64IDZFH-NEXT: fmin.s fa5, fa5, fa4
250 ; RV64IDZFH-NEXT: fcvt.l.s a1, fa5, rtz
251 ; RV64IDZFH-NEXT: and a0, a0, a1
252 ; RV64IDZFH-NEXT: ret
254 ; RV32IZHINX-LABEL: fcvt_si_h_sat:
255 ; RV32IZHINX: # %bb.0: # %start
256 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
257 ; RV32IZHINX-NEXT: feq.s a1, a0, a0
258 ; RV32IZHINX-NEXT: lui a2, %hi(.LCPI1_0)
259 ; RV32IZHINX-NEXT: lw a2, %lo(.LCPI1_0)(a2)
260 ; RV32IZHINX-NEXT: neg a1, a1
261 ; RV32IZHINX-NEXT: lui a3, 815104
262 ; RV32IZHINX-NEXT: fmax.s a0, a0, a3
263 ; RV32IZHINX-NEXT: fmin.s a0, a0, a2
264 ; RV32IZHINX-NEXT: fcvt.w.s a0, a0, rtz
265 ; RV32IZHINX-NEXT: and a0, a1, a0
266 ; RV32IZHINX-NEXT: ret
268 ; RV64IZHINX-LABEL: fcvt_si_h_sat:
269 ; RV64IZHINX: # %bb.0: # %start
270 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
271 ; RV64IZHINX-NEXT: lui a1, 815104
272 ; RV64IZHINX-NEXT: lui a2, %hi(.LCPI1_0)
273 ; RV64IZHINX-NEXT: lw a2, %lo(.LCPI1_0)(a2)
274 ; RV64IZHINX-NEXT: fmax.s a1, a0, a1
275 ; RV64IZHINX-NEXT: feq.s a0, a0, a0
276 ; RV64IZHINX-NEXT: neg a0, a0
277 ; RV64IZHINX-NEXT: fmin.s a1, a1, a2
278 ; RV64IZHINX-NEXT: fcvt.l.s a1, a1, rtz
279 ; RV64IZHINX-NEXT: and a0, a0, a1
280 ; RV64IZHINX-NEXT: ret
282 ; RV32IZDINXZHINX-LABEL: fcvt_si_h_sat:
283 ; RV32IZDINXZHINX: # %bb.0: # %start
284 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
285 ; RV32IZDINXZHINX-NEXT: feq.s a1, a0, a0
286 ; RV32IZDINXZHINX-NEXT: lui a2, %hi(.LCPI1_0)
287 ; RV32IZDINXZHINX-NEXT: lw a2, %lo(.LCPI1_0)(a2)
288 ; RV32IZDINXZHINX-NEXT: neg a1, a1
289 ; RV32IZDINXZHINX-NEXT: lui a3, 815104
290 ; RV32IZDINXZHINX-NEXT: fmax.s a0, a0, a3
291 ; RV32IZDINXZHINX-NEXT: fmin.s a0, a0, a2
292 ; RV32IZDINXZHINX-NEXT: fcvt.w.s a0, a0, rtz
293 ; RV32IZDINXZHINX-NEXT: and a0, a1, a0
294 ; RV32IZDINXZHINX-NEXT: ret
296 ; RV64IZDINXZHINX-LABEL: fcvt_si_h_sat:
297 ; RV64IZDINXZHINX: # %bb.0: # %start
298 ; RV64IZDINXZHINX-NEXT: fcvt.s.h a0, a0
299 ; RV64IZDINXZHINX-NEXT: lui a1, 815104
300 ; RV64IZDINXZHINX-NEXT: lui a2, %hi(.LCPI1_0)
301 ; RV64IZDINXZHINX-NEXT: lw a2, %lo(.LCPI1_0)(a2)
302 ; RV64IZDINXZHINX-NEXT: fmax.s a1, a0, a1
303 ; RV64IZDINXZHINX-NEXT: feq.s a0, a0, a0
304 ; RV64IZDINXZHINX-NEXT: neg a0, a0
305 ; RV64IZDINXZHINX-NEXT: fmin.s a1, a1, a2
306 ; RV64IZDINXZHINX-NEXT: fcvt.l.s a1, a1, rtz
307 ; RV64IZDINXZHINX-NEXT: and a0, a0, a1
308 ; RV64IZDINXZHINX-NEXT: ret
310 ; RV32I-LABEL: fcvt_si_h_sat:
311 ; RV32I: # %bb.0: # %start
312 ; RV32I-NEXT: addi sp, sp, -16
313 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
314 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
315 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
316 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
317 ; RV32I-NEXT: slli a0, a0, 16
318 ; RV32I-NEXT: srli a0, a0, 16
319 ; RV32I-NEXT: call __extendhfsf2
320 ; RV32I-NEXT: mv s0, a0
321 ; RV32I-NEXT: lui a1, 815104
322 ; RV32I-NEXT: call __gesf2
323 ; RV32I-NEXT: mv s2, a0
324 ; RV32I-NEXT: mv a0, s0
325 ; RV32I-NEXT: call __fixsfsi
326 ; RV32I-NEXT: mv s1, a0
327 ; RV32I-NEXT: bgez s2, .LBB1_2
328 ; RV32I-NEXT: # %bb.1: # %start
329 ; RV32I-NEXT: lui s1, 1048568
330 ; RV32I-NEXT: .LBB1_2: # %start
331 ; RV32I-NEXT: lui a0, 290816
332 ; RV32I-NEXT: addi a1, a0, -512
333 ; RV32I-NEXT: mv a0, s0
334 ; RV32I-NEXT: call __gtsf2
335 ; RV32I-NEXT: blez a0, .LBB1_4
336 ; RV32I-NEXT: # %bb.3: # %start
337 ; RV32I-NEXT: lui s1, 8
338 ; RV32I-NEXT: addi s1, s1, -1
339 ; RV32I-NEXT: .LBB1_4: # %start
340 ; RV32I-NEXT: mv a0, s0
341 ; RV32I-NEXT: mv a1, s0
342 ; RV32I-NEXT: call __unordsf2
343 ; RV32I-NEXT: snez a0, a0
344 ; RV32I-NEXT: addi a0, a0, -1
345 ; RV32I-NEXT: and a0, a0, s1
346 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
347 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
348 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
349 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
350 ; RV32I-NEXT: addi sp, sp, 16
353 ; RV64I-LABEL: fcvt_si_h_sat:
354 ; RV64I: # %bb.0: # %start
355 ; RV64I-NEXT: addi sp, sp, -32
356 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
357 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
358 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
359 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
360 ; RV64I-NEXT: slli a0, a0, 48
361 ; RV64I-NEXT: srli a0, a0, 48
362 ; RV64I-NEXT: call __extendhfsf2
363 ; RV64I-NEXT: mv s0, a0
364 ; RV64I-NEXT: lui a1, 815104
365 ; RV64I-NEXT: call __gesf2
366 ; RV64I-NEXT: mv s2, a0
367 ; RV64I-NEXT: mv a0, s0
368 ; RV64I-NEXT: call __fixsfdi
369 ; RV64I-NEXT: mv s1, a0
370 ; RV64I-NEXT: bgez s2, .LBB1_2
371 ; RV64I-NEXT: # %bb.1: # %start
372 ; RV64I-NEXT: lui s1, 1048568
373 ; RV64I-NEXT: .LBB1_2: # %start
374 ; RV64I-NEXT: lui a0, 290816
375 ; RV64I-NEXT: addiw a1, a0, -512
376 ; RV64I-NEXT: mv a0, s0
377 ; RV64I-NEXT: call __gtsf2
378 ; RV64I-NEXT: blez a0, .LBB1_4
379 ; RV64I-NEXT: # %bb.3: # %start
380 ; RV64I-NEXT: lui s1, 8
381 ; RV64I-NEXT: addiw s1, s1, -1
382 ; RV64I-NEXT: .LBB1_4: # %start
383 ; RV64I-NEXT: mv a0, s0
384 ; RV64I-NEXT: mv a1, s0
385 ; RV64I-NEXT: call __unordsf2
386 ; RV64I-NEXT: snez a0, a0
387 ; RV64I-NEXT: addi a0, a0, -1
388 ; RV64I-NEXT: and a0, a0, s1
389 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
390 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
391 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
392 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
393 ; RV64I-NEXT: addi sp, sp, 32
396 ; RV32ID-ILP32-LABEL: fcvt_si_h_sat:
397 ; RV32ID-ILP32: # %bb.0: # %start
398 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
399 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
400 ; RV32ID-ILP32-NEXT: call __extendhfsf2
401 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
402 ; RV32ID-ILP32-NEXT: feq.s a0, fa5, fa5
403 ; RV32ID-ILP32-NEXT: neg a0, a0
404 ; RV32ID-ILP32-NEXT: lui a1, %hi(.LCPI1_0)
405 ; RV32ID-ILP32-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
406 ; RV32ID-ILP32-NEXT: lui a1, 815104
407 ; RV32ID-ILP32-NEXT: fmv.w.x fa3, a1
408 ; RV32ID-ILP32-NEXT: fmax.s fa5, fa5, fa3
409 ; RV32ID-ILP32-NEXT: fmin.s fa5, fa5, fa4
410 ; RV32ID-ILP32-NEXT: fcvt.w.s a1, fa5, rtz
411 ; RV32ID-ILP32-NEXT: and a0, a0, a1
412 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
413 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
414 ; RV32ID-ILP32-NEXT: ret
416 ; RV64ID-LP64-LABEL: fcvt_si_h_sat:
417 ; RV64ID-LP64: # %bb.0: # %start
418 ; RV64ID-LP64-NEXT: addi sp, sp, -16
419 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
420 ; RV64ID-LP64-NEXT: call __extendhfsf2
421 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
422 ; RV64ID-LP64-NEXT: feq.s a0, fa5, fa5
423 ; RV64ID-LP64-NEXT: lui a1, %hi(.LCPI1_0)
424 ; RV64ID-LP64-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
425 ; RV64ID-LP64-NEXT: lui a1, 815104
426 ; RV64ID-LP64-NEXT: fmv.w.x fa3, a1
427 ; RV64ID-LP64-NEXT: fmax.s fa5, fa5, fa3
428 ; RV64ID-LP64-NEXT: neg a0, a0
429 ; RV64ID-LP64-NEXT: fmin.s fa5, fa5, fa4
430 ; RV64ID-LP64-NEXT: fcvt.l.s a1, fa5, rtz
431 ; RV64ID-LP64-NEXT: and a0, a0, a1
432 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
433 ; RV64ID-LP64-NEXT: addi sp, sp, 16
434 ; RV64ID-LP64-NEXT: ret
436 ; RV32ID-LABEL: fcvt_si_h_sat:
437 ; RV32ID: # %bb.0: # %start
438 ; RV32ID-NEXT: addi sp, sp, -16
439 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
440 ; RV32ID-NEXT: call __extendhfsf2
441 ; RV32ID-NEXT: feq.s a0, fa0, fa0
442 ; RV32ID-NEXT: neg a0, a0
443 ; RV32ID-NEXT: lui a1, %hi(.LCPI1_0)
444 ; RV32ID-NEXT: flw fa5, %lo(.LCPI1_0)(a1)
445 ; RV32ID-NEXT: lui a1, 815104
446 ; RV32ID-NEXT: fmv.w.x fa4, a1
447 ; RV32ID-NEXT: fmax.s fa4, fa0, fa4
448 ; RV32ID-NEXT: fmin.s fa5, fa4, fa5
449 ; RV32ID-NEXT: fcvt.w.s a1, fa5, rtz
450 ; RV32ID-NEXT: and a0, a0, a1
451 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
452 ; RV32ID-NEXT: addi sp, sp, 16
455 ; RV64ID-LABEL: fcvt_si_h_sat:
456 ; RV64ID: # %bb.0: # %start
457 ; RV64ID-NEXT: addi sp, sp, -16
458 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
459 ; RV64ID-NEXT: call __extendhfsf2
460 ; RV64ID-NEXT: feq.s a0, fa0, fa0
461 ; RV64ID-NEXT: lui a1, %hi(.LCPI1_0)
462 ; RV64ID-NEXT: flw fa5, %lo(.LCPI1_0)(a1)
463 ; RV64ID-NEXT: lui a1, 815104
464 ; RV64ID-NEXT: fmv.w.x fa4, a1
465 ; RV64ID-NEXT: fmax.s fa4, fa0, fa4
466 ; RV64ID-NEXT: neg a0, a0
467 ; RV64ID-NEXT: fmin.s fa5, fa4, fa5
468 ; RV64ID-NEXT: fcvt.l.s a1, fa5, rtz
469 ; RV64ID-NEXT: and a0, a0, a1
470 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
471 ; RV64ID-NEXT: addi sp, sp, 16
474 ; CHECK32-IZFHMIN-LABEL: fcvt_si_h_sat:
475 ; CHECK32-IZFHMIN: # %bb.0: # %start
476 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
477 ; CHECK32-IZFHMIN-NEXT: feq.s a0, fa5, fa5
478 ; CHECK32-IZFHMIN-NEXT: neg a0, a0
479 ; CHECK32-IZFHMIN-NEXT: lui a1, %hi(.LCPI1_0)
480 ; CHECK32-IZFHMIN-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
481 ; CHECK32-IZFHMIN-NEXT: lui a1, 815104
482 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa3, a1
483 ; CHECK32-IZFHMIN-NEXT: fmax.s fa5, fa5, fa3
484 ; CHECK32-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
485 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a1, fa5, rtz
486 ; CHECK32-IZFHMIN-NEXT: and a0, a0, a1
487 ; CHECK32-IZFHMIN-NEXT: ret
489 ; CHECK64-IZFHMIN-LABEL: fcvt_si_h_sat:
490 ; CHECK64-IZFHMIN: # %bb.0: # %start
491 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
492 ; CHECK64-IZFHMIN-NEXT: feq.s a0, fa5, fa5
493 ; CHECK64-IZFHMIN-NEXT: lui a1, %hi(.LCPI1_0)
494 ; CHECK64-IZFHMIN-NEXT: flw fa4, %lo(.LCPI1_0)(a1)
495 ; CHECK64-IZFHMIN-NEXT: lui a1, 815104
496 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa3, a1
497 ; CHECK64-IZFHMIN-NEXT: fmax.s fa5, fa5, fa3
498 ; CHECK64-IZFHMIN-NEXT: neg a0, a0
499 ; CHECK64-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
500 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a1, fa5, rtz
501 ; CHECK64-IZFHMIN-NEXT: and a0, a0, a1
502 ; CHECK64-IZFHMIN-NEXT: ret
504 ; CHECK32-IZHINXMIN-LABEL: fcvt_si_h_sat:
505 ; CHECK32-IZHINXMIN: # %bb.0: # %start
506 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
507 ; CHECK32-IZHINXMIN-NEXT: feq.s a1, a0, a0
508 ; CHECK32-IZHINXMIN-NEXT: lui a2, %hi(.LCPI1_0)
509 ; CHECK32-IZHINXMIN-NEXT: lw a2, %lo(.LCPI1_0)(a2)
510 ; CHECK32-IZHINXMIN-NEXT: neg a1, a1
511 ; CHECK32-IZHINXMIN-NEXT: lui a3, 815104
512 ; CHECK32-IZHINXMIN-NEXT: fmax.s a0, a0, a3
513 ; CHECK32-IZHINXMIN-NEXT: fmin.s a0, a0, a2
514 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
515 ; CHECK32-IZHINXMIN-NEXT: and a0, a1, a0
516 ; CHECK32-IZHINXMIN-NEXT: ret
518 ; CHECK64-IZHINXMIN-LABEL: fcvt_si_h_sat:
519 ; CHECK64-IZHINXMIN: # %bb.0: # %start
520 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
521 ; CHECK64-IZHINXMIN-NEXT: lui a1, 815104
522 ; CHECK64-IZHINXMIN-NEXT: lui a2, %hi(.LCPI1_0)
523 ; CHECK64-IZHINXMIN-NEXT: lw a2, %lo(.LCPI1_0)(a2)
524 ; CHECK64-IZHINXMIN-NEXT: fmax.s a1, a0, a1
525 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
526 ; CHECK64-IZHINXMIN-NEXT: neg a0, a0
527 ; CHECK64-IZHINXMIN-NEXT: fmin.s a1, a1, a2
528 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a1, a1, rtz
529 ; CHECK64-IZHINXMIN-NEXT: and a0, a0, a1
530 ; CHECK64-IZHINXMIN-NEXT: ret
532 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_si_h_sat:
533 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
534 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
535 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a1, a0, a0
536 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a2, %hi(.LCPI1_0)
537 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a2, %lo(.LCPI1_0)(a2)
538 ; CHECK32-IZDINXZHINXMIN-NEXT: neg a1, a1
539 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a3, 815104
540 ; CHECK32-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, a3
541 ; CHECK32-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a2
542 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
543 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a1, a0
544 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
546 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_si_h_sat:
547 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
548 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
549 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a1, 815104
550 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a2, %hi(.LCPI1_0)
551 ; CHECK64-IZDINXZHINXMIN-NEXT: lw a2, %lo(.LCPI1_0)(a2)
552 ; CHECK64-IZDINXZHINXMIN-NEXT: fmax.s a1, a0, a1
553 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
554 ; CHECK64-IZDINXZHINXMIN-NEXT: neg a0, a0
555 ; CHECK64-IZDINXZHINXMIN-NEXT: fmin.s a1, a1, a2
556 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a1, a1, rtz
557 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a0, a1
558 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
560 %0 = tail call i16 @llvm.fptosi.sat.i16.f16(half %a)
563 declare i16 @llvm.fptosi.sat.i16.f16(half)
565 define i16 @fcvt_ui_h(half %a) nounwind {
566 ; RV32IZFH-LABEL: fcvt_ui_h:
568 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
571 ; RV64IZFH-LABEL: fcvt_ui_h:
573 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
576 ; RV32IDZFH-LABEL: fcvt_ui_h:
577 ; RV32IDZFH: # %bb.0:
578 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
579 ; RV32IDZFH-NEXT: ret
581 ; RV64IDZFH-LABEL: fcvt_ui_h:
582 ; RV64IDZFH: # %bb.0:
583 ; RV64IDZFH-NEXT: fcvt.lu.h a0, fa0, rtz
584 ; RV64IDZFH-NEXT: ret
586 ; RV32IZHINX-LABEL: fcvt_ui_h:
587 ; RV32IZHINX: # %bb.0:
588 ; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz
589 ; RV32IZHINX-NEXT: ret
591 ; RV64IZHINX-LABEL: fcvt_ui_h:
592 ; RV64IZHINX: # %bb.0:
593 ; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz
594 ; RV64IZHINX-NEXT: ret
596 ; RV32IZDINXZHINX-LABEL: fcvt_ui_h:
597 ; RV32IZDINXZHINX: # %bb.0:
598 ; RV32IZDINXZHINX-NEXT: fcvt.wu.h a0, a0, rtz
599 ; RV32IZDINXZHINX-NEXT: ret
601 ; RV64IZDINXZHINX-LABEL: fcvt_ui_h:
602 ; RV64IZDINXZHINX: # %bb.0:
603 ; RV64IZDINXZHINX-NEXT: fcvt.lu.h a0, a0, rtz
604 ; RV64IZDINXZHINX-NEXT: ret
606 ; RV32I-LABEL: fcvt_ui_h:
608 ; RV32I-NEXT: addi sp, sp, -16
609 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
610 ; RV32I-NEXT: slli a0, a0, 16
611 ; RV32I-NEXT: srli a0, a0, 16
612 ; RV32I-NEXT: call __extendhfsf2
613 ; RV32I-NEXT: call __fixunssfsi
614 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
615 ; RV32I-NEXT: addi sp, sp, 16
618 ; RV64I-LABEL: fcvt_ui_h:
620 ; RV64I-NEXT: addi sp, sp, -16
621 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
622 ; RV64I-NEXT: slli a0, a0, 48
623 ; RV64I-NEXT: srli a0, a0, 48
624 ; RV64I-NEXT: call __extendhfsf2
625 ; RV64I-NEXT: call __fixunssfdi
626 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
627 ; RV64I-NEXT: addi sp, sp, 16
630 ; RV32ID-ILP32-LABEL: fcvt_ui_h:
631 ; RV32ID-ILP32: # %bb.0:
632 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
633 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
634 ; RV32ID-ILP32-NEXT: call __extendhfsf2
635 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
636 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
637 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
638 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
639 ; RV32ID-ILP32-NEXT: ret
641 ; RV64ID-LP64-LABEL: fcvt_ui_h:
642 ; RV64ID-LP64: # %bb.0:
643 ; RV64ID-LP64-NEXT: addi sp, sp, -16
644 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
645 ; RV64ID-LP64-NEXT: call __extendhfsf2
646 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
647 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
648 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
649 ; RV64ID-LP64-NEXT: addi sp, sp, 16
650 ; RV64ID-LP64-NEXT: ret
652 ; RV32ID-LABEL: fcvt_ui_h:
654 ; RV32ID-NEXT: addi sp, sp, -16
655 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
656 ; RV32ID-NEXT: call __extendhfsf2
657 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
658 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
659 ; RV32ID-NEXT: addi sp, sp, 16
662 ; RV64ID-LABEL: fcvt_ui_h:
664 ; RV64ID-NEXT: addi sp, sp, -16
665 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
666 ; RV64ID-NEXT: call __extendhfsf2
667 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
668 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
669 ; RV64ID-NEXT: addi sp, sp, 16
672 ; CHECK32-IZFHMIN-LABEL: fcvt_ui_h:
673 ; CHECK32-IZFHMIN: # %bb.0:
674 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
675 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
676 ; CHECK32-IZFHMIN-NEXT: ret
678 ; CHECK64-IZFHMIN-LABEL: fcvt_ui_h:
679 ; CHECK64-IZFHMIN: # %bb.0:
680 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
681 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
682 ; CHECK64-IZFHMIN-NEXT: ret
684 ; CHECK32-IZHINXMIN-LABEL: fcvt_ui_h:
685 ; CHECK32-IZHINXMIN: # %bb.0:
686 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
687 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
688 ; CHECK32-IZHINXMIN-NEXT: ret
690 ; CHECK64-IZHINXMIN-LABEL: fcvt_ui_h:
691 ; CHECK64-IZHINXMIN: # %bb.0:
692 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
693 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
694 ; CHECK64-IZHINXMIN-NEXT: ret
696 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_ui_h:
697 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
698 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
699 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
700 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
702 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_ui_h:
703 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
704 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
705 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
706 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
707 %1 = fptoui half %a to i16
711 define i16 @fcvt_ui_h_sat(half %a) nounwind {
712 ; RV32IZFH-LABEL: fcvt_ui_h_sat:
713 ; RV32IZFH: # %bb.0: # %start
714 ; RV32IZFH-NEXT: lui a0, %hi(.LCPI3_0)
715 ; RV32IZFH-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
716 ; RV32IZFH-NEXT: fcvt.s.h fa4, fa0
717 ; RV32IZFH-NEXT: fmv.w.x fa3, zero
718 ; RV32IZFH-NEXT: fmax.s fa4, fa4, fa3
719 ; RV32IZFH-NEXT: fmin.s fa5, fa4, fa5
720 ; RV32IZFH-NEXT: fcvt.wu.s a0, fa5, rtz
723 ; RV64IZFH-LABEL: fcvt_ui_h_sat:
724 ; RV64IZFH: # %bb.0: # %start
725 ; RV64IZFH-NEXT: lui a0, %hi(.LCPI3_0)
726 ; RV64IZFH-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
727 ; RV64IZFH-NEXT: fcvt.s.h fa4, fa0
728 ; RV64IZFH-NEXT: fmv.w.x fa3, zero
729 ; RV64IZFH-NEXT: fmax.s fa4, fa4, fa3
730 ; RV64IZFH-NEXT: fmin.s fa5, fa4, fa5
731 ; RV64IZFH-NEXT: fcvt.lu.s a0, fa5, rtz
734 ; RV32IDZFH-LABEL: fcvt_ui_h_sat:
735 ; RV32IDZFH: # %bb.0: # %start
736 ; RV32IDZFH-NEXT: lui a0, %hi(.LCPI3_0)
737 ; RV32IDZFH-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
738 ; RV32IDZFH-NEXT: fcvt.s.h fa4, fa0
739 ; RV32IDZFH-NEXT: fmv.w.x fa3, zero
740 ; RV32IDZFH-NEXT: fmax.s fa4, fa4, fa3
741 ; RV32IDZFH-NEXT: fmin.s fa5, fa4, fa5
742 ; RV32IDZFH-NEXT: fcvt.wu.s a0, fa5, rtz
743 ; RV32IDZFH-NEXT: ret
745 ; RV64IDZFH-LABEL: fcvt_ui_h_sat:
746 ; RV64IDZFH: # %bb.0: # %start
747 ; RV64IDZFH-NEXT: lui a0, %hi(.LCPI3_0)
748 ; RV64IDZFH-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
749 ; RV64IDZFH-NEXT: fcvt.s.h fa4, fa0
750 ; RV64IDZFH-NEXT: fmv.w.x fa3, zero
751 ; RV64IDZFH-NEXT: fmax.s fa4, fa4, fa3
752 ; RV64IDZFH-NEXT: fmin.s fa5, fa4, fa5
753 ; RV64IDZFH-NEXT: fcvt.lu.s a0, fa5, rtz
754 ; RV64IDZFH-NEXT: ret
756 ; RV32IZHINX-LABEL: fcvt_ui_h_sat:
757 ; RV32IZHINX: # %bb.0: # %start
758 ; RV32IZHINX-NEXT: lui a1, %hi(.LCPI3_0)
759 ; RV32IZHINX-NEXT: lw a1, %lo(.LCPI3_0)(a1)
760 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
761 ; RV32IZHINX-NEXT: fmax.s a0, a0, zero
762 ; RV32IZHINX-NEXT: fmin.s a0, a0, a1
763 ; RV32IZHINX-NEXT: fcvt.wu.s a0, a0, rtz
764 ; RV32IZHINX-NEXT: ret
766 ; RV64IZHINX-LABEL: fcvt_ui_h_sat:
767 ; RV64IZHINX: # %bb.0: # %start
768 ; RV64IZHINX-NEXT: lui a1, %hi(.LCPI3_0)
769 ; RV64IZHINX-NEXT: lw a1, %lo(.LCPI3_0)(a1)
770 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
771 ; RV64IZHINX-NEXT: fmax.s a0, a0, zero
772 ; RV64IZHINX-NEXT: fmin.s a0, a0, a1
773 ; RV64IZHINX-NEXT: fcvt.lu.s a0, a0, rtz
774 ; RV64IZHINX-NEXT: ret
776 ; RV32IZDINXZHINX-LABEL: fcvt_ui_h_sat:
777 ; RV32IZDINXZHINX: # %bb.0: # %start
778 ; RV32IZDINXZHINX-NEXT: lui a1, %hi(.LCPI3_0)
779 ; RV32IZDINXZHINX-NEXT: lw a1, %lo(.LCPI3_0)(a1)
780 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
781 ; RV32IZDINXZHINX-NEXT: fmax.s a0, a0, zero
782 ; RV32IZDINXZHINX-NEXT: fmin.s a0, a0, a1
783 ; RV32IZDINXZHINX-NEXT: fcvt.wu.s a0, a0, rtz
784 ; RV32IZDINXZHINX-NEXT: ret
786 ; RV64IZDINXZHINX-LABEL: fcvt_ui_h_sat:
787 ; RV64IZDINXZHINX: # %bb.0: # %start
788 ; RV64IZDINXZHINX-NEXT: lui a1, %hi(.LCPI3_0)
789 ; RV64IZDINXZHINX-NEXT: lw a1, %lo(.LCPI3_0)(a1)
790 ; RV64IZDINXZHINX-NEXT: fcvt.s.h a0, a0
791 ; RV64IZDINXZHINX-NEXT: fmax.s a0, a0, zero
792 ; RV64IZDINXZHINX-NEXT: fmin.s a0, a0, a1
793 ; RV64IZDINXZHINX-NEXT: fcvt.lu.s a0, a0, rtz
794 ; RV64IZDINXZHINX-NEXT: ret
796 ; RV32I-LABEL: fcvt_ui_h_sat:
797 ; RV32I: # %bb.0: # %start
798 ; RV32I-NEXT: addi sp, sp, -32
799 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
800 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
801 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
802 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
803 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
804 ; RV32I-NEXT: lui s0, 16
805 ; RV32I-NEXT: addi s0, s0, -1
806 ; RV32I-NEXT: and a0, a0, s0
807 ; RV32I-NEXT: call __extendhfsf2
808 ; RV32I-NEXT: mv s3, a0
809 ; RV32I-NEXT: call __fixunssfsi
810 ; RV32I-NEXT: mv s1, a0
811 ; RV32I-NEXT: mv a0, s3
812 ; RV32I-NEXT: li a1, 0
813 ; RV32I-NEXT: call __gesf2
814 ; RV32I-NEXT: mv s2, a0
815 ; RV32I-NEXT: lui a0, 292864
816 ; RV32I-NEXT: addi a1, a0, -256
817 ; RV32I-NEXT: mv a0, s3
818 ; RV32I-NEXT: call __gtsf2
819 ; RV32I-NEXT: bgtz a0, .LBB3_2
820 ; RV32I-NEXT: # %bb.1:
821 ; RV32I-NEXT: slti a0, s2, 0
822 ; RV32I-NEXT: addi a0, a0, -1
823 ; RV32I-NEXT: and s0, a0, s1
824 ; RV32I-NEXT: .LBB3_2: # %start
825 ; RV32I-NEXT: mv a0, s0
826 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
827 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
828 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
829 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
830 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
831 ; RV32I-NEXT: addi sp, sp, 32
834 ; RV64I-LABEL: fcvt_ui_h_sat:
835 ; RV64I: # %bb.0: # %start
836 ; RV64I-NEXT: addi sp, sp, -48
837 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
838 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
839 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
840 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
841 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
842 ; RV64I-NEXT: lui s0, 16
843 ; RV64I-NEXT: addiw s0, s0, -1
844 ; RV64I-NEXT: and a0, a0, s0
845 ; RV64I-NEXT: call __extendhfsf2
846 ; RV64I-NEXT: mv s3, a0
847 ; RV64I-NEXT: call __fixunssfdi
848 ; RV64I-NEXT: mv s1, a0
849 ; RV64I-NEXT: mv a0, s3
850 ; RV64I-NEXT: li a1, 0
851 ; RV64I-NEXT: call __gesf2
852 ; RV64I-NEXT: mv s2, a0
853 ; RV64I-NEXT: lui a0, 292864
854 ; RV64I-NEXT: addiw a1, a0, -256
855 ; RV64I-NEXT: mv a0, s3
856 ; RV64I-NEXT: call __gtsf2
857 ; RV64I-NEXT: bgtz a0, .LBB3_2
858 ; RV64I-NEXT: # %bb.1:
859 ; RV64I-NEXT: slti a0, s2, 0
860 ; RV64I-NEXT: addi a0, a0, -1
861 ; RV64I-NEXT: and s0, a0, s1
862 ; RV64I-NEXT: .LBB3_2: # %start
863 ; RV64I-NEXT: mv a0, s0
864 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
865 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
866 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
867 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
868 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
869 ; RV64I-NEXT: addi sp, sp, 48
872 ; RV32ID-ILP32-LABEL: fcvt_ui_h_sat:
873 ; RV32ID-ILP32: # %bb.0: # %start
874 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
875 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
876 ; RV32ID-ILP32-NEXT: call __extendhfsf2
877 ; RV32ID-ILP32-NEXT: lui a1, %hi(.LCPI3_0)
878 ; RV32ID-ILP32-NEXT: flw fa5, %lo(.LCPI3_0)(a1)
879 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a0
880 ; RV32ID-ILP32-NEXT: fmv.w.x fa3, zero
881 ; RV32ID-ILP32-NEXT: fmax.s fa4, fa4, fa3
882 ; RV32ID-ILP32-NEXT: fmin.s fa5, fa4, fa5
883 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
884 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
885 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
886 ; RV32ID-ILP32-NEXT: ret
888 ; RV64ID-LP64-LABEL: fcvt_ui_h_sat:
889 ; RV64ID-LP64: # %bb.0: # %start
890 ; RV64ID-LP64-NEXT: addi sp, sp, -16
891 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
892 ; RV64ID-LP64-NEXT: call __extendhfsf2
893 ; RV64ID-LP64-NEXT: lui a1, %hi(.LCPI3_0)
894 ; RV64ID-LP64-NEXT: flw fa5, %lo(.LCPI3_0)(a1)
895 ; RV64ID-LP64-NEXT: fmv.w.x fa4, a0
896 ; RV64ID-LP64-NEXT: fmv.w.x fa3, zero
897 ; RV64ID-LP64-NEXT: fmax.s fa4, fa4, fa3
898 ; RV64ID-LP64-NEXT: fmin.s fa5, fa4, fa5
899 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
900 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
901 ; RV64ID-LP64-NEXT: addi sp, sp, 16
902 ; RV64ID-LP64-NEXT: ret
904 ; RV32ID-LABEL: fcvt_ui_h_sat:
905 ; RV32ID: # %bb.0: # %start
906 ; RV32ID-NEXT: addi sp, sp, -16
907 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
908 ; RV32ID-NEXT: call __extendhfsf2
909 ; RV32ID-NEXT: lui a0, %hi(.LCPI3_0)
910 ; RV32ID-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
911 ; RV32ID-NEXT: fmv.w.x fa4, zero
912 ; RV32ID-NEXT: fmax.s fa4, fa0, fa4
913 ; RV32ID-NEXT: fmin.s fa5, fa4, fa5
914 ; RV32ID-NEXT: fcvt.wu.s a0, fa5, rtz
915 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
916 ; RV32ID-NEXT: addi sp, sp, 16
919 ; RV64ID-LABEL: fcvt_ui_h_sat:
920 ; RV64ID: # %bb.0: # %start
921 ; RV64ID-NEXT: addi sp, sp, -16
922 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
923 ; RV64ID-NEXT: call __extendhfsf2
924 ; RV64ID-NEXT: lui a0, %hi(.LCPI3_0)
925 ; RV64ID-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
926 ; RV64ID-NEXT: fmv.w.x fa4, zero
927 ; RV64ID-NEXT: fmax.s fa4, fa0, fa4
928 ; RV64ID-NEXT: fmin.s fa5, fa4, fa5
929 ; RV64ID-NEXT: fcvt.lu.s a0, fa5, rtz
930 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
931 ; RV64ID-NEXT: addi sp, sp, 16
934 ; CHECK32-IZFHMIN-LABEL: fcvt_ui_h_sat:
935 ; CHECK32-IZFHMIN: # %bb.0: # %start
936 ; CHECK32-IZFHMIN-NEXT: lui a0, %hi(.LCPI3_0)
937 ; CHECK32-IZFHMIN-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
938 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa4, fa0
939 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa3, zero
940 ; CHECK32-IZFHMIN-NEXT: fmax.s fa4, fa4, fa3
941 ; CHECK32-IZFHMIN-NEXT: fmin.s fa5, fa4, fa5
942 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
943 ; CHECK32-IZFHMIN-NEXT: ret
945 ; CHECK64-IZFHMIN-LABEL: fcvt_ui_h_sat:
946 ; CHECK64-IZFHMIN: # %bb.0: # %start
947 ; CHECK64-IZFHMIN-NEXT: lui a0, %hi(.LCPI3_0)
948 ; CHECK64-IZFHMIN-NEXT: flw fa5, %lo(.LCPI3_0)(a0)
949 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa4, fa0
950 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa3, zero
951 ; CHECK64-IZFHMIN-NEXT: fmax.s fa4, fa4, fa3
952 ; CHECK64-IZFHMIN-NEXT: fmin.s fa5, fa4, fa5
953 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
954 ; CHECK64-IZFHMIN-NEXT: ret
956 ; CHECK32-IZHINXMIN-LABEL: fcvt_ui_h_sat:
957 ; CHECK32-IZHINXMIN: # %bb.0: # %start
958 ; CHECK32-IZHINXMIN-NEXT: lui a1, %hi(.LCPI3_0)
959 ; CHECK32-IZHINXMIN-NEXT: lw a1, %lo(.LCPI3_0)(a1)
960 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
961 ; CHECK32-IZHINXMIN-NEXT: fmax.s a0, a0, zero
962 ; CHECK32-IZHINXMIN-NEXT: fmin.s a0, a0, a1
963 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
964 ; CHECK32-IZHINXMIN-NEXT: ret
966 ; CHECK64-IZHINXMIN-LABEL: fcvt_ui_h_sat:
967 ; CHECK64-IZHINXMIN: # %bb.0: # %start
968 ; CHECK64-IZHINXMIN-NEXT: lui a1, %hi(.LCPI3_0)
969 ; CHECK64-IZHINXMIN-NEXT: lw a1, %lo(.LCPI3_0)(a1)
970 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
971 ; CHECK64-IZHINXMIN-NEXT: fmax.s a0, a0, zero
972 ; CHECK64-IZHINXMIN-NEXT: fmin.s a0, a0, a1
973 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
974 ; CHECK64-IZHINXMIN-NEXT: ret
976 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_ui_h_sat:
977 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
978 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a1, %hi(.LCPI3_0)
979 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a1, %lo(.LCPI3_0)(a1)
980 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
981 ; CHECK32-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, zero
982 ; CHECK32-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a1
983 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
984 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
986 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_ui_h_sat:
987 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
988 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a1, %hi(.LCPI3_0)
989 ; CHECK64-IZDINXZHINXMIN-NEXT: lw a1, %lo(.LCPI3_0)(a1)
990 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
991 ; CHECK64-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, zero
992 ; CHECK64-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a1
993 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
994 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
996 %0 = tail call i16 @llvm.fptoui.sat.i16.f16(half %a)
999 declare i16 @llvm.fptoui.sat.i16.f16(half)
1001 define i32 @fcvt_w_h(half %a) nounwind {
1002 ; CHECKIZFH-LABEL: fcvt_w_h:
1003 ; CHECKIZFH: # %bb.0:
1004 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz
1005 ; CHECKIZFH-NEXT: ret
1007 ; RV32IDZFH-LABEL: fcvt_w_h:
1008 ; RV32IDZFH: # %bb.0:
1009 ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
1010 ; RV32IDZFH-NEXT: ret
1012 ; RV64IDZFH-LABEL: fcvt_w_h:
1013 ; RV64IDZFH: # %bb.0:
1014 ; RV64IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
1015 ; RV64IDZFH-NEXT: ret
1017 ; CHECKIZHINX-LABEL: fcvt_w_h:
1018 ; CHECKIZHINX: # %bb.0:
1019 ; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz
1020 ; CHECKIZHINX-NEXT: ret
1022 ; CHECKIZDINXZHINX-LABEL: fcvt_w_h:
1023 ; CHECKIZDINXZHINX: # %bb.0:
1024 ; CHECKIZDINXZHINX-NEXT: fcvt.w.h a0, a0, rtz
1025 ; CHECKIZDINXZHINX-NEXT: ret
1027 ; RV32I-LABEL: fcvt_w_h:
1029 ; RV32I-NEXT: addi sp, sp, -16
1030 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1031 ; RV32I-NEXT: slli a0, a0, 16
1032 ; RV32I-NEXT: srli a0, a0, 16
1033 ; RV32I-NEXT: call __extendhfsf2
1034 ; RV32I-NEXT: call __fixsfsi
1035 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1036 ; RV32I-NEXT: addi sp, sp, 16
1039 ; RV64I-LABEL: fcvt_w_h:
1041 ; RV64I-NEXT: addi sp, sp, -16
1042 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1043 ; RV64I-NEXT: slli a0, a0, 48
1044 ; RV64I-NEXT: srli a0, a0, 48
1045 ; RV64I-NEXT: call __extendhfsf2
1046 ; RV64I-NEXT: call __fixsfdi
1047 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1048 ; RV64I-NEXT: addi sp, sp, 16
1051 ; RV32ID-ILP32-LABEL: fcvt_w_h:
1052 ; RV32ID-ILP32: # %bb.0:
1053 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
1054 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1055 ; RV32ID-ILP32-NEXT: call __extendhfsf2
1056 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
1057 ; RV32ID-ILP32-NEXT: fcvt.w.s a0, fa5, rtz
1058 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1059 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
1060 ; RV32ID-ILP32-NEXT: ret
1062 ; RV64ID-LP64-LABEL: fcvt_w_h:
1063 ; RV64ID-LP64: # %bb.0:
1064 ; RV64ID-LP64-NEXT: addi sp, sp, -16
1065 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1066 ; RV64ID-LP64-NEXT: call __extendhfsf2
1067 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
1068 ; RV64ID-LP64-NEXT: fcvt.l.s a0, fa5, rtz
1069 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1070 ; RV64ID-LP64-NEXT: addi sp, sp, 16
1071 ; RV64ID-LP64-NEXT: ret
1073 ; RV32ID-LABEL: fcvt_w_h:
1075 ; RV32ID-NEXT: addi sp, sp, -16
1076 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1077 ; RV32ID-NEXT: call __extendhfsf2
1078 ; RV32ID-NEXT: fcvt.w.s a0, fa0, rtz
1079 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1080 ; RV32ID-NEXT: addi sp, sp, 16
1083 ; RV64ID-LABEL: fcvt_w_h:
1085 ; RV64ID-NEXT: addi sp, sp, -16
1086 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1087 ; RV64ID-NEXT: call __extendhfsf2
1088 ; RV64ID-NEXT: fcvt.l.s a0, fa0, rtz
1089 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1090 ; RV64ID-NEXT: addi sp, sp, 16
1093 ; CHECK32-IZFHMIN-LABEL: fcvt_w_h:
1094 ; CHECK32-IZFHMIN: # %bb.0:
1095 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1096 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
1097 ; CHECK32-IZFHMIN-NEXT: ret
1099 ; CHECK64-IZFHMIN-LABEL: fcvt_w_h:
1100 ; CHECK64-IZFHMIN: # %bb.0:
1101 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1102 ; CHECK64-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
1103 ; CHECK64-IZFHMIN-NEXT: ret
1105 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_h:
1106 ; CHECK32-IZHINXMIN: # %bb.0:
1107 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1108 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
1109 ; CHECK32-IZHINXMIN-NEXT: ret
1111 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_h:
1112 ; CHECK64-IZHINXMIN: # %bb.0:
1113 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1114 ; CHECK64-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
1115 ; CHECK64-IZHINXMIN-NEXT: ret
1117 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_h:
1118 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
1119 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1120 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
1121 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
1123 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_h:
1124 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
1125 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1126 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
1127 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
1128 %1 = fptosi half %a to i32
1132 define i32 @fcvt_w_h_sat(half %a) nounwind {
1133 ; CHECKIZFH-LABEL: fcvt_w_h_sat:
1134 ; CHECKIZFH: # %bb.0: # %start
1135 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz
1136 ; CHECKIZFH-NEXT: feq.h a1, fa0, fa0
1137 ; CHECKIZFH-NEXT: seqz a1, a1
1138 ; CHECKIZFH-NEXT: addi a1, a1, -1
1139 ; CHECKIZFH-NEXT: and a0, a1, a0
1140 ; CHECKIZFH-NEXT: ret
1142 ; RV32IDZFH-LABEL: fcvt_w_h_sat:
1143 ; RV32IDZFH: # %bb.0: # %start
1144 ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
1145 ; RV32IDZFH-NEXT: feq.h a1, fa0, fa0
1146 ; RV32IDZFH-NEXT: seqz a1, a1
1147 ; RV32IDZFH-NEXT: addi a1, a1, -1
1148 ; RV32IDZFH-NEXT: and a0, a1, a0
1149 ; RV32IDZFH-NEXT: ret
1151 ; RV64IDZFH-LABEL: fcvt_w_h_sat:
1152 ; RV64IDZFH: # %bb.0: # %start
1153 ; RV64IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
1154 ; RV64IDZFH-NEXT: feq.h a1, fa0, fa0
1155 ; RV64IDZFH-NEXT: seqz a1, a1
1156 ; RV64IDZFH-NEXT: addi a1, a1, -1
1157 ; RV64IDZFH-NEXT: and a0, a1, a0
1158 ; RV64IDZFH-NEXT: ret
1160 ; CHECKIZHINX-LABEL: fcvt_w_h_sat:
1161 ; CHECKIZHINX: # %bb.0: # %start
1162 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rtz
1163 ; CHECKIZHINX-NEXT: feq.h a0, a0, a0
1164 ; CHECKIZHINX-NEXT: seqz a0, a0
1165 ; CHECKIZHINX-NEXT: addi a0, a0, -1
1166 ; CHECKIZHINX-NEXT: and a0, a0, a1
1167 ; CHECKIZHINX-NEXT: ret
1169 ; CHECKIZDINXZHINX-LABEL: fcvt_w_h_sat:
1170 ; CHECKIZDINXZHINX: # %bb.0: # %start
1171 ; CHECKIZDINXZHINX-NEXT: fcvt.w.h a1, a0, rtz
1172 ; CHECKIZDINXZHINX-NEXT: feq.h a0, a0, a0
1173 ; CHECKIZDINXZHINX-NEXT: seqz a0, a0
1174 ; CHECKIZDINXZHINX-NEXT: addi a0, a0, -1
1175 ; CHECKIZDINXZHINX-NEXT: and a0, a0, a1
1176 ; CHECKIZDINXZHINX-NEXT: ret
1178 ; RV32I-LABEL: fcvt_w_h_sat:
1179 ; RV32I: # %bb.0: # %start
1180 ; RV32I-NEXT: addi sp, sp, -32
1181 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
1182 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
1183 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
1184 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
1185 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
1186 ; RV32I-NEXT: slli a0, a0, 16
1187 ; RV32I-NEXT: srli a0, a0, 16
1188 ; RV32I-NEXT: call __extendhfsf2
1189 ; RV32I-NEXT: mv s0, a0
1190 ; RV32I-NEXT: lui a1, 847872
1191 ; RV32I-NEXT: call __gesf2
1192 ; RV32I-NEXT: mv s2, a0
1193 ; RV32I-NEXT: mv a0, s0
1194 ; RV32I-NEXT: call __fixsfsi
1195 ; RV32I-NEXT: mv s1, a0
1196 ; RV32I-NEXT: lui s3, 524288
1197 ; RV32I-NEXT: bgez s2, .LBB5_2
1198 ; RV32I-NEXT: # %bb.1: # %start
1199 ; RV32I-NEXT: lui s1, 524288
1200 ; RV32I-NEXT: .LBB5_2: # %start
1201 ; RV32I-NEXT: lui a1, 323584
1202 ; RV32I-NEXT: addi a1, a1, -1
1203 ; RV32I-NEXT: mv a0, s0
1204 ; RV32I-NEXT: call __gtsf2
1205 ; RV32I-NEXT: blez a0, .LBB5_4
1206 ; RV32I-NEXT: # %bb.3: # %start
1207 ; RV32I-NEXT: addi s1, s3, -1
1208 ; RV32I-NEXT: .LBB5_4: # %start
1209 ; RV32I-NEXT: mv a0, s0
1210 ; RV32I-NEXT: mv a1, s0
1211 ; RV32I-NEXT: call __unordsf2
1212 ; RV32I-NEXT: snez a0, a0
1213 ; RV32I-NEXT: addi a0, a0, -1
1214 ; RV32I-NEXT: and a0, a0, s1
1215 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
1216 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
1217 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
1218 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
1219 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
1220 ; RV32I-NEXT: addi sp, sp, 32
1223 ; RV64I-LABEL: fcvt_w_h_sat:
1224 ; RV64I: # %bb.0: # %start
1225 ; RV64I-NEXT: addi sp, sp, -48
1226 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
1227 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
1228 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
1229 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
1230 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
1231 ; RV64I-NEXT: slli a0, a0, 48
1232 ; RV64I-NEXT: srli a0, a0, 48
1233 ; RV64I-NEXT: call __extendhfsf2
1234 ; RV64I-NEXT: mv s0, a0
1235 ; RV64I-NEXT: lui a1, 847872
1236 ; RV64I-NEXT: call __gesf2
1237 ; RV64I-NEXT: mv s2, a0
1238 ; RV64I-NEXT: mv a0, s0
1239 ; RV64I-NEXT: call __fixsfdi
1240 ; RV64I-NEXT: mv s1, a0
1241 ; RV64I-NEXT: lui s3, 524288
1242 ; RV64I-NEXT: bgez s2, .LBB5_2
1243 ; RV64I-NEXT: # %bb.1: # %start
1244 ; RV64I-NEXT: lui s1, 524288
1245 ; RV64I-NEXT: .LBB5_2: # %start
1246 ; RV64I-NEXT: lui a1, 323584
1247 ; RV64I-NEXT: addiw a1, a1, -1
1248 ; RV64I-NEXT: mv a0, s0
1249 ; RV64I-NEXT: call __gtsf2
1250 ; RV64I-NEXT: blez a0, .LBB5_4
1251 ; RV64I-NEXT: # %bb.3: # %start
1252 ; RV64I-NEXT: addiw s1, s3, -1
1253 ; RV64I-NEXT: .LBB5_4: # %start
1254 ; RV64I-NEXT: mv a0, s0
1255 ; RV64I-NEXT: mv a1, s0
1256 ; RV64I-NEXT: call __unordsf2
1257 ; RV64I-NEXT: snez a0, a0
1258 ; RV64I-NEXT: addi a0, a0, -1
1259 ; RV64I-NEXT: and a0, a0, s1
1260 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
1261 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
1262 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
1263 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
1264 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
1265 ; RV64I-NEXT: addi sp, sp, 48
1268 ; RV32ID-ILP32-LABEL: fcvt_w_h_sat:
1269 ; RV32ID-ILP32: # %bb.0: # %start
1270 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
1271 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1272 ; RV32ID-ILP32-NEXT: call __extendhfsf2
1273 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
1274 ; RV32ID-ILP32-NEXT: fcvt.w.s a0, fa5, rtz
1275 ; RV32ID-ILP32-NEXT: feq.s a1, fa5, fa5
1276 ; RV32ID-ILP32-NEXT: seqz a1, a1
1277 ; RV32ID-ILP32-NEXT: addi a1, a1, -1
1278 ; RV32ID-ILP32-NEXT: and a0, a1, a0
1279 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1280 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
1281 ; RV32ID-ILP32-NEXT: ret
1283 ; RV64ID-LP64-LABEL: fcvt_w_h_sat:
1284 ; RV64ID-LP64: # %bb.0: # %start
1285 ; RV64ID-LP64-NEXT: addi sp, sp, -16
1286 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1287 ; RV64ID-LP64-NEXT: call __extendhfsf2
1288 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
1289 ; RV64ID-LP64-NEXT: fcvt.w.s a0, fa5, rtz
1290 ; RV64ID-LP64-NEXT: feq.s a1, fa5, fa5
1291 ; RV64ID-LP64-NEXT: seqz a1, a1
1292 ; RV64ID-LP64-NEXT: addi a1, a1, -1
1293 ; RV64ID-LP64-NEXT: and a0, a1, a0
1294 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1295 ; RV64ID-LP64-NEXT: addi sp, sp, 16
1296 ; RV64ID-LP64-NEXT: ret
1298 ; RV32ID-LABEL: fcvt_w_h_sat:
1299 ; RV32ID: # %bb.0: # %start
1300 ; RV32ID-NEXT: addi sp, sp, -16
1301 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1302 ; RV32ID-NEXT: call __extendhfsf2
1303 ; RV32ID-NEXT: fcvt.w.s a0, fa0, rtz
1304 ; RV32ID-NEXT: feq.s a1, fa0, fa0
1305 ; RV32ID-NEXT: seqz a1, a1
1306 ; RV32ID-NEXT: addi a1, a1, -1
1307 ; RV32ID-NEXT: and a0, a1, a0
1308 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1309 ; RV32ID-NEXT: addi sp, sp, 16
1312 ; RV64ID-LABEL: fcvt_w_h_sat:
1313 ; RV64ID: # %bb.0: # %start
1314 ; RV64ID-NEXT: addi sp, sp, -16
1315 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1316 ; RV64ID-NEXT: call __extendhfsf2
1317 ; RV64ID-NEXT: fcvt.w.s a0, fa0, rtz
1318 ; RV64ID-NEXT: feq.s a1, fa0, fa0
1319 ; RV64ID-NEXT: seqz a1, a1
1320 ; RV64ID-NEXT: addi a1, a1, -1
1321 ; RV64ID-NEXT: and a0, a1, a0
1322 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1323 ; RV64ID-NEXT: addi sp, sp, 16
1326 ; CHECK32-IZFHMIN-LABEL: fcvt_w_h_sat:
1327 ; CHECK32-IZFHMIN: # %bb.0: # %start
1328 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1329 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
1330 ; CHECK32-IZFHMIN-NEXT: feq.s a1, fa5, fa5
1331 ; CHECK32-IZFHMIN-NEXT: seqz a1, a1
1332 ; CHECK32-IZFHMIN-NEXT: addi a1, a1, -1
1333 ; CHECK32-IZFHMIN-NEXT: and a0, a1, a0
1334 ; CHECK32-IZFHMIN-NEXT: ret
1336 ; CHECK64-IZFHMIN-LABEL: fcvt_w_h_sat:
1337 ; CHECK64-IZFHMIN: # %bb.0: # %start
1338 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1339 ; CHECK64-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
1340 ; CHECK64-IZFHMIN-NEXT: feq.s a1, fa5, fa5
1341 ; CHECK64-IZFHMIN-NEXT: seqz a1, a1
1342 ; CHECK64-IZFHMIN-NEXT: addi a1, a1, -1
1343 ; CHECK64-IZFHMIN-NEXT: and a0, a1, a0
1344 ; CHECK64-IZFHMIN-NEXT: ret
1346 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_h_sat:
1347 ; CHECK32-IZHINXMIN: # %bb.0: # %start
1348 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1349 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
1350 ; CHECK32-IZHINXMIN-NEXT: feq.s a0, a0, a0
1351 ; CHECK32-IZHINXMIN-NEXT: seqz a0, a0
1352 ; CHECK32-IZHINXMIN-NEXT: addi a0, a0, -1
1353 ; CHECK32-IZHINXMIN-NEXT: and a0, a0, a1
1354 ; CHECK32-IZHINXMIN-NEXT: ret
1356 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_h_sat:
1357 ; CHECK64-IZHINXMIN: # %bb.0: # %start
1358 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1359 ; CHECK64-IZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
1360 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
1361 ; CHECK64-IZHINXMIN-NEXT: seqz a0, a0
1362 ; CHECK64-IZHINXMIN-NEXT: addi a0, a0, -1
1363 ; CHECK64-IZHINXMIN-NEXT: and a0, a0, a1
1364 ; CHECK64-IZHINXMIN-NEXT: ret
1366 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_h_sat:
1367 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
1368 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1369 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
1370 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
1371 ; CHECK32-IZDINXZHINXMIN-NEXT: seqz a0, a0
1372 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
1373 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a0, a1
1374 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
1376 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_h_sat:
1377 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
1378 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1379 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
1380 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
1381 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a0, a0
1382 ; CHECK64-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
1383 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a0, a1
1384 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
1386 %0 = tail call i32 @llvm.fptosi.sat.i32.f16(half %a)
1389 declare i32 @llvm.fptosi.sat.i32.f16(half)
1391 define i32 @fcvt_wu_h(half %a) nounwind {
1392 ; CHECKIZFH-LABEL: fcvt_wu_h:
1393 ; CHECKIZFH: # %bb.0:
1394 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1395 ; CHECKIZFH-NEXT: ret
1397 ; RV32IDZFH-LABEL: fcvt_wu_h:
1398 ; RV32IDZFH: # %bb.0:
1399 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1400 ; RV32IDZFH-NEXT: ret
1402 ; RV64IDZFH-LABEL: fcvt_wu_h:
1403 ; RV64IDZFH: # %bb.0:
1404 ; RV64IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1405 ; RV64IDZFH-NEXT: ret
1407 ; CHECKIZHINX-LABEL: fcvt_wu_h:
1408 ; CHECKIZHINX: # %bb.0:
1409 ; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rtz
1410 ; CHECKIZHINX-NEXT: ret
1412 ; CHECKIZDINXZHINX-LABEL: fcvt_wu_h:
1413 ; CHECKIZDINXZHINX: # %bb.0:
1414 ; CHECKIZDINXZHINX-NEXT: fcvt.wu.h a0, a0, rtz
1415 ; CHECKIZDINXZHINX-NEXT: ret
1417 ; RV32I-LABEL: fcvt_wu_h:
1419 ; RV32I-NEXT: addi sp, sp, -16
1420 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1421 ; RV32I-NEXT: slli a0, a0, 16
1422 ; RV32I-NEXT: srli a0, a0, 16
1423 ; RV32I-NEXT: call __extendhfsf2
1424 ; RV32I-NEXT: call __fixunssfsi
1425 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1426 ; RV32I-NEXT: addi sp, sp, 16
1429 ; RV64I-LABEL: fcvt_wu_h:
1431 ; RV64I-NEXT: addi sp, sp, -16
1432 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1433 ; RV64I-NEXT: slli a0, a0, 48
1434 ; RV64I-NEXT: srli a0, a0, 48
1435 ; RV64I-NEXT: call __extendhfsf2
1436 ; RV64I-NEXT: call __fixunssfdi
1437 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1438 ; RV64I-NEXT: addi sp, sp, 16
1441 ; RV32ID-ILP32-LABEL: fcvt_wu_h:
1442 ; RV32ID-ILP32: # %bb.0:
1443 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
1444 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1445 ; RV32ID-ILP32-NEXT: call __extendhfsf2
1446 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
1447 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
1448 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1449 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
1450 ; RV32ID-ILP32-NEXT: ret
1452 ; RV64ID-LP64-LABEL: fcvt_wu_h:
1453 ; RV64ID-LP64: # %bb.0:
1454 ; RV64ID-LP64-NEXT: addi sp, sp, -16
1455 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1456 ; RV64ID-LP64-NEXT: call __extendhfsf2
1457 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
1458 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
1459 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1460 ; RV64ID-LP64-NEXT: addi sp, sp, 16
1461 ; RV64ID-LP64-NEXT: ret
1463 ; RV32ID-LABEL: fcvt_wu_h:
1465 ; RV32ID-NEXT: addi sp, sp, -16
1466 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1467 ; RV32ID-NEXT: call __extendhfsf2
1468 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
1469 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1470 ; RV32ID-NEXT: addi sp, sp, 16
1473 ; RV64ID-LABEL: fcvt_wu_h:
1475 ; RV64ID-NEXT: addi sp, sp, -16
1476 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1477 ; RV64ID-NEXT: call __extendhfsf2
1478 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
1479 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1480 ; RV64ID-NEXT: addi sp, sp, 16
1483 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_h:
1484 ; CHECK32-IZFHMIN: # %bb.0:
1485 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1486 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
1487 ; CHECK32-IZFHMIN-NEXT: ret
1489 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_h:
1490 ; CHECK64-IZFHMIN: # %bb.0:
1491 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1492 ; CHECK64-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
1493 ; CHECK64-IZFHMIN-NEXT: ret
1495 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_h:
1496 ; CHECK32-IZHINXMIN: # %bb.0:
1497 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1498 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1499 ; CHECK32-IZHINXMIN-NEXT: ret
1501 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_h:
1502 ; CHECK64-IZHINXMIN: # %bb.0:
1503 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1504 ; CHECK64-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1505 ; CHECK64-IZHINXMIN-NEXT: ret
1507 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_h:
1508 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
1509 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1510 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1511 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
1513 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_h:
1514 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
1515 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1516 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1517 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
1518 %1 = fptoui half %a to i32
1522 ; Test where the fptoui has multiple uses, one of which causes a sext to be
1524 define i32 @fcvt_wu_h_multiple_use(half %x, ptr %y) nounwind {
1525 ; CHECKIZFH-LABEL: fcvt_wu_h_multiple_use:
1526 ; CHECKIZFH: # %bb.0:
1527 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1528 ; CHECKIZFH-NEXT: seqz a1, a0
1529 ; CHECKIZFH-NEXT: add a0, a0, a1
1530 ; CHECKIZFH-NEXT: ret
1532 ; RV32IDZFH-LABEL: fcvt_wu_h_multiple_use:
1533 ; RV32IDZFH: # %bb.0:
1534 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1535 ; RV32IDZFH-NEXT: seqz a1, a0
1536 ; RV32IDZFH-NEXT: add a0, a0, a1
1537 ; RV32IDZFH-NEXT: ret
1539 ; RV64IDZFH-LABEL: fcvt_wu_h_multiple_use:
1540 ; RV64IDZFH: # %bb.0:
1541 ; RV64IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1542 ; RV64IDZFH-NEXT: seqz a1, a0
1543 ; RV64IDZFH-NEXT: add a0, a0, a1
1544 ; RV64IDZFH-NEXT: ret
1546 ; CHECKIZHINX-LABEL: fcvt_wu_h_multiple_use:
1547 ; CHECKIZHINX: # %bb.0:
1548 ; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rtz
1549 ; CHECKIZHINX-NEXT: seqz a1, a0
1550 ; CHECKIZHINX-NEXT: add a0, a0, a1
1551 ; CHECKIZHINX-NEXT: ret
1553 ; CHECKIZDINXZHINX-LABEL: fcvt_wu_h_multiple_use:
1554 ; CHECKIZDINXZHINX: # %bb.0:
1555 ; CHECKIZDINXZHINX-NEXT: fcvt.wu.h a0, a0, rtz
1556 ; CHECKIZDINXZHINX-NEXT: seqz a1, a0
1557 ; CHECKIZDINXZHINX-NEXT: add a0, a0, a1
1558 ; CHECKIZDINXZHINX-NEXT: ret
1560 ; RV32I-LABEL: fcvt_wu_h_multiple_use:
1562 ; RV32I-NEXT: addi sp, sp, -16
1563 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1564 ; RV32I-NEXT: slli a0, a0, 16
1565 ; RV32I-NEXT: srli a0, a0, 16
1566 ; RV32I-NEXT: call __extendhfsf2
1567 ; RV32I-NEXT: call __fixunssfsi
1568 ; RV32I-NEXT: seqz a1, a0
1569 ; RV32I-NEXT: add a0, a0, a1
1570 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1571 ; RV32I-NEXT: addi sp, sp, 16
1574 ; RV64I-LABEL: fcvt_wu_h_multiple_use:
1576 ; RV64I-NEXT: addi sp, sp, -16
1577 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1578 ; RV64I-NEXT: slli a0, a0, 48
1579 ; RV64I-NEXT: srli a0, a0, 48
1580 ; RV64I-NEXT: call __extendhfsf2
1581 ; RV64I-NEXT: call __fixunssfdi
1582 ; RV64I-NEXT: seqz a1, a0
1583 ; RV64I-NEXT: add a0, a0, a1
1584 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1585 ; RV64I-NEXT: addi sp, sp, 16
1588 ; RV32ID-ILP32-LABEL: fcvt_wu_h_multiple_use:
1589 ; RV32ID-ILP32: # %bb.0:
1590 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
1591 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1592 ; RV32ID-ILP32-NEXT: call __extendhfsf2
1593 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
1594 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
1595 ; RV32ID-ILP32-NEXT: seqz a1, a0
1596 ; RV32ID-ILP32-NEXT: add a0, a0, a1
1597 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1598 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
1599 ; RV32ID-ILP32-NEXT: ret
1601 ; RV64ID-LP64-LABEL: fcvt_wu_h_multiple_use:
1602 ; RV64ID-LP64: # %bb.0:
1603 ; RV64ID-LP64-NEXT: addi sp, sp, -16
1604 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1605 ; RV64ID-LP64-NEXT: call __extendhfsf2
1606 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
1607 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
1608 ; RV64ID-LP64-NEXT: seqz a1, a0
1609 ; RV64ID-LP64-NEXT: add a0, a0, a1
1610 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1611 ; RV64ID-LP64-NEXT: addi sp, sp, 16
1612 ; RV64ID-LP64-NEXT: ret
1614 ; RV32ID-LABEL: fcvt_wu_h_multiple_use:
1616 ; RV32ID-NEXT: addi sp, sp, -16
1617 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1618 ; RV32ID-NEXT: call __extendhfsf2
1619 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
1620 ; RV32ID-NEXT: seqz a1, a0
1621 ; RV32ID-NEXT: add a0, a0, a1
1622 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1623 ; RV32ID-NEXT: addi sp, sp, 16
1626 ; RV64ID-LABEL: fcvt_wu_h_multiple_use:
1628 ; RV64ID-NEXT: addi sp, sp, -16
1629 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1630 ; RV64ID-NEXT: call __extendhfsf2
1631 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
1632 ; RV64ID-NEXT: seqz a1, a0
1633 ; RV64ID-NEXT: add a0, a0, a1
1634 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1635 ; RV64ID-NEXT: addi sp, sp, 16
1638 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_h_multiple_use:
1639 ; CHECK32-IZFHMIN: # %bb.0:
1640 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1641 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
1642 ; CHECK32-IZFHMIN-NEXT: seqz a1, a0
1643 ; CHECK32-IZFHMIN-NEXT: add a0, a0, a1
1644 ; CHECK32-IZFHMIN-NEXT: ret
1646 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_h_multiple_use:
1647 ; CHECK64-IZFHMIN: # %bb.0:
1648 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1649 ; CHECK64-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
1650 ; CHECK64-IZFHMIN-NEXT: seqz a1, a0
1651 ; CHECK64-IZFHMIN-NEXT: add a0, a0, a1
1652 ; CHECK64-IZFHMIN-NEXT: ret
1654 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_h_multiple_use:
1655 ; CHECK32-IZHINXMIN: # %bb.0:
1656 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1657 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1658 ; CHECK32-IZHINXMIN-NEXT: seqz a1, a0
1659 ; CHECK32-IZHINXMIN-NEXT: add a0, a0, a1
1660 ; CHECK32-IZHINXMIN-NEXT: ret
1662 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_h_multiple_use:
1663 ; CHECK64-IZHINXMIN: # %bb.0:
1664 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1665 ; CHECK64-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1666 ; CHECK64-IZHINXMIN-NEXT: seqz a1, a0
1667 ; CHECK64-IZHINXMIN-NEXT: add a0, a0, a1
1668 ; CHECK64-IZHINXMIN-NEXT: ret
1670 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_h_multiple_use:
1671 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
1672 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1673 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1674 ; CHECK32-IZDINXZHINXMIN-NEXT: seqz a1, a0
1675 ; CHECK32-IZDINXZHINXMIN-NEXT: add a0, a0, a1
1676 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
1678 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_h_multiple_use:
1679 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
1680 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1681 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
1682 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a1, a0
1683 ; CHECK64-IZDINXZHINXMIN-NEXT: add a0, a0, a1
1684 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
1685 %a = fptoui half %x to i32
1686 %b = icmp eq i32 %a, 0
1687 %c = select i1 %b, i32 1, i32 %a
1691 define i32 @fcvt_wu_h_sat(half %a) nounwind {
1692 ; RV32IZFH-LABEL: fcvt_wu_h_sat:
1693 ; RV32IZFH: # %bb.0: # %start
1694 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1695 ; RV32IZFH-NEXT: feq.h a1, fa0, fa0
1696 ; RV32IZFH-NEXT: seqz a1, a1
1697 ; RV32IZFH-NEXT: addi a1, a1, -1
1698 ; RV32IZFH-NEXT: and a0, a1, a0
1699 ; RV32IZFH-NEXT: ret
1701 ; RV64IZFH-LABEL: fcvt_wu_h_sat:
1702 ; RV64IZFH: # %bb.0: # %start
1703 ; RV64IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1704 ; RV64IZFH-NEXT: feq.h a1, fa0, fa0
1705 ; RV64IZFH-NEXT: seqz a1, a1
1706 ; RV64IZFH-NEXT: addi a1, a1, -1
1707 ; RV64IZFH-NEXT: and a0, a0, a1
1708 ; RV64IZFH-NEXT: slli a0, a0, 32
1709 ; RV64IZFH-NEXT: srli a0, a0, 32
1710 ; RV64IZFH-NEXT: ret
1712 ; RV32IDZFH-LABEL: fcvt_wu_h_sat:
1713 ; RV32IDZFH: # %bb.0: # %start
1714 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1715 ; RV32IDZFH-NEXT: feq.h a1, fa0, fa0
1716 ; RV32IDZFH-NEXT: seqz a1, a1
1717 ; RV32IDZFH-NEXT: addi a1, a1, -1
1718 ; RV32IDZFH-NEXT: and a0, a1, a0
1719 ; RV32IDZFH-NEXT: ret
1721 ; RV64IDZFH-LABEL: fcvt_wu_h_sat:
1722 ; RV64IDZFH: # %bb.0: # %start
1723 ; RV64IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
1724 ; RV64IDZFH-NEXT: feq.h a1, fa0, fa0
1725 ; RV64IDZFH-NEXT: seqz a1, a1
1726 ; RV64IDZFH-NEXT: addi a1, a1, -1
1727 ; RV64IDZFH-NEXT: and a0, a0, a1
1728 ; RV64IDZFH-NEXT: slli a0, a0, 32
1729 ; RV64IDZFH-NEXT: srli a0, a0, 32
1730 ; RV64IDZFH-NEXT: ret
1732 ; RV32IZHINX-LABEL: fcvt_wu_h_sat:
1733 ; RV32IZHINX: # %bb.0: # %start
1734 ; RV32IZHINX-NEXT: fcvt.wu.h a1, a0, rtz
1735 ; RV32IZHINX-NEXT: feq.h a0, a0, a0
1736 ; RV32IZHINX-NEXT: seqz a0, a0
1737 ; RV32IZHINX-NEXT: addi a0, a0, -1
1738 ; RV32IZHINX-NEXT: and a0, a0, a1
1739 ; RV32IZHINX-NEXT: ret
1741 ; RV64IZHINX-LABEL: fcvt_wu_h_sat:
1742 ; RV64IZHINX: # %bb.0: # %start
1743 ; RV64IZHINX-NEXT: fcvt.wu.h a1, a0, rtz
1744 ; RV64IZHINX-NEXT: feq.h a0, a0, a0
1745 ; RV64IZHINX-NEXT: seqz a0, a0
1746 ; RV64IZHINX-NEXT: addi a0, a0, -1
1747 ; RV64IZHINX-NEXT: and a0, a1, a0
1748 ; RV64IZHINX-NEXT: slli a0, a0, 32
1749 ; RV64IZHINX-NEXT: srli a0, a0, 32
1750 ; RV64IZHINX-NEXT: ret
1752 ; RV32IZDINXZHINX-LABEL: fcvt_wu_h_sat:
1753 ; RV32IZDINXZHINX: # %bb.0: # %start
1754 ; RV32IZDINXZHINX-NEXT: fcvt.wu.h a1, a0, rtz
1755 ; RV32IZDINXZHINX-NEXT: feq.h a0, a0, a0
1756 ; RV32IZDINXZHINX-NEXT: seqz a0, a0
1757 ; RV32IZDINXZHINX-NEXT: addi a0, a0, -1
1758 ; RV32IZDINXZHINX-NEXT: and a0, a0, a1
1759 ; RV32IZDINXZHINX-NEXT: ret
1761 ; RV64IZDINXZHINX-LABEL: fcvt_wu_h_sat:
1762 ; RV64IZDINXZHINX: # %bb.0: # %start
1763 ; RV64IZDINXZHINX-NEXT: fcvt.wu.h a1, a0, rtz
1764 ; RV64IZDINXZHINX-NEXT: feq.h a0, a0, a0
1765 ; RV64IZDINXZHINX-NEXT: seqz a0, a0
1766 ; RV64IZDINXZHINX-NEXT: addi a0, a0, -1
1767 ; RV64IZDINXZHINX-NEXT: and a0, a1, a0
1768 ; RV64IZDINXZHINX-NEXT: slli a0, a0, 32
1769 ; RV64IZDINXZHINX-NEXT: srli a0, a0, 32
1770 ; RV64IZDINXZHINX-NEXT: ret
1772 ; RV32I-LABEL: fcvt_wu_h_sat:
1773 ; RV32I: # %bb.0: # %start
1774 ; RV32I-NEXT: addi sp, sp, -16
1775 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1776 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1777 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
1778 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
1779 ; RV32I-NEXT: slli a0, a0, 16
1780 ; RV32I-NEXT: srli a0, a0, 16
1781 ; RV32I-NEXT: call __extendhfsf2
1782 ; RV32I-NEXT: mv s0, a0
1783 ; RV32I-NEXT: lui a1, 325632
1784 ; RV32I-NEXT: addi a1, a1, -1
1785 ; RV32I-NEXT: call __gtsf2
1786 ; RV32I-NEXT: sgtz a0, a0
1787 ; RV32I-NEXT: neg s1, a0
1788 ; RV32I-NEXT: mv a0, s0
1789 ; RV32I-NEXT: li a1, 0
1790 ; RV32I-NEXT: call __gesf2
1791 ; RV32I-NEXT: slti a0, a0, 0
1792 ; RV32I-NEXT: addi s2, a0, -1
1793 ; RV32I-NEXT: mv a0, s0
1794 ; RV32I-NEXT: call __fixunssfsi
1795 ; RV32I-NEXT: and a0, s2, a0
1796 ; RV32I-NEXT: or a0, s1, a0
1797 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1798 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1799 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
1800 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
1801 ; RV32I-NEXT: addi sp, sp, 16
1804 ; RV64I-LABEL: fcvt_wu_h_sat:
1805 ; RV64I: # %bb.0: # %start
1806 ; RV64I-NEXT: addi sp, sp, -32
1807 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
1808 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
1809 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
1810 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
1811 ; RV64I-NEXT: slli a0, a0, 48
1812 ; RV64I-NEXT: srli a0, a0, 48
1813 ; RV64I-NEXT: call __extendhfsf2
1814 ; RV64I-NEXT: mv s2, a0
1815 ; RV64I-NEXT: li a1, 0
1816 ; RV64I-NEXT: call __gesf2
1817 ; RV64I-NEXT: mv s0, a0
1818 ; RV64I-NEXT: mv a0, s2
1819 ; RV64I-NEXT: call __fixunssfdi
1820 ; RV64I-NEXT: mv s1, a0
1821 ; RV64I-NEXT: lui a1, 325632
1822 ; RV64I-NEXT: addiw a1, a1, -1
1823 ; RV64I-NEXT: mv a0, s2
1824 ; RV64I-NEXT: call __gtsf2
1825 ; RV64I-NEXT: blez a0, .LBB8_2
1826 ; RV64I-NEXT: # %bb.1: # %start
1827 ; RV64I-NEXT: li a0, -1
1828 ; RV64I-NEXT: srli a0, a0, 32
1829 ; RV64I-NEXT: j .LBB8_3
1830 ; RV64I-NEXT: .LBB8_2:
1831 ; RV64I-NEXT: slti a0, s0, 0
1832 ; RV64I-NEXT: addi a0, a0, -1
1833 ; RV64I-NEXT: and a0, a0, s1
1834 ; RV64I-NEXT: .LBB8_3: # %start
1835 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
1836 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
1837 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
1838 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
1839 ; RV64I-NEXT: addi sp, sp, 32
1842 ; RV32ID-ILP32-LABEL: fcvt_wu_h_sat:
1843 ; RV32ID-ILP32: # %bb.0: # %start
1844 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
1845 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1846 ; RV32ID-ILP32-NEXT: call __extendhfsf2
1847 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
1848 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
1849 ; RV32ID-ILP32-NEXT: feq.s a1, fa5, fa5
1850 ; RV32ID-ILP32-NEXT: seqz a1, a1
1851 ; RV32ID-ILP32-NEXT: addi a1, a1, -1
1852 ; RV32ID-ILP32-NEXT: and a0, a1, a0
1853 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1854 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
1855 ; RV32ID-ILP32-NEXT: ret
1857 ; RV64ID-LP64-LABEL: fcvt_wu_h_sat:
1858 ; RV64ID-LP64: # %bb.0: # %start
1859 ; RV64ID-LP64-NEXT: addi sp, sp, -16
1860 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1861 ; RV64ID-LP64-NEXT: call __extendhfsf2
1862 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
1863 ; RV64ID-LP64-NEXT: fcvt.wu.s a0, fa5, rtz
1864 ; RV64ID-LP64-NEXT: feq.s a1, fa5, fa5
1865 ; RV64ID-LP64-NEXT: seqz a1, a1
1866 ; RV64ID-LP64-NEXT: addi a1, a1, -1
1867 ; RV64ID-LP64-NEXT: and a0, a0, a1
1868 ; RV64ID-LP64-NEXT: slli a0, a0, 32
1869 ; RV64ID-LP64-NEXT: srli a0, a0, 32
1870 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1871 ; RV64ID-LP64-NEXT: addi sp, sp, 16
1872 ; RV64ID-LP64-NEXT: ret
1874 ; RV32ID-LABEL: fcvt_wu_h_sat:
1875 ; RV32ID: # %bb.0: # %start
1876 ; RV32ID-NEXT: addi sp, sp, -16
1877 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1878 ; RV32ID-NEXT: call __extendhfsf2
1879 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
1880 ; RV32ID-NEXT: feq.s a1, fa0, fa0
1881 ; RV32ID-NEXT: seqz a1, a1
1882 ; RV32ID-NEXT: addi a1, a1, -1
1883 ; RV32ID-NEXT: and a0, a1, a0
1884 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1885 ; RV32ID-NEXT: addi sp, sp, 16
1888 ; RV64ID-LABEL: fcvt_wu_h_sat:
1889 ; RV64ID: # %bb.0: # %start
1890 ; RV64ID-NEXT: addi sp, sp, -16
1891 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1892 ; RV64ID-NEXT: call __extendhfsf2
1893 ; RV64ID-NEXT: fcvt.wu.s a0, fa0, rtz
1894 ; RV64ID-NEXT: feq.s a1, fa0, fa0
1895 ; RV64ID-NEXT: seqz a1, a1
1896 ; RV64ID-NEXT: addi a1, a1, -1
1897 ; RV64ID-NEXT: and a0, a0, a1
1898 ; RV64ID-NEXT: slli a0, a0, 32
1899 ; RV64ID-NEXT: srli a0, a0, 32
1900 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1901 ; RV64ID-NEXT: addi sp, sp, 16
1904 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_h_sat:
1905 ; CHECK32-IZFHMIN: # %bb.0: # %start
1906 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1907 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
1908 ; CHECK32-IZFHMIN-NEXT: feq.s a1, fa5, fa5
1909 ; CHECK32-IZFHMIN-NEXT: seqz a1, a1
1910 ; CHECK32-IZFHMIN-NEXT: addi a1, a1, -1
1911 ; CHECK32-IZFHMIN-NEXT: and a0, a1, a0
1912 ; CHECK32-IZFHMIN-NEXT: ret
1914 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_h_sat:
1915 ; CHECK64-IZFHMIN: # %bb.0: # %start
1916 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
1917 ; CHECK64-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
1918 ; CHECK64-IZFHMIN-NEXT: feq.s a1, fa5, fa5
1919 ; CHECK64-IZFHMIN-NEXT: seqz a1, a1
1920 ; CHECK64-IZFHMIN-NEXT: addi a1, a1, -1
1921 ; CHECK64-IZFHMIN-NEXT: and a0, a0, a1
1922 ; CHECK64-IZFHMIN-NEXT: slli a0, a0, 32
1923 ; CHECK64-IZFHMIN-NEXT: srli a0, a0, 32
1924 ; CHECK64-IZFHMIN-NEXT: ret
1926 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_h_sat:
1927 ; CHECK32-IZHINXMIN: # %bb.0: # %start
1928 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1929 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
1930 ; CHECK32-IZHINXMIN-NEXT: feq.s a0, a0, a0
1931 ; CHECK32-IZHINXMIN-NEXT: seqz a0, a0
1932 ; CHECK32-IZHINXMIN-NEXT: addi a0, a0, -1
1933 ; CHECK32-IZHINXMIN-NEXT: and a0, a0, a1
1934 ; CHECK32-IZHINXMIN-NEXT: ret
1936 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_h_sat:
1937 ; CHECK64-IZHINXMIN: # %bb.0: # %start
1938 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
1939 ; CHECK64-IZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
1940 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
1941 ; CHECK64-IZHINXMIN-NEXT: seqz a0, a0
1942 ; CHECK64-IZHINXMIN-NEXT: addi a0, a0, -1
1943 ; CHECK64-IZHINXMIN-NEXT: and a0, a1, a0
1944 ; CHECK64-IZHINXMIN-NEXT: slli a0, a0, 32
1945 ; CHECK64-IZHINXMIN-NEXT: srli a0, a0, 32
1946 ; CHECK64-IZHINXMIN-NEXT: ret
1948 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_h_sat:
1949 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
1950 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1951 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
1952 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
1953 ; CHECK32-IZDINXZHINXMIN-NEXT: seqz a0, a0
1954 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
1955 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a0, a1
1956 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
1958 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_h_sat:
1959 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
1960 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
1961 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
1962 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
1963 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a0, a0
1964 ; CHECK64-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
1965 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a1, a0
1966 ; CHECK64-IZDINXZHINXMIN-NEXT: slli a0, a0, 32
1967 ; CHECK64-IZDINXZHINXMIN-NEXT: srli a0, a0, 32
1968 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
1970 %0 = tail call i32 @llvm.fptoui.sat.i32.f16(half %a)
1973 declare i32 @llvm.fptoui.sat.i32.f16(half)
1975 define i64 @fcvt_l_h(half %a) nounwind {
1976 ; RV32IZFH-LABEL: fcvt_l_h:
1977 ; RV32IZFH: # %bb.0:
1978 ; RV32IZFH-NEXT: addi sp, sp, -16
1979 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1980 ; RV32IZFH-NEXT: call __fixhfdi
1981 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1982 ; RV32IZFH-NEXT: addi sp, sp, 16
1983 ; RV32IZFH-NEXT: ret
1985 ; RV64IZFH-LABEL: fcvt_l_h:
1986 ; RV64IZFH: # %bb.0:
1987 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
1988 ; RV64IZFH-NEXT: ret
1990 ; RV32IDZFH-LABEL: fcvt_l_h:
1991 ; RV32IDZFH: # %bb.0:
1992 ; RV32IDZFH-NEXT: addi sp, sp, -16
1993 ; RV32IDZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1994 ; RV32IDZFH-NEXT: call __fixhfdi
1995 ; RV32IDZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1996 ; RV32IDZFH-NEXT: addi sp, sp, 16
1997 ; RV32IDZFH-NEXT: ret
1999 ; RV64IDZFH-LABEL: fcvt_l_h:
2000 ; RV64IDZFH: # %bb.0:
2001 ; RV64IDZFH-NEXT: fcvt.l.h a0, fa0, rtz
2002 ; RV64IDZFH-NEXT: ret
2004 ; RV32IZHINX-LABEL: fcvt_l_h:
2005 ; RV32IZHINX: # %bb.0:
2006 ; RV32IZHINX-NEXT: addi sp, sp, -16
2007 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2008 ; RV32IZHINX-NEXT: call __fixhfdi
2009 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2010 ; RV32IZHINX-NEXT: addi sp, sp, 16
2011 ; RV32IZHINX-NEXT: ret
2013 ; RV64IZHINX-LABEL: fcvt_l_h:
2014 ; RV64IZHINX: # %bb.0:
2015 ; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz
2016 ; RV64IZHINX-NEXT: ret
2018 ; RV32IZDINXZHINX-LABEL: fcvt_l_h:
2019 ; RV32IZDINXZHINX: # %bb.0:
2020 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
2021 ; RV32IZDINXZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2022 ; RV32IZDINXZHINX-NEXT: call __fixhfdi
2023 ; RV32IZDINXZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2024 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
2025 ; RV32IZDINXZHINX-NEXT: ret
2027 ; RV64IZDINXZHINX-LABEL: fcvt_l_h:
2028 ; RV64IZDINXZHINX: # %bb.0:
2029 ; RV64IZDINXZHINX-NEXT: fcvt.l.h a0, a0, rtz
2030 ; RV64IZDINXZHINX-NEXT: ret
2032 ; RV32I-LABEL: fcvt_l_h:
2034 ; RV32I-NEXT: addi sp, sp, -16
2035 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2036 ; RV32I-NEXT: slli a0, a0, 16
2037 ; RV32I-NEXT: srli a0, a0, 16
2038 ; RV32I-NEXT: call __extendhfsf2
2039 ; RV32I-NEXT: call __fixsfdi
2040 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2041 ; RV32I-NEXT: addi sp, sp, 16
2044 ; RV64I-LABEL: fcvt_l_h:
2046 ; RV64I-NEXT: addi sp, sp, -16
2047 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2048 ; RV64I-NEXT: slli a0, a0, 48
2049 ; RV64I-NEXT: srli a0, a0, 48
2050 ; RV64I-NEXT: call __extendhfsf2
2051 ; RV64I-NEXT: call __fixsfdi
2052 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2053 ; RV64I-NEXT: addi sp, sp, 16
2056 ; RV32ID-ILP32-LABEL: fcvt_l_h:
2057 ; RV32ID-ILP32: # %bb.0:
2058 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
2059 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2060 ; RV32ID-ILP32-NEXT: call __extendhfsf2
2061 ; RV32ID-ILP32-NEXT: call __fixsfdi
2062 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2063 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
2064 ; RV32ID-ILP32-NEXT: ret
2066 ; RV64ID-LP64-LABEL: fcvt_l_h:
2067 ; RV64ID-LP64: # %bb.0:
2068 ; RV64ID-LP64-NEXT: addi sp, sp, -16
2069 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2070 ; RV64ID-LP64-NEXT: call __extendhfsf2
2071 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
2072 ; RV64ID-LP64-NEXT: fcvt.l.s a0, fa5, rtz
2073 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2074 ; RV64ID-LP64-NEXT: addi sp, sp, 16
2075 ; RV64ID-LP64-NEXT: ret
2077 ; RV32ID-LABEL: fcvt_l_h:
2079 ; RV32ID-NEXT: addi sp, sp, -16
2080 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2081 ; RV32ID-NEXT: call __extendhfsf2
2082 ; RV32ID-NEXT: call __fixsfdi
2083 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2084 ; RV32ID-NEXT: addi sp, sp, 16
2087 ; RV64ID-LABEL: fcvt_l_h:
2089 ; RV64ID-NEXT: addi sp, sp, -16
2090 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2091 ; RV64ID-NEXT: call __extendhfsf2
2092 ; RV64ID-NEXT: fcvt.l.s a0, fa0, rtz
2093 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2094 ; RV64ID-NEXT: addi sp, sp, 16
2097 ; CHECK32-IZFHMIN-LABEL: fcvt_l_h:
2098 ; CHECK32-IZFHMIN: # %bb.0:
2099 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, -16
2100 ; CHECK32-IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2101 ; CHECK32-IZFHMIN-NEXT: call __fixhfdi
2102 ; CHECK32-IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2103 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, 16
2104 ; CHECK32-IZFHMIN-NEXT: ret
2106 ; CHECK64-IZFHMIN-LABEL: fcvt_l_h:
2107 ; CHECK64-IZFHMIN: # %bb.0:
2108 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
2109 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a0, fa5, rtz
2110 ; CHECK64-IZFHMIN-NEXT: ret
2112 ; CHECK32-IZHINXMIN-LABEL: fcvt_l_h:
2113 ; CHECK32-IZHINXMIN: # %bb.0:
2114 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
2115 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2116 ; CHECK32-IZHINXMIN-NEXT: call __fixhfdi
2117 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2118 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
2119 ; CHECK32-IZHINXMIN-NEXT: ret
2121 ; CHECK64-IZHINXMIN-LABEL: fcvt_l_h:
2122 ; CHECK64-IZHINXMIN: # %bb.0:
2123 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
2124 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
2125 ; CHECK64-IZHINXMIN-NEXT: ret
2127 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_l_h:
2128 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
2129 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
2130 ; CHECK32-IZDINXZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2131 ; CHECK32-IZDINXZHINXMIN-NEXT: call __fixhfdi
2132 ; CHECK32-IZDINXZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2133 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
2134 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
2136 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_l_h:
2137 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
2138 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
2139 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
2140 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
2141 %1 = fptosi half %a to i64
2145 define i64 @fcvt_l_h_sat(half %a) nounwind {
2146 ; RV32IZFH-LABEL: fcvt_l_h_sat:
2147 ; RV32IZFH: # %bb.0: # %start
2148 ; RV32IZFH-NEXT: addi sp, sp, -16
2149 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2150 ; RV32IZFH-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2151 ; RV32IZFH-NEXT: fsw fs0, 4(sp) # 4-byte Folded Spill
2152 ; RV32IZFH-NEXT: fcvt.s.h fs0, fa0
2153 ; RV32IZFH-NEXT: lui a0, 913408
2154 ; RV32IZFH-NEXT: fmv.w.x fa5, a0
2155 ; RV32IZFH-NEXT: fle.s s0, fa5, fs0
2156 ; RV32IZFH-NEXT: fmv.s fa0, fs0
2157 ; RV32IZFH-NEXT: call __fixsfdi
2158 ; RV32IZFH-NEXT: lui a4, 524288
2159 ; RV32IZFH-NEXT: lui a2, 524288
2160 ; RV32IZFH-NEXT: beqz s0, .LBB10_2
2161 ; RV32IZFH-NEXT: # %bb.1: # %start
2162 ; RV32IZFH-NEXT: mv a2, a1
2163 ; RV32IZFH-NEXT: .LBB10_2: # %start
2164 ; RV32IZFH-NEXT: lui a1, %hi(.LCPI10_0)
2165 ; RV32IZFH-NEXT: flw fa5, %lo(.LCPI10_0)(a1)
2166 ; RV32IZFH-NEXT: flt.s a3, fa5, fs0
2167 ; RV32IZFH-NEXT: beqz a3, .LBB10_4
2168 ; RV32IZFH-NEXT: # %bb.3:
2169 ; RV32IZFH-NEXT: addi a2, a4, -1
2170 ; RV32IZFH-NEXT: .LBB10_4: # %start
2171 ; RV32IZFH-NEXT: feq.s a1, fs0, fs0
2172 ; RV32IZFH-NEXT: neg a4, a1
2173 ; RV32IZFH-NEXT: and a1, a4, a2
2174 ; RV32IZFH-NEXT: neg a2, a3
2175 ; RV32IZFH-NEXT: neg a3, s0
2176 ; RV32IZFH-NEXT: and a0, a3, a0
2177 ; RV32IZFH-NEXT: or a0, a2, a0
2178 ; RV32IZFH-NEXT: and a0, a4, a0
2179 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2180 ; RV32IZFH-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2181 ; RV32IZFH-NEXT: flw fs0, 4(sp) # 4-byte Folded Reload
2182 ; RV32IZFH-NEXT: addi sp, sp, 16
2183 ; RV32IZFH-NEXT: ret
2185 ; RV64IZFH-LABEL: fcvt_l_h_sat:
2186 ; RV64IZFH: # %bb.0: # %start
2187 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
2188 ; RV64IZFH-NEXT: feq.h a1, fa0, fa0
2189 ; RV64IZFH-NEXT: seqz a1, a1
2190 ; RV64IZFH-NEXT: addi a1, a1, -1
2191 ; RV64IZFH-NEXT: and a0, a1, a0
2192 ; RV64IZFH-NEXT: ret
2194 ; RV32IDZFH-LABEL: fcvt_l_h_sat:
2195 ; RV32IDZFH: # %bb.0: # %start
2196 ; RV32IDZFH-NEXT: addi sp, sp, -16
2197 ; RV32IDZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2198 ; RV32IDZFH-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2199 ; RV32IDZFH-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
2200 ; RV32IDZFH-NEXT: fcvt.s.h fs0, fa0
2201 ; RV32IDZFH-NEXT: lui a0, 913408
2202 ; RV32IDZFH-NEXT: fmv.w.x fa5, a0
2203 ; RV32IDZFH-NEXT: fle.s s0, fa5, fs0
2204 ; RV32IDZFH-NEXT: fmv.s fa0, fs0
2205 ; RV32IDZFH-NEXT: call __fixsfdi
2206 ; RV32IDZFH-NEXT: lui a4, 524288
2207 ; RV32IDZFH-NEXT: lui a2, 524288
2208 ; RV32IDZFH-NEXT: beqz s0, .LBB10_2
2209 ; RV32IDZFH-NEXT: # %bb.1: # %start
2210 ; RV32IDZFH-NEXT: mv a2, a1
2211 ; RV32IDZFH-NEXT: .LBB10_2: # %start
2212 ; RV32IDZFH-NEXT: lui a1, %hi(.LCPI10_0)
2213 ; RV32IDZFH-NEXT: flw fa5, %lo(.LCPI10_0)(a1)
2214 ; RV32IDZFH-NEXT: flt.s a3, fa5, fs0
2215 ; RV32IDZFH-NEXT: beqz a3, .LBB10_4
2216 ; RV32IDZFH-NEXT: # %bb.3:
2217 ; RV32IDZFH-NEXT: addi a2, a4, -1
2218 ; RV32IDZFH-NEXT: .LBB10_4: # %start
2219 ; RV32IDZFH-NEXT: feq.s a1, fs0, fs0
2220 ; RV32IDZFH-NEXT: neg a4, a1
2221 ; RV32IDZFH-NEXT: and a1, a4, a2
2222 ; RV32IDZFH-NEXT: neg a2, a3
2223 ; RV32IDZFH-NEXT: neg a3, s0
2224 ; RV32IDZFH-NEXT: and a0, a3, a0
2225 ; RV32IDZFH-NEXT: or a0, a2, a0
2226 ; RV32IDZFH-NEXT: and a0, a4, a0
2227 ; RV32IDZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2228 ; RV32IDZFH-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2229 ; RV32IDZFH-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
2230 ; RV32IDZFH-NEXT: addi sp, sp, 16
2231 ; RV32IDZFH-NEXT: ret
2233 ; RV64IDZFH-LABEL: fcvt_l_h_sat:
2234 ; RV64IDZFH: # %bb.0: # %start
2235 ; RV64IDZFH-NEXT: fcvt.l.h a0, fa0, rtz
2236 ; RV64IDZFH-NEXT: feq.h a1, fa0, fa0
2237 ; RV64IDZFH-NEXT: seqz a1, a1
2238 ; RV64IDZFH-NEXT: addi a1, a1, -1
2239 ; RV64IDZFH-NEXT: and a0, a1, a0
2240 ; RV64IDZFH-NEXT: ret
2242 ; RV32IZHINX-LABEL: fcvt_l_h_sat:
2243 ; RV32IZHINX: # %bb.0: # %start
2244 ; RV32IZHINX-NEXT: addi sp, sp, -32
2245 ; RV32IZHINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2246 ; RV32IZHINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2247 ; RV32IZHINX-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
2248 ; RV32IZHINX-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
2249 ; RV32IZHINX-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
2250 ; RV32IZHINX-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
2251 ; RV32IZHINX-NEXT: lui a1, %hi(.LCPI10_0)
2252 ; RV32IZHINX-NEXT: lw a1, %lo(.LCPI10_0)(a1)
2253 ; RV32IZHINX-NEXT: fcvt.s.h s0, a0
2254 ; RV32IZHINX-NEXT: flt.s s1, a1, s0
2255 ; RV32IZHINX-NEXT: neg s2, s1
2256 ; RV32IZHINX-NEXT: lui a0, 913408
2257 ; RV32IZHINX-NEXT: fle.s s3, a0, s0
2258 ; RV32IZHINX-NEXT: neg s4, s3
2259 ; RV32IZHINX-NEXT: mv a0, s0
2260 ; RV32IZHINX-NEXT: call __fixsfdi
2261 ; RV32IZHINX-NEXT: and a0, s4, a0
2262 ; RV32IZHINX-NEXT: or a0, s2, a0
2263 ; RV32IZHINX-NEXT: feq.s a2, s0, s0
2264 ; RV32IZHINX-NEXT: neg a2, a2
2265 ; RV32IZHINX-NEXT: lui a4, 524288
2266 ; RV32IZHINX-NEXT: lui a3, 524288
2267 ; RV32IZHINX-NEXT: beqz s3, .LBB10_2
2268 ; RV32IZHINX-NEXT: # %bb.1: # %start
2269 ; RV32IZHINX-NEXT: mv a3, a1
2270 ; RV32IZHINX-NEXT: .LBB10_2: # %start
2271 ; RV32IZHINX-NEXT: and a0, a2, a0
2272 ; RV32IZHINX-NEXT: beqz s1, .LBB10_4
2273 ; RV32IZHINX-NEXT: # %bb.3:
2274 ; RV32IZHINX-NEXT: addi a3, a4, -1
2275 ; RV32IZHINX-NEXT: .LBB10_4: # %start
2276 ; RV32IZHINX-NEXT: and a1, a2, a3
2277 ; RV32IZHINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2278 ; RV32IZHINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2279 ; RV32IZHINX-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
2280 ; RV32IZHINX-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
2281 ; RV32IZHINX-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
2282 ; RV32IZHINX-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
2283 ; RV32IZHINX-NEXT: addi sp, sp, 32
2284 ; RV32IZHINX-NEXT: ret
2286 ; RV64IZHINX-LABEL: fcvt_l_h_sat:
2287 ; RV64IZHINX: # %bb.0: # %start
2288 ; RV64IZHINX-NEXT: fcvt.l.h a1, a0, rtz
2289 ; RV64IZHINX-NEXT: feq.h a0, a0, a0
2290 ; RV64IZHINX-NEXT: seqz a0, a0
2291 ; RV64IZHINX-NEXT: addi a0, a0, -1
2292 ; RV64IZHINX-NEXT: and a0, a0, a1
2293 ; RV64IZHINX-NEXT: ret
2295 ; RV32IZDINXZHINX-LABEL: fcvt_l_h_sat:
2296 ; RV32IZDINXZHINX: # %bb.0: # %start
2297 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -32
2298 ; RV32IZDINXZHINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2299 ; RV32IZDINXZHINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2300 ; RV32IZDINXZHINX-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
2301 ; RV32IZDINXZHINX-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
2302 ; RV32IZDINXZHINX-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
2303 ; RV32IZDINXZHINX-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
2304 ; RV32IZDINXZHINX-NEXT: lui a1, %hi(.LCPI10_0)
2305 ; RV32IZDINXZHINX-NEXT: lw a1, %lo(.LCPI10_0)(a1)
2306 ; RV32IZDINXZHINX-NEXT: fcvt.s.h s0, a0
2307 ; RV32IZDINXZHINX-NEXT: flt.s s1, a1, s0
2308 ; RV32IZDINXZHINX-NEXT: neg s2, s1
2309 ; RV32IZDINXZHINX-NEXT: lui a0, 913408
2310 ; RV32IZDINXZHINX-NEXT: fle.s s3, a0, s0
2311 ; RV32IZDINXZHINX-NEXT: neg s4, s3
2312 ; RV32IZDINXZHINX-NEXT: mv a0, s0
2313 ; RV32IZDINXZHINX-NEXT: call __fixsfdi
2314 ; RV32IZDINXZHINX-NEXT: and a0, s4, a0
2315 ; RV32IZDINXZHINX-NEXT: or a0, s2, a0
2316 ; RV32IZDINXZHINX-NEXT: feq.s a2, s0, s0
2317 ; RV32IZDINXZHINX-NEXT: neg a2, a2
2318 ; RV32IZDINXZHINX-NEXT: lui a4, 524288
2319 ; RV32IZDINXZHINX-NEXT: lui a3, 524288
2320 ; RV32IZDINXZHINX-NEXT: beqz s3, .LBB10_2
2321 ; RV32IZDINXZHINX-NEXT: # %bb.1: # %start
2322 ; RV32IZDINXZHINX-NEXT: mv a3, a1
2323 ; RV32IZDINXZHINX-NEXT: .LBB10_2: # %start
2324 ; RV32IZDINXZHINX-NEXT: and a0, a2, a0
2325 ; RV32IZDINXZHINX-NEXT: beqz s1, .LBB10_4
2326 ; RV32IZDINXZHINX-NEXT: # %bb.3:
2327 ; RV32IZDINXZHINX-NEXT: addi a3, a4, -1
2328 ; RV32IZDINXZHINX-NEXT: .LBB10_4: # %start
2329 ; RV32IZDINXZHINX-NEXT: and a1, a2, a3
2330 ; RV32IZDINXZHINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2331 ; RV32IZDINXZHINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2332 ; RV32IZDINXZHINX-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
2333 ; RV32IZDINXZHINX-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
2334 ; RV32IZDINXZHINX-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
2335 ; RV32IZDINXZHINX-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
2336 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 32
2337 ; RV32IZDINXZHINX-NEXT: ret
2339 ; RV64IZDINXZHINX-LABEL: fcvt_l_h_sat:
2340 ; RV64IZDINXZHINX: # %bb.0: # %start
2341 ; RV64IZDINXZHINX-NEXT: fcvt.l.h a1, a0, rtz
2342 ; RV64IZDINXZHINX-NEXT: feq.h a0, a0, a0
2343 ; RV64IZDINXZHINX-NEXT: seqz a0, a0
2344 ; RV64IZDINXZHINX-NEXT: addi a0, a0, -1
2345 ; RV64IZDINXZHINX-NEXT: and a0, a0, a1
2346 ; RV64IZDINXZHINX-NEXT: ret
2348 ; RV32I-LABEL: fcvt_l_h_sat:
2349 ; RV32I: # %bb.0: # %start
2350 ; RV32I-NEXT: addi sp, sp, -32
2351 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2352 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2353 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
2354 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
2355 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
2356 ; RV32I-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
2357 ; RV32I-NEXT: sw s5, 4(sp) # 4-byte Folded Spill
2358 ; RV32I-NEXT: call __extendhfsf2
2359 ; RV32I-NEXT: mv s1, a0
2360 ; RV32I-NEXT: lui a1, 913408
2361 ; RV32I-NEXT: call __gesf2
2362 ; RV32I-NEXT: mv s0, a0
2363 ; RV32I-NEXT: mv a0, s1
2364 ; RV32I-NEXT: call __fixsfdi
2365 ; RV32I-NEXT: mv s2, a0
2366 ; RV32I-NEXT: mv s3, a1
2367 ; RV32I-NEXT: lui s5, 524288
2368 ; RV32I-NEXT: bgez s0, .LBB10_2
2369 ; RV32I-NEXT: # %bb.1: # %start
2370 ; RV32I-NEXT: lui s3, 524288
2371 ; RV32I-NEXT: .LBB10_2: # %start
2372 ; RV32I-NEXT: lui a1, 389120
2373 ; RV32I-NEXT: addi a1, a1, -1
2374 ; RV32I-NEXT: mv a0, s1
2375 ; RV32I-NEXT: call __gtsf2
2376 ; RV32I-NEXT: mv s4, a0
2377 ; RV32I-NEXT: blez a0, .LBB10_4
2378 ; RV32I-NEXT: # %bb.3: # %start
2379 ; RV32I-NEXT: addi s3, s5, -1
2380 ; RV32I-NEXT: .LBB10_4: # %start
2381 ; RV32I-NEXT: mv a0, s1
2382 ; RV32I-NEXT: mv a1, s1
2383 ; RV32I-NEXT: call __unordsf2
2384 ; RV32I-NEXT: snez a0, a0
2385 ; RV32I-NEXT: addi a0, a0, -1
2386 ; RV32I-NEXT: and a1, a0, s3
2387 ; RV32I-NEXT: sgtz a2, s4
2388 ; RV32I-NEXT: neg a2, a2
2389 ; RV32I-NEXT: slti a3, s0, 0
2390 ; RV32I-NEXT: addi a3, a3, -1
2391 ; RV32I-NEXT: and a3, a3, s2
2392 ; RV32I-NEXT: or a2, a2, a3
2393 ; RV32I-NEXT: and a0, a0, a2
2394 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2395 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2396 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
2397 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
2398 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
2399 ; RV32I-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
2400 ; RV32I-NEXT: lw s5, 4(sp) # 4-byte Folded Reload
2401 ; RV32I-NEXT: addi sp, sp, 32
2404 ; RV64I-LABEL: fcvt_l_h_sat:
2405 ; RV64I: # %bb.0: # %start
2406 ; RV64I-NEXT: addi sp, sp, -48
2407 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
2408 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
2409 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
2410 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
2411 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
2412 ; RV64I-NEXT: slli a0, a0, 48
2413 ; RV64I-NEXT: srli a0, a0, 48
2414 ; RV64I-NEXT: call __extendhfsf2
2415 ; RV64I-NEXT: mv s0, a0
2416 ; RV64I-NEXT: lui a1, 913408
2417 ; RV64I-NEXT: call __gesf2
2418 ; RV64I-NEXT: mv s2, a0
2419 ; RV64I-NEXT: mv a0, s0
2420 ; RV64I-NEXT: call __fixsfdi
2421 ; RV64I-NEXT: mv s1, a0
2422 ; RV64I-NEXT: li s3, -1
2423 ; RV64I-NEXT: bgez s2, .LBB10_2
2424 ; RV64I-NEXT: # %bb.1: # %start
2425 ; RV64I-NEXT: slli s1, s3, 63
2426 ; RV64I-NEXT: .LBB10_2: # %start
2427 ; RV64I-NEXT: lui a1, 389120
2428 ; RV64I-NEXT: addiw a1, a1, -1
2429 ; RV64I-NEXT: mv a0, s0
2430 ; RV64I-NEXT: call __gtsf2
2431 ; RV64I-NEXT: blez a0, .LBB10_4
2432 ; RV64I-NEXT: # %bb.3: # %start
2433 ; RV64I-NEXT: srli s1, s3, 1
2434 ; RV64I-NEXT: .LBB10_4: # %start
2435 ; RV64I-NEXT: mv a0, s0
2436 ; RV64I-NEXT: mv a1, s0
2437 ; RV64I-NEXT: call __unordsf2
2438 ; RV64I-NEXT: snez a0, a0
2439 ; RV64I-NEXT: addi a0, a0, -1
2440 ; RV64I-NEXT: and a0, a0, s1
2441 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
2442 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
2443 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
2444 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
2445 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
2446 ; RV64I-NEXT: addi sp, sp, 48
2449 ; RV32ID-ILP32-LABEL: fcvt_l_h_sat:
2450 ; RV32ID-ILP32: # %bb.0: # %start
2451 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
2452 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2453 ; RV32ID-ILP32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2454 ; RV32ID-ILP32-NEXT: call __extendhfsf2
2455 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a0
2456 ; RV32ID-ILP32-NEXT: lui a1, 913408
2457 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a1
2458 ; RV32ID-ILP32-NEXT: fsw fa4, 4(sp) # 4-byte Folded Spill
2459 ; RV32ID-ILP32-NEXT: fle.s s0, fa5, fa4
2460 ; RV32ID-ILP32-NEXT: call __fixsfdi
2461 ; RV32ID-ILP32-NEXT: lui a4, 524288
2462 ; RV32ID-ILP32-NEXT: lui a2, 524288
2463 ; RV32ID-ILP32-NEXT: beqz s0, .LBB10_2
2464 ; RV32ID-ILP32-NEXT: # %bb.1: # %start
2465 ; RV32ID-ILP32-NEXT: mv a2, a1
2466 ; RV32ID-ILP32-NEXT: .LBB10_2: # %start
2467 ; RV32ID-ILP32-NEXT: lui a1, %hi(.LCPI10_0)
2468 ; RV32ID-ILP32-NEXT: flw fa5, %lo(.LCPI10_0)(a1)
2469 ; RV32ID-ILP32-NEXT: flw fa4, 4(sp) # 4-byte Folded Reload
2470 ; RV32ID-ILP32-NEXT: flt.s a3, fa5, fa4
2471 ; RV32ID-ILP32-NEXT: fmv.s fa5, fa4
2472 ; RV32ID-ILP32-NEXT: beqz a3, .LBB10_4
2473 ; RV32ID-ILP32-NEXT: # %bb.3:
2474 ; RV32ID-ILP32-NEXT: addi a2, a4, -1
2475 ; RV32ID-ILP32-NEXT: .LBB10_4: # %start
2476 ; RV32ID-ILP32-NEXT: feq.s a1, fa5, fa5
2477 ; RV32ID-ILP32-NEXT: neg a4, a1
2478 ; RV32ID-ILP32-NEXT: and a1, a4, a2
2479 ; RV32ID-ILP32-NEXT: neg a2, a3
2480 ; RV32ID-ILP32-NEXT: neg a3, s0
2481 ; RV32ID-ILP32-NEXT: and a0, a3, a0
2482 ; RV32ID-ILP32-NEXT: or a0, a2, a0
2483 ; RV32ID-ILP32-NEXT: and a0, a4, a0
2484 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2485 ; RV32ID-ILP32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2486 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
2487 ; RV32ID-ILP32-NEXT: ret
2489 ; RV64ID-LP64-LABEL: fcvt_l_h_sat:
2490 ; RV64ID-LP64: # %bb.0: # %start
2491 ; RV64ID-LP64-NEXT: addi sp, sp, -16
2492 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2493 ; RV64ID-LP64-NEXT: call __extendhfsf2
2494 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
2495 ; RV64ID-LP64-NEXT: fcvt.l.s a0, fa5, rtz
2496 ; RV64ID-LP64-NEXT: feq.s a1, fa5, fa5
2497 ; RV64ID-LP64-NEXT: seqz a1, a1
2498 ; RV64ID-LP64-NEXT: addi a1, a1, -1
2499 ; RV64ID-LP64-NEXT: and a0, a1, a0
2500 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2501 ; RV64ID-LP64-NEXT: addi sp, sp, 16
2502 ; RV64ID-LP64-NEXT: ret
2504 ; RV32ID-LABEL: fcvt_l_h_sat:
2505 ; RV32ID: # %bb.0: # %start
2506 ; RV32ID-NEXT: addi sp, sp, -16
2507 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2508 ; RV32ID-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2509 ; RV32ID-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
2510 ; RV32ID-NEXT: call __extendhfsf2
2511 ; RV32ID-NEXT: fmv.s fs0, fa0
2512 ; RV32ID-NEXT: lui a0, 913408
2513 ; RV32ID-NEXT: fmv.w.x fa5, a0
2514 ; RV32ID-NEXT: fle.s s0, fa5, fa0
2515 ; RV32ID-NEXT: call __fixsfdi
2516 ; RV32ID-NEXT: lui a4, 524288
2517 ; RV32ID-NEXT: lui a2, 524288
2518 ; RV32ID-NEXT: beqz s0, .LBB10_2
2519 ; RV32ID-NEXT: # %bb.1: # %start
2520 ; RV32ID-NEXT: mv a2, a1
2521 ; RV32ID-NEXT: .LBB10_2: # %start
2522 ; RV32ID-NEXT: lui a1, %hi(.LCPI10_0)
2523 ; RV32ID-NEXT: flw fa5, %lo(.LCPI10_0)(a1)
2524 ; RV32ID-NEXT: flt.s a3, fa5, fs0
2525 ; RV32ID-NEXT: beqz a3, .LBB10_4
2526 ; RV32ID-NEXT: # %bb.3:
2527 ; RV32ID-NEXT: addi a2, a4, -1
2528 ; RV32ID-NEXT: .LBB10_4: # %start
2529 ; RV32ID-NEXT: feq.s a1, fs0, fs0
2530 ; RV32ID-NEXT: neg a4, a1
2531 ; RV32ID-NEXT: and a1, a4, a2
2532 ; RV32ID-NEXT: neg a2, a3
2533 ; RV32ID-NEXT: neg a3, s0
2534 ; RV32ID-NEXT: and a0, a3, a0
2535 ; RV32ID-NEXT: or a0, a2, a0
2536 ; RV32ID-NEXT: and a0, a4, a0
2537 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2538 ; RV32ID-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2539 ; RV32ID-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
2540 ; RV32ID-NEXT: addi sp, sp, 16
2543 ; RV64ID-LABEL: fcvt_l_h_sat:
2544 ; RV64ID: # %bb.0: # %start
2545 ; RV64ID-NEXT: addi sp, sp, -16
2546 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2547 ; RV64ID-NEXT: call __extendhfsf2
2548 ; RV64ID-NEXT: fcvt.l.s a0, fa0, rtz
2549 ; RV64ID-NEXT: feq.s a1, fa0, fa0
2550 ; RV64ID-NEXT: seqz a1, a1
2551 ; RV64ID-NEXT: addi a1, a1, -1
2552 ; RV64ID-NEXT: and a0, a1, a0
2553 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2554 ; RV64ID-NEXT: addi sp, sp, 16
2557 ; RV32IFZFHMIN-LABEL: fcvt_l_h_sat:
2558 ; RV32IFZFHMIN: # %bb.0: # %start
2559 ; RV32IFZFHMIN-NEXT: addi sp, sp, -16
2560 ; RV32IFZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2561 ; RV32IFZFHMIN-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2562 ; RV32IFZFHMIN-NEXT: fsw fs0, 4(sp) # 4-byte Folded Spill
2563 ; RV32IFZFHMIN-NEXT: fcvt.s.h fs0, fa0
2564 ; RV32IFZFHMIN-NEXT: lui a0, 913408
2565 ; RV32IFZFHMIN-NEXT: fmv.w.x fa5, a0
2566 ; RV32IFZFHMIN-NEXT: fle.s s0, fa5, fs0
2567 ; RV32IFZFHMIN-NEXT: fmv.s fa0, fs0
2568 ; RV32IFZFHMIN-NEXT: call __fixsfdi
2569 ; RV32IFZFHMIN-NEXT: lui a4, 524288
2570 ; RV32IFZFHMIN-NEXT: lui a2, 524288
2571 ; RV32IFZFHMIN-NEXT: beqz s0, .LBB10_2
2572 ; RV32IFZFHMIN-NEXT: # %bb.1: # %start
2573 ; RV32IFZFHMIN-NEXT: mv a2, a1
2574 ; RV32IFZFHMIN-NEXT: .LBB10_2: # %start
2575 ; RV32IFZFHMIN-NEXT: lui a1, %hi(.LCPI10_0)
2576 ; RV32IFZFHMIN-NEXT: flw fa5, %lo(.LCPI10_0)(a1)
2577 ; RV32IFZFHMIN-NEXT: flt.s a3, fa5, fs0
2578 ; RV32IFZFHMIN-NEXT: beqz a3, .LBB10_4
2579 ; RV32IFZFHMIN-NEXT: # %bb.3:
2580 ; RV32IFZFHMIN-NEXT: addi a2, a4, -1
2581 ; RV32IFZFHMIN-NEXT: .LBB10_4: # %start
2582 ; RV32IFZFHMIN-NEXT: feq.s a1, fs0, fs0
2583 ; RV32IFZFHMIN-NEXT: neg a4, a1
2584 ; RV32IFZFHMIN-NEXT: and a1, a4, a2
2585 ; RV32IFZFHMIN-NEXT: neg a2, a3
2586 ; RV32IFZFHMIN-NEXT: neg a3, s0
2587 ; RV32IFZFHMIN-NEXT: and a0, a3, a0
2588 ; RV32IFZFHMIN-NEXT: or a0, a2, a0
2589 ; RV32IFZFHMIN-NEXT: and a0, a4, a0
2590 ; RV32IFZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2591 ; RV32IFZFHMIN-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2592 ; RV32IFZFHMIN-NEXT: flw fs0, 4(sp) # 4-byte Folded Reload
2593 ; RV32IFZFHMIN-NEXT: addi sp, sp, 16
2594 ; RV32IFZFHMIN-NEXT: ret
2596 ; CHECK64-IZFHMIN-LABEL: fcvt_l_h_sat:
2597 ; CHECK64-IZFHMIN: # %bb.0: # %start
2598 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
2599 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a0, fa5, rtz
2600 ; CHECK64-IZFHMIN-NEXT: feq.s a1, fa5, fa5
2601 ; CHECK64-IZFHMIN-NEXT: seqz a1, a1
2602 ; CHECK64-IZFHMIN-NEXT: addi a1, a1, -1
2603 ; CHECK64-IZFHMIN-NEXT: and a0, a1, a0
2604 ; CHECK64-IZFHMIN-NEXT: ret
2606 ; RV32IDZFHMIN-LABEL: fcvt_l_h_sat:
2607 ; RV32IDZFHMIN: # %bb.0: # %start
2608 ; RV32IDZFHMIN-NEXT: addi sp, sp, -16
2609 ; RV32IDZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2610 ; RV32IDZFHMIN-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2611 ; RV32IDZFHMIN-NEXT: fsd fs0, 0(sp) # 8-byte Folded Spill
2612 ; RV32IDZFHMIN-NEXT: fcvt.s.h fs0, fa0
2613 ; RV32IDZFHMIN-NEXT: lui a0, 913408
2614 ; RV32IDZFHMIN-NEXT: fmv.w.x fa5, a0
2615 ; RV32IDZFHMIN-NEXT: fle.s s0, fa5, fs0
2616 ; RV32IDZFHMIN-NEXT: fmv.s fa0, fs0
2617 ; RV32IDZFHMIN-NEXT: call __fixsfdi
2618 ; RV32IDZFHMIN-NEXT: lui a4, 524288
2619 ; RV32IDZFHMIN-NEXT: lui a2, 524288
2620 ; RV32IDZFHMIN-NEXT: beqz s0, .LBB10_2
2621 ; RV32IDZFHMIN-NEXT: # %bb.1: # %start
2622 ; RV32IDZFHMIN-NEXT: mv a2, a1
2623 ; RV32IDZFHMIN-NEXT: .LBB10_2: # %start
2624 ; RV32IDZFHMIN-NEXT: lui a1, %hi(.LCPI10_0)
2625 ; RV32IDZFHMIN-NEXT: flw fa5, %lo(.LCPI10_0)(a1)
2626 ; RV32IDZFHMIN-NEXT: flt.s a3, fa5, fs0
2627 ; RV32IDZFHMIN-NEXT: beqz a3, .LBB10_4
2628 ; RV32IDZFHMIN-NEXT: # %bb.3:
2629 ; RV32IDZFHMIN-NEXT: addi a2, a4, -1
2630 ; RV32IDZFHMIN-NEXT: .LBB10_4: # %start
2631 ; RV32IDZFHMIN-NEXT: feq.s a1, fs0, fs0
2632 ; RV32IDZFHMIN-NEXT: neg a4, a1
2633 ; RV32IDZFHMIN-NEXT: and a1, a4, a2
2634 ; RV32IDZFHMIN-NEXT: neg a2, a3
2635 ; RV32IDZFHMIN-NEXT: neg a3, s0
2636 ; RV32IDZFHMIN-NEXT: and a0, a3, a0
2637 ; RV32IDZFHMIN-NEXT: or a0, a2, a0
2638 ; RV32IDZFHMIN-NEXT: and a0, a4, a0
2639 ; RV32IDZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2640 ; RV32IDZFHMIN-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2641 ; RV32IDZFHMIN-NEXT: fld fs0, 0(sp) # 8-byte Folded Reload
2642 ; RV32IDZFHMIN-NEXT: addi sp, sp, 16
2643 ; RV32IDZFHMIN-NEXT: ret
2645 ; CHECK32-IZHINXMIN-LABEL: fcvt_l_h_sat:
2646 ; CHECK32-IZHINXMIN: # %bb.0: # %start
2647 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -32
2648 ; CHECK32-IZHINXMIN-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2649 ; CHECK32-IZHINXMIN-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2650 ; CHECK32-IZHINXMIN-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
2651 ; CHECK32-IZHINXMIN-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
2652 ; CHECK32-IZHINXMIN-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
2653 ; CHECK32-IZHINXMIN-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
2654 ; CHECK32-IZHINXMIN-NEXT: lui a1, %hi(.LCPI10_0)
2655 ; CHECK32-IZHINXMIN-NEXT: lw a1, %lo(.LCPI10_0)(a1)
2656 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h s0, a0
2657 ; CHECK32-IZHINXMIN-NEXT: flt.s s1, a1, s0
2658 ; CHECK32-IZHINXMIN-NEXT: neg s2, s1
2659 ; CHECK32-IZHINXMIN-NEXT: lui a0, 913408
2660 ; CHECK32-IZHINXMIN-NEXT: fle.s s3, a0, s0
2661 ; CHECK32-IZHINXMIN-NEXT: neg s4, s3
2662 ; CHECK32-IZHINXMIN-NEXT: mv a0, s0
2663 ; CHECK32-IZHINXMIN-NEXT: call __fixsfdi
2664 ; CHECK32-IZHINXMIN-NEXT: and a0, s4, a0
2665 ; CHECK32-IZHINXMIN-NEXT: or a0, s2, a0
2666 ; CHECK32-IZHINXMIN-NEXT: feq.s a2, s0, s0
2667 ; CHECK32-IZHINXMIN-NEXT: neg a2, a2
2668 ; CHECK32-IZHINXMIN-NEXT: lui a4, 524288
2669 ; CHECK32-IZHINXMIN-NEXT: lui a3, 524288
2670 ; CHECK32-IZHINXMIN-NEXT: beqz s3, .LBB10_2
2671 ; CHECK32-IZHINXMIN-NEXT: # %bb.1: # %start
2672 ; CHECK32-IZHINXMIN-NEXT: mv a3, a1
2673 ; CHECK32-IZHINXMIN-NEXT: .LBB10_2: # %start
2674 ; CHECK32-IZHINXMIN-NEXT: and a0, a2, a0
2675 ; CHECK32-IZHINXMIN-NEXT: beqz s1, .LBB10_4
2676 ; CHECK32-IZHINXMIN-NEXT: # %bb.3:
2677 ; CHECK32-IZHINXMIN-NEXT: addi a3, a4, -1
2678 ; CHECK32-IZHINXMIN-NEXT: .LBB10_4: # %start
2679 ; CHECK32-IZHINXMIN-NEXT: and a1, a2, a3
2680 ; CHECK32-IZHINXMIN-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2681 ; CHECK32-IZHINXMIN-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2682 ; CHECK32-IZHINXMIN-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
2683 ; CHECK32-IZHINXMIN-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
2684 ; CHECK32-IZHINXMIN-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
2685 ; CHECK32-IZHINXMIN-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
2686 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 32
2687 ; CHECK32-IZHINXMIN-NEXT: ret
2689 ; CHECK64-IZHINXMIN-LABEL: fcvt_l_h_sat:
2690 ; CHECK64-IZHINXMIN: # %bb.0: # %start
2691 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
2692 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a1, a0, rtz
2693 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
2694 ; CHECK64-IZHINXMIN-NEXT: seqz a0, a0
2695 ; CHECK64-IZHINXMIN-NEXT: addi a0, a0, -1
2696 ; CHECK64-IZHINXMIN-NEXT: and a0, a0, a1
2697 ; CHECK64-IZHINXMIN-NEXT: ret
2699 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_l_h_sat:
2700 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
2701 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -32
2702 ; CHECK32-IZDINXZHINXMIN-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2703 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2704 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
2705 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
2706 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
2707 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
2708 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a1, %hi(.LCPI10_0)
2709 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a1, %lo(.LCPI10_0)(a1)
2710 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h s0, a0
2711 ; CHECK32-IZDINXZHINXMIN-NEXT: flt.s s1, a1, s0
2712 ; CHECK32-IZDINXZHINXMIN-NEXT: neg s2, s1
2713 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a0, 913408
2714 ; CHECK32-IZDINXZHINXMIN-NEXT: fle.s s3, a0, s0
2715 ; CHECK32-IZDINXZHINXMIN-NEXT: neg s4, s3
2716 ; CHECK32-IZDINXZHINXMIN-NEXT: mv a0, s0
2717 ; CHECK32-IZDINXZHINXMIN-NEXT: call __fixsfdi
2718 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, s4, a0
2719 ; CHECK32-IZDINXZHINXMIN-NEXT: or a0, s2, a0
2720 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a2, s0, s0
2721 ; CHECK32-IZDINXZHINXMIN-NEXT: neg a2, a2
2722 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a4, 524288
2723 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a3, 524288
2724 ; CHECK32-IZDINXZHINXMIN-NEXT: beqz s3, .LBB10_2
2725 ; CHECK32-IZDINXZHINXMIN-NEXT: # %bb.1: # %start
2726 ; CHECK32-IZDINXZHINXMIN-NEXT: mv a3, a1
2727 ; CHECK32-IZDINXZHINXMIN-NEXT: .LBB10_2: # %start
2728 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a2, a0
2729 ; CHECK32-IZDINXZHINXMIN-NEXT: beqz s1, .LBB10_4
2730 ; CHECK32-IZDINXZHINXMIN-NEXT: # %bb.3:
2731 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a3, a4, -1
2732 ; CHECK32-IZDINXZHINXMIN-NEXT: .LBB10_4: # %start
2733 ; CHECK32-IZDINXZHINXMIN-NEXT: and a1, a2, a3
2734 ; CHECK32-IZDINXZHINXMIN-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2735 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2736 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
2737 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
2738 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
2739 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
2740 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 32
2741 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
2743 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_l_h_sat:
2744 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
2745 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
2746 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a1, a0, rtz
2747 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
2748 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a0, a0
2749 ; CHECK64-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
2750 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a0, a1
2751 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
2753 %0 = tail call i64 @llvm.fptosi.sat.i64.f16(half %a)
2756 declare i64 @llvm.fptosi.sat.i64.f16(half)
2758 define i64 @fcvt_lu_h(half %a) nounwind {
2759 ; RV32IZFH-LABEL: fcvt_lu_h:
2760 ; RV32IZFH: # %bb.0:
2761 ; RV32IZFH-NEXT: addi sp, sp, -16
2762 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2763 ; RV32IZFH-NEXT: call __fixunshfdi
2764 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2765 ; RV32IZFH-NEXT: addi sp, sp, 16
2766 ; RV32IZFH-NEXT: ret
2768 ; RV64IZFH-LABEL: fcvt_lu_h:
2769 ; RV64IZFH: # %bb.0:
2770 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
2771 ; RV64IZFH-NEXT: ret
2773 ; RV32IDZFH-LABEL: fcvt_lu_h:
2774 ; RV32IDZFH: # %bb.0:
2775 ; RV32IDZFH-NEXT: addi sp, sp, -16
2776 ; RV32IDZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2777 ; RV32IDZFH-NEXT: call __fixunshfdi
2778 ; RV32IDZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2779 ; RV32IDZFH-NEXT: addi sp, sp, 16
2780 ; RV32IDZFH-NEXT: ret
2782 ; RV64IDZFH-LABEL: fcvt_lu_h:
2783 ; RV64IDZFH: # %bb.0:
2784 ; RV64IDZFH-NEXT: fcvt.lu.h a0, fa0, rtz
2785 ; RV64IDZFH-NEXT: ret
2787 ; RV32IZHINX-LABEL: fcvt_lu_h:
2788 ; RV32IZHINX: # %bb.0:
2789 ; RV32IZHINX-NEXT: addi sp, sp, -16
2790 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2791 ; RV32IZHINX-NEXT: call __fixunshfdi
2792 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2793 ; RV32IZHINX-NEXT: addi sp, sp, 16
2794 ; RV32IZHINX-NEXT: ret
2796 ; RV64IZHINX-LABEL: fcvt_lu_h:
2797 ; RV64IZHINX: # %bb.0:
2798 ; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz
2799 ; RV64IZHINX-NEXT: ret
2801 ; RV32IZDINXZHINX-LABEL: fcvt_lu_h:
2802 ; RV32IZDINXZHINX: # %bb.0:
2803 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
2804 ; RV32IZDINXZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2805 ; RV32IZDINXZHINX-NEXT: call __fixunshfdi
2806 ; RV32IZDINXZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2807 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
2808 ; RV32IZDINXZHINX-NEXT: ret
2810 ; RV64IZDINXZHINX-LABEL: fcvt_lu_h:
2811 ; RV64IZDINXZHINX: # %bb.0:
2812 ; RV64IZDINXZHINX-NEXT: fcvt.lu.h a0, a0, rtz
2813 ; RV64IZDINXZHINX-NEXT: ret
2815 ; RV32I-LABEL: fcvt_lu_h:
2817 ; RV32I-NEXT: addi sp, sp, -16
2818 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2819 ; RV32I-NEXT: slli a0, a0, 16
2820 ; RV32I-NEXT: srli a0, a0, 16
2821 ; RV32I-NEXT: call __extendhfsf2
2822 ; RV32I-NEXT: call __fixunssfdi
2823 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2824 ; RV32I-NEXT: addi sp, sp, 16
2827 ; RV64I-LABEL: fcvt_lu_h:
2829 ; RV64I-NEXT: addi sp, sp, -16
2830 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2831 ; RV64I-NEXT: slli a0, a0, 48
2832 ; RV64I-NEXT: srli a0, a0, 48
2833 ; RV64I-NEXT: call __extendhfsf2
2834 ; RV64I-NEXT: call __fixunssfdi
2835 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2836 ; RV64I-NEXT: addi sp, sp, 16
2839 ; RV32ID-ILP32-LABEL: fcvt_lu_h:
2840 ; RV32ID-ILP32: # %bb.0:
2841 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
2842 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2843 ; RV32ID-ILP32-NEXT: call __extendhfsf2
2844 ; RV32ID-ILP32-NEXT: call __fixunssfdi
2845 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2846 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
2847 ; RV32ID-ILP32-NEXT: ret
2849 ; RV64ID-LP64-LABEL: fcvt_lu_h:
2850 ; RV64ID-LP64: # %bb.0:
2851 ; RV64ID-LP64-NEXT: addi sp, sp, -16
2852 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2853 ; RV64ID-LP64-NEXT: call __extendhfsf2
2854 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
2855 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
2856 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2857 ; RV64ID-LP64-NEXT: addi sp, sp, 16
2858 ; RV64ID-LP64-NEXT: ret
2860 ; RV32ID-LABEL: fcvt_lu_h:
2862 ; RV32ID-NEXT: addi sp, sp, -16
2863 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2864 ; RV32ID-NEXT: call __extendhfsf2
2865 ; RV32ID-NEXT: call __fixunssfdi
2866 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2867 ; RV32ID-NEXT: addi sp, sp, 16
2870 ; RV64ID-LABEL: fcvt_lu_h:
2872 ; RV64ID-NEXT: addi sp, sp, -16
2873 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
2874 ; RV64ID-NEXT: call __extendhfsf2
2875 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
2876 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
2877 ; RV64ID-NEXT: addi sp, sp, 16
2880 ; CHECK32-IZFHMIN-LABEL: fcvt_lu_h:
2881 ; CHECK32-IZFHMIN: # %bb.0:
2882 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, -16
2883 ; CHECK32-IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2884 ; CHECK32-IZFHMIN-NEXT: call __fixunshfdi
2885 ; CHECK32-IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2886 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, 16
2887 ; CHECK32-IZFHMIN-NEXT: ret
2889 ; CHECK64-IZFHMIN-LABEL: fcvt_lu_h:
2890 ; CHECK64-IZFHMIN: # %bb.0:
2891 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
2892 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
2893 ; CHECK64-IZFHMIN-NEXT: ret
2895 ; CHECK32-IZHINXMIN-LABEL: fcvt_lu_h:
2896 ; CHECK32-IZHINXMIN: # %bb.0:
2897 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
2898 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2899 ; CHECK32-IZHINXMIN-NEXT: call __fixunshfdi
2900 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2901 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
2902 ; CHECK32-IZHINXMIN-NEXT: ret
2904 ; CHECK64-IZHINXMIN-LABEL: fcvt_lu_h:
2905 ; CHECK64-IZHINXMIN: # %bb.0:
2906 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
2907 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
2908 ; CHECK64-IZHINXMIN-NEXT: ret
2910 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_lu_h:
2911 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
2912 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
2913 ; CHECK32-IZDINXZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2914 ; CHECK32-IZDINXZHINXMIN-NEXT: call __fixunshfdi
2915 ; CHECK32-IZDINXZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2916 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
2917 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
2919 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_lu_h:
2920 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
2921 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
2922 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
2923 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
2924 %1 = fptoui half %a to i64
2928 define i64 @fcvt_lu_h_sat(half %a) nounwind {
2929 ; RV32IZFH-LABEL: fcvt_lu_h_sat:
2930 ; RV32IZFH: # %bb.0: # %start
2931 ; RV32IZFH-NEXT: addi sp, sp, -16
2932 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2933 ; RV32IZFH-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2934 ; RV32IZFH-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
2935 ; RV32IZFH-NEXT: lui a0, %hi(.LCPI12_0)
2936 ; RV32IZFH-NEXT: flw fa5, %lo(.LCPI12_0)(a0)
2937 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
2938 ; RV32IZFH-NEXT: flt.s a0, fa5, fa0
2939 ; RV32IZFH-NEXT: neg s0, a0
2940 ; RV32IZFH-NEXT: fmv.w.x fa5, zero
2941 ; RV32IZFH-NEXT: fle.s a0, fa5, fa0
2942 ; RV32IZFH-NEXT: neg s1, a0
2943 ; RV32IZFH-NEXT: call __fixunssfdi
2944 ; RV32IZFH-NEXT: and a0, s1, a0
2945 ; RV32IZFH-NEXT: or a0, s0, a0
2946 ; RV32IZFH-NEXT: and a1, s1, a1
2947 ; RV32IZFH-NEXT: or a1, s0, a1
2948 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2949 ; RV32IZFH-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2950 ; RV32IZFH-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
2951 ; RV32IZFH-NEXT: addi sp, sp, 16
2952 ; RV32IZFH-NEXT: ret
2954 ; RV64IZFH-LABEL: fcvt_lu_h_sat:
2955 ; RV64IZFH: # %bb.0: # %start
2956 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
2957 ; RV64IZFH-NEXT: feq.h a1, fa0, fa0
2958 ; RV64IZFH-NEXT: seqz a1, a1
2959 ; RV64IZFH-NEXT: addi a1, a1, -1
2960 ; RV64IZFH-NEXT: and a0, a1, a0
2961 ; RV64IZFH-NEXT: ret
2963 ; RV32IDZFH-LABEL: fcvt_lu_h_sat:
2964 ; RV32IDZFH: # %bb.0: # %start
2965 ; RV32IDZFH-NEXT: addi sp, sp, -16
2966 ; RV32IDZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
2967 ; RV32IDZFH-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
2968 ; RV32IDZFH-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
2969 ; RV32IDZFH-NEXT: lui a0, %hi(.LCPI12_0)
2970 ; RV32IDZFH-NEXT: flw fa5, %lo(.LCPI12_0)(a0)
2971 ; RV32IDZFH-NEXT: fcvt.s.h fa0, fa0
2972 ; RV32IDZFH-NEXT: flt.s a0, fa5, fa0
2973 ; RV32IDZFH-NEXT: neg s0, a0
2974 ; RV32IDZFH-NEXT: fmv.w.x fa5, zero
2975 ; RV32IDZFH-NEXT: fle.s a0, fa5, fa0
2976 ; RV32IDZFH-NEXT: neg s1, a0
2977 ; RV32IDZFH-NEXT: call __fixunssfdi
2978 ; RV32IDZFH-NEXT: and a0, s1, a0
2979 ; RV32IDZFH-NEXT: or a0, s0, a0
2980 ; RV32IDZFH-NEXT: and a1, s1, a1
2981 ; RV32IDZFH-NEXT: or a1, s0, a1
2982 ; RV32IDZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
2983 ; RV32IDZFH-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
2984 ; RV32IDZFH-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
2985 ; RV32IDZFH-NEXT: addi sp, sp, 16
2986 ; RV32IDZFH-NEXT: ret
2988 ; RV64IDZFH-LABEL: fcvt_lu_h_sat:
2989 ; RV64IDZFH: # %bb.0: # %start
2990 ; RV64IDZFH-NEXT: fcvt.lu.h a0, fa0, rtz
2991 ; RV64IDZFH-NEXT: feq.h a1, fa0, fa0
2992 ; RV64IDZFH-NEXT: seqz a1, a1
2993 ; RV64IDZFH-NEXT: addi a1, a1, -1
2994 ; RV64IDZFH-NEXT: and a0, a1, a0
2995 ; RV64IDZFH-NEXT: ret
2997 ; RV32IZHINX-LABEL: fcvt_lu_h_sat:
2998 ; RV32IZHINX: # %bb.0: # %start
2999 ; RV32IZHINX-NEXT: addi sp, sp, -16
3000 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3001 ; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3002 ; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3003 ; RV32IZHINX-NEXT: lui a1, %hi(.LCPI12_0)
3004 ; RV32IZHINX-NEXT: lw a1, %lo(.LCPI12_0)(a1)
3005 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
3006 ; RV32IZHINX-NEXT: flt.s a1, a1, a0
3007 ; RV32IZHINX-NEXT: neg s0, a1
3008 ; RV32IZHINX-NEXT: fle.s a1, zero, a0
3009 ; RV32IZHINX-NEXT: neg s1, a1
3010 ; RV32IZHINX-NEXT: call __fixunssfdi
3011 ; RV32IZHINX-NEXT: and a0, s1, a0
3012 ; RV32IZHINX-NEXT: or a0, s0, a0
3013 ; RV32IZHINX-NEXT: and a1, s1, a1
3014 ; RV32IZHINX-NEXT: or a1, s0, a1
3015 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3016 ; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3017 ; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3018 ; RV32IZHINX-NEXT: addi sp, sp, 16
3019 ; RV32IZHINX-NEXT: ret
3021 ; RV64IZHINX-LABEL: fcvt_lu_h_sat:
3022 ; RV64IZHINX: # %bb.0: # %start
3023 ; RV64IZHINX-NEXT: fcvt.lu.h a1, a0, rtz
3024 ; RV64IZHINX-NEXT: feq.h a0, a0, a0
3025 ; RV64IZHINX-NEXT: seqz a0, a0
3026 ; RV64IZHINX-NEXT: addi a0, a0, -1
3027 ; RV64IZHINX-NEXT: and a0, a0, a1
3028 ; RV64IZHINX-NEXT: ret
3030 ; RV32IZDINXZHINX-LABEL: fcvt_lu_h_sat:
3031 ; RV32IZDINXZHINX: # %bb.0: # %start
3032 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
3033 ; RV32IZDINXZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3034 ; RV32IZDINXZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3035 ; RV32IZDINXZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3036 ; RV32IZDINXZHINX-NEXT: lui a1, %hi(.LCPI12_0)
3037 ; RV32IZDINXZHINX-NEXT: lw a1, %lo(.LCPI12_0)(a1)
3038 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
3039 ; RV32IZDINXZHINX-NEXT: flt.s a1, a1, a0
3040 ; RV32IZDINXZHINX-NEXT: neg s0, a1
3041 ; RV32IZDINXZHINX-NEXT: fle.s a1, zero, a0
3042 ; RV32IZDINXZHINX-NEXT: neg s1, a1
3043 ; RV32IZDINXZHINX-NEXT: call __fixunssfdi
3044 ; RV32IZDINXZHINX-NEXT: and a0, s1, a0
3045 ; RV32IZDINXZHINX-NEXT: or a0, s0, a0
3046 ; RV32IZDINXZHINX-NEXT: and a1, s1, a1
3047 ; RV32IZDINXZHINX-NEXT: or a1, s0, a1
3048 ; RV32IZDINXZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3049 ; RV32IZDINXZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3050 ; RV32IZDINXZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3051 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
3052 ; RV32IZDINXZHINX-NEXT: ret
3054 ; RV64IZDINXZHINX-LABEL: fcvt_lu_h_sat:
3055 ; RV64IZDINXZHINX: # %bb.0: # %start
3056 ; RV64IZDINXZHINX-NEXT: fcvt.lu.h a1, a0, rtz
3057 ; RV64IZDINXZHINX-NEXT: feq.h a0, a0, a0
3058 ; RV64IZDINXZHINX-NEXT: seqz a0, a0
3059 ; RV64IZDINXZHINX-NEXT: addi a0, a0, -1
3060 ; RV64IZDINXZHINX-NEXT: and a0, a0, a1
3061 ; RV64IZDINXZHINX-NEXT: ret
3063 ; RV32I-LABEL: fcvt_lu_h_sat:
3064 ; RV32I: # %bb.0: # %start
3065 ; RV32I-NEXT: addi sp, sp, -16
3066 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3067 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3068 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3069 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
3070 ; RV32I-NEXT: call __extendhfsf2
3071 ; RV32I-NEXT: mv s0, a0
3072 ; RV32I-NEXT: lui a1, 391168
3073 ; RV32I-NEXT: addi a1, a1, -1
3074 ; RV32I-NEXT: call __gtsf2
3075 ; RV32I-NEXT: sgtz a0, a0
3076 ; RV32I-NEXT: neg s1, a0
3077 ; RV32I-NEXT: mv a0, s0
3078 ; RV32I-NEXT: li a1, 0
3079 ; RV32I-NEXT: call __gesf2
3080 ; RV32I-NEXT: slti a0, a0, 0
3081 ; RV32I-NEXT: addi s2, a0, -1
3082 ; RV32I-NEXT: mv a0, s0
3083 ; RV32I-NEXT: call __fixunssfdi
3084 ; RV32I-NEXT: and a0, s2, a0
3085 ; RV32I-NEXT: or a0, s1, a0
3086 ; RV32I-NEXT: and a1, s2, a1
3087 ; RV32I-NEXT: or a1, s1, a1
3088 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3089 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3090 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3091 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
3092 ; RV32I-NEXT: addi sp, sp, 16
3095 ; RV64I-LABEL: fcvt_lu_h_sat:
3096 ; RV64I: # %bb.0: # %start
3097 ; RV64I-NEXT: addi sp, sp, -32
3098 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
3099 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
3100 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
3101 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
3102 ; RV64I-NEXT: slli a0, a0, 48
3103 ; RV64I-NEXT: srli a0, a0, 48
3104 ; RV64I-NEXT: call __extendhfsf2
3105 ; RV64I-NEXT: mv s0, a0
3106 ; RV64I-NEXT: lui a1, 391168
3107 ; RV64I-NEXT: addiw a1, a1, -1
3108 ; RV64I-NEXT: call __gtsf2
3109 ; RV64I-NEXT: sgtz a0, a0
3110 ; RV64I-NEXT: neg s1, a0
3111 ; RV64I-NEXT: mv a0, s0
3112 ; RV64I-NEXT: li a1, 0
3113 ; RV64I-NEXT: call __gesf2
3114 ; RV64I-NEXT: slti a0, a0, 0
3115 ; RV64I-NEXT: addi s2, a0, -1
3116 ; RV64I-NEXT: mv a0, s0
3117 ; RV64I-NEXT: call __fixunssfdi
3118 ; RV64I-NEXT: and a0, s2, a0
3119 ; RV64I-NEXT: or a0, s1, a0
3120 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
3121 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
3122 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
3123 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
3124 ; RV64I-NEXT: addi sp, sp, 32
3127 ; RV32ID-ILP32-LABEL: fcvt_lu_h_sat:
3128 ; RV32ID-ILP32: # %bb.0: # %start
3129 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
3130 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3131 ; RV32ID-ILP32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3132 ; RV32ID-ILP32-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3133 ; RV32ID-ILP32-NEXT: call __extendhfsf2
3134 ; RV32ID-ILP32-NEXT: lui a1, %hi(.LCPI12_0)
3135 ; RV32ID-ILP32-NEXT: flw fa5, %lo(.LCPI12_0)(a1)
3136 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a0
3137 ; RV32ID-ILP32-NEXT: flt.s a1, fa5, fa4
3138 ; RV32ID-ILP32-NEXT: neg s0, a1
3139 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, zero
3140 ; RV32ID-ILP32-NEXT: fle.s a1, fa5, fa4
3141 ; RV32ID-ILP32-NEXT: neg s1, a1
3142 ; RV32ID-ILP32-NEXT: call __fixunssfdi
3143 ; RV32ID-ILP32-NEXT: and a0, s1, a0
3144 ; RV32ID-ILP32-NEXT: or a0, s0, a0
3145 ; RV32ID-ILP32-NEXT: and a1, s1, a1
3146 ; RV32ID-ILP32-NEXT: or a1, s0, a1
3147 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3148 ; RV32ID-ILP32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3149 ; RV32ID-ILP32-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3150 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
3151 ; RV32ID-ILP32-NEXT: ret
3153 ; RV64ID-LP64-LABEL: fcvt_lu_h_sat:
3154 ; RV64ID-LP64: # %bb.0: # %start
3155 ; RV64ID-LP64-NEXT: addi sp, sp, -16
3156 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3157 ; RV64ID-LP64-NEXT: call __extendhfsf2
3158 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
3159 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
3160 ; RV64ID-LP64-NEXT: feq.s a1, fa5, fa5
3161 ; RV64ID-LP64-NEXT: seqz a1, a1
3162 ; RV64ID-LP64-NEXT: addi a1, a1, -1
3163 ; RV64ID-LP64-NEXT: and a0, a1, a0
3164 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3165 ; RV64ID-LP64-NEXT: addi sp, sp, 16
3166 ; RV64ID-LP64-NEXT: ret
3168 ; RV32ID-LABEL: fcvt_lu_h_sat:
3169 ; RV32ID: # %bb.0: # %start
3170 ; RV32ID-NEXT: addi sp, sp, -16
3171 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3172 ; RV32ID-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3173 ; RV32ID-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3174 ; RV32ID-NEXT: call __extendhfsf2
3175 ; RV32ID-NEXT: lui a0, %hi(.LCPI12_0)
3176 ; RV32ID-NEXT: flw fa5, %lo(.LCPI12_0)(a0)
3177 ; RV32ID-NEXT: flt.s a0, fa5, fa0
3178 ; RV32ID-NEXT: neg s0, a0
3179 ; RV32ID-NEXT: fmv.w.x fa5, zero
3180 ; RV32ID-NEXT: fle.s a0, fa5, fa0
3181 ; RV32ID-NEXT: neg s1, a0
3182 ; RV32ID-NEXT: call __fixunssfdi
3183 ; RV32ID-NEXT: and a0, s1, a0
3184 ; RV32ID-NEXT: or a0, s0, a0
3185 ; RV32ID-NEXT: and a1, s1, a1
3186 ; RV32ID-NEXT: or a1, s0, a1
3187 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3188 ; RV32ID-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3189 ; RV32ID-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3190 ; RV32ID-NEXT: addi sp, sp, 16
3193 ; RV64ID-LABEL: fcvt_lu_h_sat:
3194 ; RV64ID: # %bb.0: # %start
3195 ; RV64ID-NEXT: addi sp, sp, -16
3196 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3197 ; RV64ID-NEXT: call __extendhfsf2
3198 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
3199 ; RV64ID-NEXT: feq.s a1, fa0, fa0
3200 ; RV64ID-NEXT: seqz a1, a1
3201 ; RV64ID-NEXT: addi a1, a1, -1
3202 ; RV64ID-NEXT: and a0, a1, a0
3203 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3204 ; RV64ID-NEXT: addi sp, sp, 16
3207 ; CHECK32-IZFHMIN-LABEL: fcvt_lu_h_sat:
3208 ; CHECK32-IZFHMIN: # %bb.0: # %start
3209 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, -16
3210 ; CHECK32-IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3211 ; CHECK32-IZFHMIN-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3212 ; CHECK32-IZFHMIN-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3213 ; CHECK32-IZFHMIN-NEXT: lui a0, %hi(.LCPI12_0)
3214 ; CHECK32-IZFHMIN-NEXT: flw fa5, %lo(.LCPI12_0)(a0)
3215 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa0, fa0
3216 ; CHECK32-IZFHMIN-NEXT: flt.s a0, fa5, fa0
3217 ; CHECK32-IZFHMIN-NEXT: neg s0, a0
3218 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa5, zero
3219 ; CHECK32-IZFHMIN-NEXT: fle.s a0, fa5, fa0
3220 ; CHECK32-IZFHMIN-NEXT: neg s1, a0
3221 ; CHECK32-IZFHMIN-NEXT: call __fixunssfdi
3222 ; CHECK32-IZFHMIN-NEXT: and a0, s1, a0
3223 ; CHECK32-IZFHMIN-NEXT: or a0, s0, a0
3224 ; CHECK32-IZFHMIN-NEXT: and a1, s1, a1
3225 ; CHECK32-IZFHMIN-NEXT: or a1, s0, a1
3226 ; CHECK32-IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3227 ; CHECK32-IZFHMIN-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3228 ; CHECK32-IZFHMIN-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3229 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, 16
3230 ; CHECK32-IZFHMIN-NEXT: ret
3232 ; CHECK64-IZFHMIN-LABEL: fcvt_lu_h_sat:
3233 ; CHECK64-IZFHMIN: # %bb.0: # %start
3234 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
3235 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
3236 ; CHECK64-IZFHMIN-NEXT: feq.s a1, fa5, fa5
3237 ; CHECK64-IZFHMIN-NEXT: seqz a1, a1
3238 ; CHECK64-IZFHMIN-NEXT: addi a1, a1, -1
3239 ; CHECK64-IZFHMIN-NEXT: and a0, a1, a0
3240 ; CHECK64-IZFHMIN-NEXT: ret
3242 ; CHECK32-IZHINXMIN-LABEL: fcvt_lu_h_sat:
3243 ; CHECK32-IZHINXMIN: # %bb.0: # %start
3244 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
3245 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3246 ; CHECK32-IZHINXMIN-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3247 ; CHECK32-IZHINXMIN-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3248 ; CHECK32-IZHINXMIN-NEXT: lui a1, %hi(.LCPI12_0)
3249 ; CHECK32-IZHINXMIN-NEXT: lw a1, %lo(.LCPI12_0)(a1)
3250 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
3251 ; CHECK32-IZHINXMIN-NEXT: flt.s a1, a1, a0
3252 ; CHECK32-IZHINXMIN-NEXT: neg s0, a1
3253 ; CHECK32-IZHINXMIN-NEXT: fle.s a1, zero, a0
3254 ; CHECK32-IZHINXMIN-NEXT: neg s1, a1
3255 ; CHECK32-IZHINXMIN-NEXT: call __fixunssfdi
3256 ; CHECK32-IZHINXMIN-NEXT: and a0, s1, a0
3257 ; CHECK32-IZHINXMIN-NEXT: or a0, s0, a0
3258 ; CHECK32-IZHINXMIN-NEXT: and a1, s1, a1
3259 ; CHECK32-IZHINXMIN-NEXT: or a1, s0, a1
3260 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3261 ; CHECK32-IZHINXMIN-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3262 ; CHECK32-IZHINXMIN-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3263 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
3264 ; CHECK32-IZHINXMIN-NEXT: ret
3266 ; CHECK64-IZHINXMIN-LABEL: fcvt_lu_h_sat:
3267 ; CHECK64-IZHINXMIN: # %bb.0: # %start
3268 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
3269 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a1, a0, rtz
3270 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
3271 ; CHECK64-IZHINXMIN-NEXT: seqz a0, a0
3272 ; CHECK64-IZHINXMIN-NEXT: addi a0, a0, -1
3273 ; CHECK64-IZHINXMIN-NEXT: and a0, a0, a1
3274 ; CHECK64-IZHINXMIN-NEXT: ret
3276 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_lu_h_sat:
3277 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
3278 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
3279 ; CHECK32-IZDINXZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3280 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
3281 ; CHECK32-IZDINXZHINXMIN-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
3282 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a1, %hi(.LCPI12_0)
3283 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a1, %lo(.LCPI12_0)(a1)
3284 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
3285 ; CHECK32-IZDINXZHINXMIN-NEXT: flt.s a1, a1, a0
3286 ; CHECK32-IZDINXZHINXMIN-NEXT: neg s0, a1
3287 ; CHECK32-IZDINXZHINXMIN-NEXT: fle.s a1, zero, a0
3288 ; CHECK32-IZDINXZHINXMIN-NEXT: neg s1, a1
3289 ; CHECK32-IZDINXZHINXMIN-NEXT: call __fixunssfdi
3290 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, s1, a0
3291 ; CHECK32-IZDINXZHINXMIN-NEXT: or a0, s0, a0
3292 ; CHECK32-IZDINXZHINXMIN-NEXT: and a1, s1, a1
3293 ; CHECK32-IZDINXZHINXMIN-NEXT: or a1, s0, a1
3294 ; CHECK32-IZDINXZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3295 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
3296 ; CHECK32-IZDINXZHINXMIN-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
3297 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
3298 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
3300 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_lu_h_sat:
3301 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
3302 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
3303 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a1, a0, rtz
3304 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
3305 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a0, a0
3306 ; CHECK64-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
3307 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a0, a1
3308 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
3310 %0 = tail call i64 @llvm.fptoui.sat.i64.f16(half %a)
3313 declare i64 @llvm.fptoui.sat.i64.f16(half)
3315 define half @fcvt_h_si(i16 %a) nounwind {
3316 ; RV32IZFH-LABEL: fcvt_h_si:
3317 ; RV32IZFH: # %bb.0:
3318 ; RV32IZFH-NEXT: slli a0, a0, 16
3319 ; RV32IZFH-NEXT: srai a0, a0, 16
3320 ; RV32IZFH-NEXT: fcvt.h.w fa0, a0
3321 ; RV32IZFH-NEXT: ret
3323 ; RV64IZFH-LABEL: fcvt_h_si:
3324 ; RV64IZFH: # %bb.0:
3325 ; RV64IZFH-NEXT: slli a0, a0, 48
3326 ; RV64IZFH-NEXT: srai a0, a0, 48
3327 ; RV64IZFH-NEXT: fcvt.h.w fa0, a0
3328 ; RV64IZFH-NEXT: ret
3330 ; RV32IDZFH-LABEL: fcvt_h_si:
3331 ; RV32IDZFH: # %bb.0:
3332 ; RV32IDZFH-NEXT: slli a0, a0, 16
3333 ; RV32IDZFH-NEXT: srai a0, a0, 16
3334 ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0
3335 ; RV32IDZFH-NEXT: ret
3337 ; RV64IDZFH-LABEL: fcvt_h_si:
3338 ; RV64IDZFH: # %bb.0:
3339 ; RV64IDZFH-NEXT: slli a0, a0, 48
3340 ; RV64IDZFH-NEXT: srai a0, a0, 48
3341 ; RV64IDZFH-NEXT: fcvt.h.w fa0, a0
3342 ; RV64IDZFH-NEXT: ret
3344 ; RV32IZHINX-LABEL: fcvt_h_si:
3345 ; RV32IZHINX: # %bb.0:
3346 ; RV32IZHINX-NEXT: slli a0, a0, 16
3347 ; RV32IZHINX-NEXT: srai a0, a0, 16
3348 ; RV32IZHINX-NEXT: fcvt.h.w a0, a0
3349 ; RV32IZHINX-NEXT: ret
3351 ; RV64IZHINX-LABEL: fcvt_h_si:
3352 ; RV64IZHINX: # %bb.0:
3353 ; RV64IZHINX-NEXT: slli a0, a0, 48
3354 ; RV64IZHINX-NEXT: srai a0, a0, 48
3355 ; RV64IZHINX-NEXT: fcvt.h.w a0, a0
3356 ; RV64IZHINX-NEXT: ret
3358 ; RV32IZDINXZHINX-LABEL: fcvt_h_si:
3359 ; RV32IZDINXZHINX: # %bb.0:
3360 ; RV32IZDINXZHINX-NEXT: slli a0, a0, 16
3361 ; RV32IZDINXZHINX-NEXT: srai a0, a0, 16
3362 ; RV32IZDINXZHINX-NEXT: fcvt.h.w a0, a0
3363 ; RV32IZDINXZHINX-NEXT: ret
3365 ; RV64IZDINXZHINX-LABEL: fcvt_h_si:
3366 ; RV64IZDINXZHINX: # %bb.0:
3367 ; RV64IZDINXZHINX-NEXT: slli a0, a0, 48
3368 ; RV64IZDINXZHINX-NEXT: srai a0, a0, 48
3369 ; RV64IZDINXZHINX-NEXT: fcvt.h.w a0, a0
3370 ; RV64IZDINXZHINX-NEXT: ret
3372 ; RV32I-LABEL: fcvt_h_si:
3374 ; RV32I-NEXT: addi sp, sp, -16
3375 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3376 ; RV32I-NEXT: slli a0, a0, 16
3377 ; RV32I-NEXT: srai a0, a0, 16
3378 ; RV32I-NEXT: call __floatsisf
3379 ; RV32I-NEXT: call __truncsfhf2
3380 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3381 ; RV32I-NEXT: addi sp, sp, 16
3384 ; RV64I-LABEL: fcvt_h_si:
3386 ; RV64I-NEXT: addi sp, sp, -16
3387 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3388 ; RV64I-NEXT: slli a0, a0, 48
3389 ; RV64I-NEXT: srai a0, a0, 48
3390 ; RV64I-NEXT: call __floatsisf
3391 ; RV64I-NEXT: call __truncsfhf2
3392 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3393 ; RV64I-NEXT: addi sp, sp, 16
3396 ; RV32ID-ILP32-LABEL: fcvt_h_si:
3397 ; RV32ID-ILP32: # %bb.0:
3398 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
3399 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3400 ; RV32ID-ILP32-NEXT: slli a0, a0, 16
3401 ; RV32ID-ILP32-NEXT: srai a0, a0, 16
3402 ; RV32ID-ILP32-NEXT: fcvt.s.w fa5, a0
3403 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
3404 ; RV32ID-ILP32-NEXT: call __truncsfhf2
3405 ; RV32ID-ILP32-NEXT: lui a1, 1048560
3406 ; RV32ID-ILP32-NEXT: or a0, a0, a1
3407 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3408 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
3409 ; RV32ID-ILP32-NEXT: ret
3411 ; RV64ID-LP64-LABEL: fcvt_h_si:
3412 ; RV64ID-LP64: # %bb.0:
3413 ; RV64ID-LP64-NEXT: addi sp, sp, -16
3414 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3415 ; RV64ID-LP64-NEXT: slli a0, a0, 48
3416 ; RV64ID-LP64-NEXT: srai a0, a0, 48
3417 ; RV64ID-LP64-NEXT: fcvt.s.w fa5, a0
3418 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
3419 ; RV64ID-LP64-NEXT: call __truncsfhf2
3420 ; RV64ID-LP64-NEXT: lui a1, 1048560
3421 ; RV64ID-LP64-NEXT: or a0, a0, a1
3422 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3423 ; RV64ID-LP64-NEXT: addi sp, sp, 16
3424 ; RV64ID-LP64-NEXT: ret
3426 ; RV32ID-LABEL: fcvt_h_si:
3428 ; RV32ID-NEXT: addi sp, sp, -16
3429 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3430 ; RV32ID-NEXT: slli a0, a0, 16
3431 ; RV32ID-NEXT: srai a0, a0, 16
3432 ; RV32ID-NEXT: fcvt.s.w fa0, a0
3433 ; RV32ID-NEXT: call __truncsfhf2
3434 ; RV32ID-NEXT: fmv.x.w a0, fa0
3435 ; RV32ID-NEXT: lui a1, 1048560
3436 ; RV32ID-NEXT: or a0, a0, a1
3437 ; RV32ID-NEXT: fmv.w.x fa0, a0
3438 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3439 ; RV32ID-NEXT: addi sp, sp, 16
3442 ; RV64ID-LABEL: fcvt_h_si:
3444 ; RV64ID-NEXT: addi sp, sp, -16
3445 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3446 ; RV64ID-NEXT: slli a0, a0, 48
3447 ; RV64ID-NEXT: srai a0, a0, 48
3448 ; RV64ID-NEXT: fcvt.s.w fa0, a0
3449 ; RV64ID-NEXT: call __truncsfhf2
3450 ; RV64ID-NEXT: fmv.x.w a0, fa0
3451 ; RV64ID-NEXT: lui a1, 1048560
3452 ; RV64ID-NEXT: or a0, a0, a1
3453 ; RV64ID-NEXT: fmv.w.x fa0, a0
3454 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3455 ; RV64ID-NEXT: addi sp, sp, 16
3458 ; CHECK32-IZFHMIN-LABEL: fcvt_h_si:
3459 ; CHECK32-IZFHMIN: # %bb.0:
3460 ; CHECK32-IZFHMIN-NEXT: slli a0, a0, 16
3461 ; CHECK32-IZFHMIN-NEXT: srai a0, a0, 16
3462 ; CHECK32-IZFHMIN-NEXT: fcvt.s.w fa5, a0
3463 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3464 ; CHECK32-IZFHMIN-NEXT: ret
3466 ; CHECK64-IZFHMIN-LABEL: fcvt_h_si:
3467 ; CHECK64-IZFHMIN: # %bb.0:
3468 ; CHECK64-IZFHMIN-NEXT: slli a0, a0, 48
3469 ; CHECK64-IZFHMIN-NEXT: srai a0, a0, 48
3470 ; CHECK64-IZFHMIN-NEXT: fcvt.s.l fa5, a0
3471 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3472 ; CHECK64-IZFHMIN-NEXT: ret
3474 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_si:
3475 ; CHECK32-IZHINXMIN: # %bb.0:
3476 ; CHECK32-IZHINXMIN-NEXT: slli a0, a0, 16
3477 ; CHECK32-IZHINXMIN-NEXT: srai a0, a0, 16
3478 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.w a0, a0
3479 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3480 ; CHECK32-IZHINXMIN-NEXT: ret
3482 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_si:
3483 ; CHECK64-IZHINXMIN: # %bb.0:
3484 ; CHECK64-IZHINXMIN-NEXT: slli a0, a0, 48
3485 ; CHECK64-IZHINXMIN-NEXT: srai a0, a0, 48
3486 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.l a0, a0
3487 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3488 ; CHECK64-IZHINXMIN-NEXT: ret
3490 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_si:
3491 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
3492 ; CHECK32-IZDINXZHINXMIN-NEXT: slli a0, a0, 16
3493 ; CHECK32-IZDINXZHINXMIN-NEXT: srai a0, a0, 16
3494 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.w a0, a0
3495 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3496 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
3498 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_si:
3499 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
3500 ; CHECK64-IZDINXZHINXMIN-NEXT: slli a0, a0, 48
3501 ; CHECK64-IZDINXZHINXMIN-NEXT: srai a0, a0, 48
3502 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.l a0, a0
3503 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3504 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
3505 %1 = sitofp i16 %a to half
3509 define half @fcvt_h_si_signext(i16 signext %a) nounwind {
3510 ; CHECKIZFH-LABEL: fcvt_h_si_signext:
3511 ; CHECKIZFH: # %bb.0:
3512 ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0
3513 ; CHECKIZFH-NEXT: ret
3515 ; RV32IDZFH-LABEL: fcvt_h_si_signext:
3516 ; RV32IDZFH: # %bb.0:
3517 ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0
3518 ; RV32IDZFH-NEXT: ret
3520 ; RV64IDZFH-LABEL: fcvt_h_si_signext:
3521 ; RV64IDZFH: # %bb.0:
3522 ; RV64IDZFH-NEXT: fcvt.h.w fa0, a0
3523 ; RV64IDZFH-NEXT: ret
3525 ; CHECKIZHINX-LABEL: fcvt_h_si_signext:
3526 ; CHECKIZHINX: # %bb.0:
3527 ; CHECKIZHINX-NEXT: fcvt.h.w a0, a0
3528 ; CHECKIZHINX-NEXT: ret
3530 ; CHECKIZDINXZHINX-LABEL: fcvt_h_si_signext:
3531 ; CHECKIZDINXZHINX: # %bb.0:
3532 ; CHECKIZDINXZHINX-NEXT: fcvt.h.w a0, a0
3533 ; CHECKIZDINXZHINX-NEXT: ret
3535 ; RV32I-LABEL: fcvt_h_si_signext:
3537 ; RV32I-NEXT: addi sp, sp, -16
3538 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3539 ; RV32I-NEXT: call __floatsisf
3540 ; RV32I-NEXT: call __truncsfhf2
3541 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3542 ; RV32I-NEXT: addi sp, sp, 16
3545 ; RV64I-LABEL: fcvt_h_si_signext:
3547 ; RV64I-NEXT: addi sp, sp, -16
3548 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3549 ; RV64I-NEXT: call __floatsisf
3550 ; RV64I-NEXT: call __truncsfhf2
3551 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3552 ; RV64I-NEXT: addi sp, sp, 16
3555 ; RV32ID-ILP32-LABEL: fcvt_h_si_signext:
3556 ; RV32ID-ILP32: # %bb.0:
3557 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
3558 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3559 ; RV32ID-ILP32-NEXT: fcvt.s.w fa5, a0
3560 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
3561 ; RV32ID-ILP32-NEXT: call __truncsfhf2
3562 ; RV32ID-ILP32-NEXT: lui a1, 1048560
3563 ; RV32ID-ILP32-NEXT: or a0, a0, a1
3564 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3565 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
3566 ; RV32ID-ILP32-NEXT: ret
3568 ; RV64ID-LP64-LABEL: fcvt_h_si_signext:
3569 ; RV64ID-LP64: # %bb.0:
3570 ; RV64ID-LP64-NEXT: addi sp, sp, -16
3571 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3572 ; RV64ID-LP64-NEXT: fcvt.s.w fa5, a0
3573 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
3574 ; RV64ID-LP64-NEXT: call __truncsfhf2
3575 ; RV64ID-LP64-NEXT: lui a1, 1048560
3576 ; RV64ID-LP64-NEXT: or a0, a0, a1
3577 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3578 ; RV64ID-LP64-NEXT: addi sp, sp, 16
3579 ; RV64ID-LP64-NEXT: ret
3581 ; RV32ID-LABEL: fcvt_h_si_signext:
3583 ; RV32ID-NEXT: addi sp, sp, -16
3584 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3585 ; RV32ID-NEXT: fcvt.s.w fa0, a0
3586 ; RV32ID-NEXT: call __truncsfhf2
3587 ; RV32ID-NEXT: fmv.x.w a0, fa0
3588 ; RV32ID-NEXT: lui a1, 1048560
3589 ; RV32ID-NEXT: or a0, a0, a1
3590 ; RV32ID-NEXT: fmv.w.x fa0, a0
3591 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3592 ; RV32ID-NEXT: addi sp, sp, 16
3595 ; RV64ID-LABEL: fcvt_h_si_signext:
3597 ; RV64ID-NEXT: addi sp, sp, -16
3598 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3599 ; RV64ID-NEXT: fcvt.s.w fa0, a0
3600 ; RV64ID-NEXT: call __truncsfhf2
3601 ; RV64ID-NEXT: fmv.x.w a0, fa0
3602 ; RV64ID-NEXT: lui a1, 1048560
3603 ; RV64ID-NEXT: or a0, a0, a1
3604 ; RV64ID-NEXT: fmv.w.x fa0, a0
3605 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3606 ; RV64ID-NEXT: addi sp, sp, 16
3609 ; CHECK32-IZFHMIN-LABEL: fcvt_h_si_signext:
3610 ; CHECK32-IZFHMIN: # %bb.0:
3611 ; CHECK32-IZFHMIN-NEXT: fcvt.s.w fa5, a0
3612 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3613 ; CHECK32-IZFHMIN-NEXT: ret
3615 ; CHECK64-IZFHMIN-LABEL: fcvt_h_si_signext:
3616 ; CHECK64-IZFHMIN: # %bb.0:
3617 ; CHECK64-IZFHMIN-NEXT: fcvt.s.l fa5, a0
3618 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3619 ; CHECK64-IZFHMIN-NEXT: ret
3621 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_si_signext:
3622 ; CHECK32-IZHINXMIN: # %bb.0:
3623 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.w a0, a0
3624 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3625 ; CHECK32-IZHINXMIN-NEXT: ret
3627 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_si_signext:
3628 ; CHECK64-IZHINXMIN: # %bb.0:
3629 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.l a0, a0
3630 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3631 ; CHECK64-IZHINXMIN-NEXT: ret
3633 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_si_signext:
3634 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
3635 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.w a0, a0
3636 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3637 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
3639 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_si_signext:
3640 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
3641 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.l a0, a0
3642 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3643 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
3644 %1 = sitofp i16 %a to half
3648 define half @fcvt_h_ui(i16 %a) nounwind {
3649 ; RV32IZFH-LABEL: fcvt_h_ui:
3650 ; RV32IZFH: # %bb.0:
3651 ; RV32IZFH-NEXT: slli a0, a0, 16
3652 ; RV32IZFH-NEXT: srli a0, a0, 16
3653 ; RV32IZFH-NEXT: fcvt.h.wu fa0, a0
3654 ; RV32IZFH-NEXT: ret
3656 ; RV64IZFH-LABEL: fcvt_h_ui:
3657 ; RV64IZFH: # %bb.0:
3658 ; RV64IZFH-NEXT: slli a0, a0, 48
3659 ; RV64IZFH-NEXT: srli a0, a0, 48
3660 ; RV64IZFH-NEXT: fcvt.h.wu fa0, a0
3661 ; RV64IZFH-NEXT: ret
3663 ; RV32IDZFH-LABEL: fcvt_h_ui:
3664 ; RV32IDZFH: # %bb.0:
3665 ; RV32IDZFH-NEXT: slli a0, a0, 16
3666 ; RV32IDZFH-NEXT: srli a0, a0, 16
3667 ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0
3668 ; RV32IDZFH-NEXT: ret
3670 ; RV64IDZFH-LABEL: fcvt_h_ui:
3671 ; RV64IDZFH: # %bb.0:
3672 ; RV64IDZFH-NEXT: slli a0, a0, 48
3673 ; RV64IDZFH-NEXT: srli a0, a0, 48
3674 ; RV64IDZFH-NEXT: fcvt.h.wu fa0, a0
3675 ; RV64IDZFH-NEXT: ret
3677 ; RV32IZHINX-LABEL: fcvt_h_ui:
3678 ; RV32IZHINX: # %bb.0:
3679 ; RV32IZHINX-NEXT: slli a0, a0, 16
3680 ; RV32IZHINX-NEXT: srli a0, a0, 16
3681 ; RV32IZHINX-NEXT: fcvt.h.wu a0, a0
3682 ; RV32IZHINX-NEXT: ret
3684 ; RV64IZHINX-LABEL: fcvt_h_ui:
3685 ; RV64IZHINX: # %bb.0:
3686 ; RV64IZHINX-NEXT: slli a0, a0, 48
3687 ; RV64IZHINX-NEXT: srli a0, a0, 48
3688 ; RV64IZHINX-NEXT: fcvt.h.wu a0, a0
3689 ; RV64IZHINX-NEXT: ret
3691 ; RV32IZDINXZHINX-LABEL: fcvt_h_ui:
3692 ; RV32IZDINXZHINX: # %bb.0:
3693 ; RV32IZDINXZHINX-NEXT: slli a0, a0, 16
3694 ; RV32IZDINXZHINX-NEXT: srli a0, a0, 16
3695 ; RV32IZDINXZHINX-NEXT: fcvt.h.wu a0, a0
3696 ; RV32IZDINXZHINX-NEXT: ret
3698 ; RV64IZDINXZHINX-LABEL: fcvt_h_ui:
3699 ; RV64IZDINXZHINX: # %bb.0:
3700 ; RV64IZDINXZHINX-NEXT: slli a0, a0, 48
3701 ; RV64IZDINXZHINX-NEXT: srli a0, a0, 48
3702 ; RV64IZDINXZHINX-NEXT: fcvt.h.wu a0, a0
3703 ; RV64IZDINXZHINX-NEXT: ret
3705 ; RV32I-LABEL: fcvt_h_ui:
3707 ; RV32I-NEXT: addi sp, sp, -16
3708 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3709 ; RV32I-NEXT: slli a0, a0, 16
3710 ; RV32I-NEXT: srli a0, a0, 16
3711 ; RV32I-NEXT: call __floatunsisf
3712 ; RV32I-NEXT: call __truncsfhf2
3713 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3714 ; RV32I-NEXT: addi sp, sp, 16
3717 ; RV64I-LABEL: fcvt_h_ui:
3719 ; RV64I-NEXT: addi sp, sp, -16
3720 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3721 ; RV64I-NEXT: slli a0, a0, 48
3722 ; RV64I-NEXT: srli a0, a0, 48
3723 ; RV64I-NEXT: call __floatunsisf
3724 ; RV64I-NEXT: call __truncsfhf2
3725 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3726 ; RV64I-NEXT: addi sp, sp, 16
3729 ; RV32ID-ILP32-LABEL: fcvt_h_ui:
3730 ; RV32ID-ILP32: # %bb.0:
3731 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
3732 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3733 ; RV32ID-ILP32-NEXT: slli a0, a0, 16
3734 ; RV32ID-ILP32-NEXT: srli a0, a0, 16
3735 ; RV32ID-ILP32-NEXT: fcvt.s.wu fa5, a0
3736 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
3737 ; RV32ID-ILP32-NEXT: call __truncsfhf2
3738 ; RV32ID-ILP32-NEXT: lui a1, 1048560
3739 ; RV32ID-ILP32-NEXT: or a0, a0, a1
3740 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3741 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
3742 ; RV32ID-ILP32-NEXT: ret
3744 ; RV64ID-LP64-LABEL: fcvt_h_ui:
3745 ; RV64ID-LP64: # %bb.0:
3746 ; RV64ID-LP64-NEXT: addi sp, sp, -16
3747 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3748 ; RV64ID-LP64-NEXT: slli a0, a0, 48
3749 ; RV64ID-LP64-NEXT: srli a0, a0, 48
3750 ; RV64ID-LP64-NEXT: fcvt.s.wu fa5, a0
3751 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
3752 ; RV64ID-LP64-NEXT: call __truncsfhf2
3753 ; RV64ID-LP64-NEXT: lui a1, 1048560
3754 ; RV64ID-LP64-NEXT: or a0, a0, a1
3755 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3756 ; RV64ID-LP64-NEXT: addi sp, sp, 16
3757 ; RV64ID-LP64-NEXT: ret
3759 ; RV32ID-LABEL: fcvt_h_ui:
3761 ; RV32ID-NEXT: addi sp, sp, -16
3762 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3763 ; RV32ID-NEXT: slli a0, a0, 16
3764 ; RV32ID-NEXT: srli a0, a0, 16
3765 ; RV32ID-NEXT: fcvt.s.wu fa0, a0
3766 ; RV32ID-NEXT: call __truncsfhf2
3767 ; RV32ID-NEXT: fmv.x.w a0, fa0
3768 ; RV32ID-NEXT: lui a1, 1048560
3769 ; RV32ID-NEXT: or a0, a0, a1
3770 ; RV32ID-NEXT: fmv.w.x fa0, a0
3771 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3772 ; RV32ID-NEXT: addi sp, sp, 16
3775 ; RV64ID-LABEL: fcvt_h_ui:
3777 ; RV64ID-NEXT: addi sp, sp, -16
3778 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3779 ; RV64ID-NEXT: slli a0, a0, 48
3780 ; RV64ID-NEXT: srli a0, a0, 48
3781 ; RV64ID-NEXT: fcvt.s.wu fa0, a0
3782 ; RV64ID-NEXT: call __truncsfhf2
3783 ; RV64ID-NEXT: fmv.x.w a0, fa0
3784 ; RV64ID-NEXT: lui a1, 1048560
3785 ; RV64ID-NEXT: or a0, a0, a1
3786 ; RV64ID-NEXT: fmv.w.x fa0, a0
3787 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3788 ; RV64ID-NEXT: addi sp, sp, 16
3791 ; CHECK32-IZFHMIN-LABEL: fcvt_h_ui:
3792 ; CHECK32-IZFHMIN: # %bb.0:
3793 ; CHECK32-IZFHMIN-NEXT: slli a0, a0, 16
3794 ; CHECK32-IZFHMIN-NEXT: srli a0, a0, 16
3795 ; CHECK32-IZFHMIN-NEXT: fcvt.s.wu fa5, a0
3796 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3797 ; CHECK32-IZFHMIN-NEXT: ret
3799 ; CHECK64-IZFHMIN-LABEL: fcvt_h_ui:
3800 ; CHECK64-IZFHMIN: # %bb.0:
3801 ; CHECK64-IZFHMIN-NEXT: slli a0, a0, 48
3802 ; CHECK64-IZFHMIN-NEXT: srli a0, a0, 48
3803 ; CHECK64-IZFHMIN-NEXT: fcvt.s.lu fa5, a0
3804 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3805 ; CHECK64-IZFHMIN-NEXT: ret
3807 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_ui:
3808 ; CHECK32-IZHINXMIN: # %bb.0:
3809 ; CHECK32-IZHINXMIN-NEXT: slli a0, a0, 16
3810 ; CHECK32-IZHINXMIN-NEXT: srli a0, a0, 16
3811 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.wu a0, a0
3812 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3813 ; CHECK32-IZHINXMIN-NEXT: ret
3815 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_ui:
3816 ; CHECK64-IZHINXMIN: # %bb.0:
3817 ; CHECK64-IZHINXMIN-NEXT: slli a0, a0, 48
3818 ; CHECK64-IZHINXMIN-NEXT: srli a0, a0, 48
3819 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.lu a0, a0
3820 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3821 ; CHECK64-IZHINXMIN-NEXT: ret
3823 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_ui:
3824 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
3825 ; CHECK32-IZDINXZHINXMIN-NEXT: slli a0, a0, 16
3826 ; CHECK32-IZDINXZHINXMIN-NEXT: srli a0, a0, 16
3827 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.wu a0, a0
3828 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3829 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
3831 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_ui:
3832 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
3833 ; CHECK64-IZDINXZHINXMIN-NEXT: slli a0, a0, 48
3834 ; CHECK64-IZDINXZHINXMIN-NEXT: srli a0, a0, 48
3835 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.lu a0, a0
3836 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3837 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
3838 %1 = uitofp i16 %a to half
3842 define half @fcvt_h_ui_zeroext(i16 zeroext %a) nounwind {
3843 ; CHECKIZFH-LABEL: fcvt_h_ui_zeroext:
3844 ; CHECKIZFH: # %bb.0:
3845 ; CHECKIZFH-NEXT: fcvt.h.wu fa0, a0
3846 ; CHECKIZFH-NEXT: ret
3848 ; RV32IDZFH-LABEL: fcvt_h_ui_zeroext:
3849 ; RV32IDZFH: # %bb.0:
3850 ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0
3851 ; RV32IDZFH-NEXT: ret
3853 ; RV64IDZFH-LABEL: fcvt_h_ui_zeroext:
3854 ; RV64IDZFH: # %bb.0:
3855 ; RV64IDZFH-NEXT: fcvt.h.wu fa0, a0
3856 ; RV64IDZFH-NEXT: ret
3858 ; CHECKIZHINX-LABEL: fcvt_h_ui_zeroext:
3859 ; CHECKIZHINX: # %bb.0:
3860 ; CHECKIZHINX-NEXT: fcvt.h.wu a0, a0
3861 ; CHECKIZHINX-NEXT: ret
3863 ; CHECKIZDINXZHINX-LABEL: fcvt_h_ui_zeroext:
3864 ; CHECKIZDINXZHINX: # %bb.0:
3865 ; CHECKIZDINXZHINX-NEXT: fcvt.h.wu a0, a0
3866 ; CHECKIZDINXZHINX-NEXT: ret
3868 ; RV32I-LABEL: fcvt_h_ui_zeroext:
3870 ; RV32I-NEXT: addi sp, sp, -16
3871 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3872 ; RV32I-NEXT: call __floatunsisf
3873 ; RV32I-NEXT: call __truncsfhf2
3874 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3875 ; RV32I-NEXT: addi sp, sp, 16
3878 ; RV64I-LABEL: fcvt_h_ui_zeroext:
3880 ; RV64I-NEXT: addi sp, sp, -16
3881 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3882 ; RV64I-NEXT: call __floatunsisf
3883 ; RV64I-NEXT: call __truncsfhf2
3884 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3885 ; RV64I-NEXT: addi sp, sp, 16
3888 ; RV32ID-ILP32-LABEL: fcvt_h_ui_zeroext:
3889 ; RV32ID-ILP32: # %bb.0:
3890 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
3891 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3892 ; RV32ID-ILP32-NEXT: fcvt.s.wu fa5, a0
3893 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
3894 ; RV32ID-ILP32-NEXT: call __truncsfhf2
3895 ; RV32ID-ILP32-NEXT: lui a1, 1048560
3896 ; RV32ID-ILP32-NEXT: or a0, a0, a1
3897 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3898 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
3899 ; RV32ID-ILP32-NEXT: ret
3901 ; RV64ID-LP64-LABEL: fcvt_h_ui_zeroext:
3902 ; RV64ID-LP64: # %bb.0:
3903 ; RV64ID-LP64-NEXT: addi sp, sp, -16
3904 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3905 ; RV64ID-LP64-NEXT: fcvt.s.wu fa5, a0
3906 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
3907 ; RV64ID-LP64-NEXT: call __truncsfhf2
3908 ; RV64ID-LP64-NEXT: lui a1, 1048560
3909 ; RV64ID-LP64-NEXT: or a0, a0, a1
3910 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3911 ; RV64ID-LP64-NEXT: addi sp, sp, 16
3912 ; RV64ID-LP64-NEXT: ret
3914 ; RV32ID-LABEL: fcvt_h_ui_zeroext:
3916 ; RV32ID-NEXT: addi sp, sp, -16
3917 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
3918 ; RV32ID-NEXT: fcvt.s.wu fa0, a0
3919 ; RV32ID-NEXT: call __truncsfhf2
3920 ; RV32ID-NEXT: fmv.x.w a0, fa0
3921 ; RV32ID-NEXT: lui a1, 1048560
3922 ; RV32ID-NEXT: or a0, a0, a1
3923 ; RV32ID-NEXT: fmv.w.x fa0, a0
3924 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
3925 ; RV32ID-NEXT: addi sp, sp, 16
3928 ; RV64ID-LABEL: fcvt_h_ui_zeroext:
3930 ; RV64ID-NEXT: addi sp, sp, -16
3931 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
3932 ; RV64ID-NEXT: fcvt.s.wu fa0, a0
3933 ; RV64ID-NEXT: call __truncsfhf2
3934 ; RV64ID-NEXT: fmv.x.w a0, fa0
3935 ; RV64ID-NEXT: lui a1, 1048560
3936 ; RV64ID-NEXT: or a0, a0, a1
3937 ; RV64ID-NEXT: fmv.w.x fa0, a0
3938 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
3939 ; RV64ID-NEXT: addi sp, sp, 16
3942 ; CHECK32-IZFHMIN-LABEL: fcvt_h_ui_zeroext:
3943 ; CHECK32-IZFHMIN: # %bb.0:
3944 ; CHECK32-IZFHMIN-NEXT: fcvt.s.wu fa5, a0
3945 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3946 ; CHECK32-IZFHMIN-NEXT: ret
3948 ; CHECK64-IZFHMIN-LABEL: fcvt_h_ui_zeroext:
3949 ; CHECK64-IZFHMIN: # %bb.0:
3950 ; CHECK64-IZFHMIN-NEXT: fcvt.s.lu fa5, a0
3951 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
3952 ; CHECK64-IZFHMIN-NEXT: ret
3954 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_ui_zeroext:
3955 ; CHECK32-IZHINXMIN: # %bb.0:
3956 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.wu a0, a0
3957 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3958 ; CHECK32-IZHINXMIN-NEXT: ret
3960 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_ui_zeroext:
3961 ; CHECK64-IZHINXMIN: # %bb.0:
3962 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.lu a0, a0
3963 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
3964 ; CHECK64-IZHINXMIN-NEXT: ret
3966 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_ui_zeroext:
3967 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
3968 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.wu a0, a0
3969 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3970 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
3972 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_ui_zeroext:
3973 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
3974 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.lu a0, a0
3975 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
3976 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
3977 %1 = uitofp i16 %a to half
3981 define half @fcvt_h_w(i32 %a) nounwind {
3982 ; CHECKIZFH-LABEL: fcvt_h_w:
3983 ; CHECKIZFH: # %bb.0:
3984 ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0
3985 ; CHECKIZFH-NEXT: ret
3987 ; RV32IDZFH-LABEL: fcvt_h_w:
3988 ; RV32IDZFH: # %bb.0:
3989 ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0
3990 ; RV32IDZFH-NEXT: ret
3992 ; RV64IDZFH-LABEL: fcvt_h_w:
3993 ; RV64IDZFH: # %bb.0:
3994 ; RV64IDZFH-NEXT: fcvt.h.w fa0, a0
3995 ; RV64IDZFH-NEXT: ret
3997 ; CHECKIZHINX-LABEL: fcvt_h_w:
3998 ; CHECKIZHINX: # %bb.0:
3999 ; CHECKIZHINX-NEXT: fcvt.h.w a0, a0
4000 ; CHECKIZHINX-NEXT: ret
4002 ; CHECKIZDINXZHINX-LABEL: fcvt_h_w:
4003 ; CHECKIZDINXZHINX: # %bb.0:
4004 ; CHECKIZDINXZHINX-NEXT: fcvt.h.w a0, a0
4005 ; CHECKIZDINXZHINX-NEXT: ret
4007 ; RV32I-LABEL: fcvt_h_w:
4009 ; RV32I-NEXT: addi sp, sp, -16
4010 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4011 ; RV32I-NEXT: call __floatsisf
4012 ; RV32I-NEXT: call __truncsfhf2
4013 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4014 ; RV32I-NEXT: addi sp, sp, 16
4017 ; RV64I-LABEL: fcvt_h_w:
4019 ; RV64I-NEXT: addi sp, sp, -16
4020 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4021 ; RV64I-NEXT: sext.w a0, a0
4022 ; RV64I-NEXT: call __floatsisf
4023 ; RV64I-NEXT: call __truncsfhf2
4024 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4025 ; RV64I-NEXT: addi sp, sp, 16
4028 ; RV32ID-ILP32-LABEL: fcvt_h_w:
4029 ; RV32ID-ILP32: # %bb.0:
4030 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
4031 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4032 ; RV32ID-ILP32-NEXT: fcvt.s.w fa5, a0
4033 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
4034 ; RV32ID-ILP32-NEXT: call __truncsfhf2
4035 ; RV32ID-ILP32-NEXT: lui a1, 1048560
4036 ; RV32ID-ILP32-NEXT: or a0, a0, a1
4037 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4038 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
4039 ; RV32ID-ILP32-NEXT: ret
4041 ; RV64ID-LP64-LABEL: fcvt_h_w:
4042 ; RV64ID-LP64: # %bb.0:
4043 ; RV64ID-LP64-NEXT: addi sp, sp, -16
4044 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4045 ; RV64ID-LP64-NEXT: fcvt.s.w fa5, a0
4046 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
4047 ; RV64ID-LP64-NEXT: call __truncsfhf2
4048 ; RV64ID-LP64-NEXT: lui a1, 1048560
4049 ; RV64ID-LP64-NEXT: or a0, a0, a1
4050 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4051 ; RV64ID-LP64-NEXT: addi sp, sp, 16
4052 ; RV64ID-LP64-NEXT: ret
4054 ; RV32ID-LABEL: fcvt_h_w:
4056 ; RV32ID-NEXT: addi sp, sp, -16
4057 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4058 ; RV32ID-NEXT: fcvt.s.w fa0, a0
4059 ; RV32ID-NEXT: call __truncsfhf2
4060 ; RV32ID-NEXT: fmv.x.w a0, fa0
4061 ; RV32ID-NEXT: lui a1, 1048560
4062 ; RV32ID-NEXT: or a0, a0, a1
4063 ; RV32ID-NEXT: fmv.w.x fa0, a0
4064 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4065 ; RV32ID-NEXT: addi sp, sp, 16
4068 ; RV64ID-LABEL: fcvt_h_w:
4070 ; RV64ID-NEXT: addi sp, sp, -16
4071 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4072 ; RV64ID-NEXT: fcvt.s.w fa0, a0
4073 ; RV64ID-NEXT: call __truncsfhf2
4074 ; RV64ID-NEXT: fmv.x.w a0, fa0
4075 ; RV64ID-NEXT: lui a1, 1048560
4076 ; RV64ID-NEXT: or a0, a0, a1
4077 ; RV64ID-NEXT: fmv.w.x fa0, a0
4078 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4079 ; RV64ID-NEXT: addi sp, sp, 16
4082 ; CHECK32-IZFHMIN-LABEL: fcvt_h_w:
4083 ; CHECK32-IZFHMIN: # %bb.0:
4084 ; CHECK32-IZFHMIN-NEXT: fcvt.s.w fa5, a0
4085 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4086 ; CHECK32-IZFHMIN-NEXT: ret
4088 ; CHECK64-IZFHMIN-LABEL: fcvt_h_w:
4089 ; CHECK64-IZFHMIN: # %bb.0:
4090 ; CHECK64-IZFHMIN-NEXT: sext.w a0, a0
4091 ; CHECK64-IZFHMIN-NEXT: fcvt.s.l fa5, a0
4092 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4093 ; CHECK64-IZFHMIN-NEXT: ret
4095 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_w:
4096 ; CHECK32-IZHINXMIN: # %bb.0:
4097 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.w a0, a0
4098 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4099 ; CHECK32-IZHINXMIN-NEXT: ret
4101 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_w:
4102 ; CHECK64-IZHINXMIN: # %bb.0:
4103 ; CHECK64-IZHINXMIN-NEXT: sext.w a0, a0
4104 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.l a0, a0
4105 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4106 ; CHECK64-IZHINXMIN-NEXT: ret
4108 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_w:
4109 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
4110 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.w a0, a0
4111 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4112 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
4114 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_w:
4115 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
4116 ; CHECK64-IZDINXZHINXMIN-NEXT: sext.w a0, a0
4117 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.l a0, a0
4118 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4119 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
4120 %1 = sitofp i32 %a to half
4124 define half @fcvt_h_w_load(ptr %p) nounwind {
4125 ; CHECKIZFH-LABEL: fcvt_h_w_load:
4126 ; CHECKIZFH: # %bb.0:
4127 ; CHECKIZFH-NEXT: lw a0, 0(a0)
4128 ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0
4129 ; CHECKIZFH-NEXT: ret
4131 ; RV32IDZFH-LABEL: fcvt_h_w_load:
4132 ; RV32IDZFH: # %bb.0:
4133 ; RV32IDZFH-NEXT: lw a0, 0(a0)
4134 ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0
4135 ; RV32IDZFH-NEXT: ret
4137 ; RV64IDZFH-LABEL: fcvt_h_w_load:
4138 ; RV64IDZFH: # %bb.0:
4139 ; RV64IDZFH-NEXT: lw a0, 0(a0)
4140 ; RV64IDZFH-NEXT: fcvt.h.w fa0, a0
4141 ; RV64IDZFH-NEXT: ret
4143 ; CHECKIZHINX-LABEL: fcvt_h_w_load:
4144 ; CHECKIZHINX: # %bb.0:
4145 ; CHECKIZHINX-NEXT: lw a0, 0(a0)
4146 ; CHECKIZHINX-NEXT: fcvt.h.w a0, a0
4147 ; CHECKIZHINX-NEXT: ret
4149 ; CHECKIZDINXZHINX-LABEL: fcvt_h_w_load:
4150 ; CHECKIZDINXZHINX: # %bb.0:
4151 ; CHECKIZDINXZHINX-NEXT: lw a0, 0(a0)
4152 ; CHECKIZDINXZHINX-NEXT: fcvt.h.w a0, a0
4153 ; CHECKIZDINXZHINX-NEXT: ret
4155 ; RV32I-LABEL: fcvt_h_w_load:
4157 ; RV32I-NEXT: addi sp, sp, -16
4158 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4159 ; RV32I-NEXT: lw a0, 0(a0)
4160 ; RV32I-NEXT: call __floatsisf
4161 ; RV32I-NEXT: call __truncsfhf2
4162 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4163 ; RV32I-NEXT: addi sp, sp, 16
4166 ; RV64I-LABEL: fcvt_h_w_load:
4168 ; RV64I-NEXT: addi sp, sp, -16
4169 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4170 ; RV64I-NEXT: lw a0, 0(a0)
4171 ; RV64I-NEXT: call __floatsisf
4172 ; RV64I-NEXT: call __truncsfhf2
4173 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4174 ; RV64I-NEXT: addi sp, sp, 16
4177 ; RV32ID-ILP32-LABEL: fcvt_h_w_load:
4178 ; RV32ID-ILP32: # %bb.0:
4179 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
4180 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4181 ; RV32ID-ILP32-NEXT: lw a0, 0(a0)
4182 ; RV32ID-ILP32-NEXT: fcvt.s.w fa5, a0
4183 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
4184 ; RV32ID-ILP32-NEXT: call __truncsfhf2
4185 ; RV32ID-ILP32-NEXT: lui a1, 1048560
4186 ; RV32ID-ILP32-NEXT: or a0, a0, a1
4187 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4188 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
4189 ; RV32ID-ILP32-NEXT: ret
4191 ; RV64ID-LP64-LABEL: fcvt_h_w_load:
4192 ; RV64ID-LP64: # %bb.0:
4193 ; RV64ID-LP64-NEXT: addi sp, sp, -16
4194 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4195 ; RV64ID-LP64-NEXT: lw a0, 0(a0)
4196 ; RV64ID-LP64-NEXT: fcvt.s.w fa5, a0
4197 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
4198 ; RV64ID-LP64-NEXT: call __truncsfhf2
4199 ; RV64ID-LP64-NEXT: lui a1, 1048560
4200 ; RV64ID-LP64-NEXT: or a0, a0, a1
4201 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4202 ; RV64ID-LP64-NEXT: addi sp, sp, 16
4203 ; RV64ID-LP64-NEXT: ret
4205 ; RV32ID-LABEL: fcvt_h_w_load:
4207 ; RV32ID-NEXT: addi sp, sp, -16
4208 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4209 ; RV32ID-NEXT: lw a0, 0(a0)
4210 ; RV32ID-NEXT: fcvt.s.w fa0, a0
4211 ; RV32ID-NEXT: call __truncsfhf2
4212 ; RV32ID-NEXT: fmv.x.w a0, fa0
4213 ; RV32ID-NEXT: lui a1, 1048560
4214 ; RV32ID-NEXT: or a0, a0, a1
4215 ; RV32ID-NEXT: fmv.w.x fa0, a0
4216 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4217 ; RV32ID-NEXT: addi sp, sp, 16
4220 ; RV64ID-LABEL: fcvt_h_w_load:
4222 ; RV64ID-NEXT: addi sp, sp, -16
4223 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4224 ; RV64ID-NEXT: lw a0, 0(a0)
4225 ; RV64ID-NEXT: fcvt.s.w fa0, a0
4226 ; RV64ID-NEXT: call __truncsfhf2
4227 ; RV64ID-NEXT: fmv.x.w a0, fa0
4228 ; RV64ID-NEXT: lui a1, 1048560
4229 ; RV64ID-NEXT: or a0, a0, a1
4230 ; RV64ID-NEXT: fmv.w.x fa0, a0
4231 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4232 ; RV64ID-NEXT: addi sp, sp, 16
4235 ; CHECK32-IZFHMIN-LABEL: fcvt_h_w_load:
4236 ; CHECK32-IZFHMIN: # %bb.0:
4237 ; CHECK32-IZFHMIN-NEXT: lw a0, 0(a0)
4238 ; CHECK32-IZFHMIN-NEXT: fcvt.s.w fa5, a0
4239 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4240 ; CHECK32-IZFHMIN-NEXT: ret
4242 ; CHECK64-IZFHMIN-LABEL: fcvt_h_w_load:
4243 ; CHECK64-IZFHMIN: # %bb.0:
4244 ; CHECK64-IZFHMIN-NEXT: lw a0, 0(a0)
4245 ; CHECK64-IZFHMIN-NEXT: fcvt.s.l fa5, a0
4246 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4247 ; CHECK64-IZFHMIN-NEXT: ret
4249 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_w_load:
4250 ; CHECK32-IZHINXMIN: # %bb.0:
4251 ; CHECK32-IZHINXMIN-NEXT: lw a0, 0(a0)
4252 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.w a0, a0
4253 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4254 ; CHECK32-IZHINXMIN-NEXT: ret
4256 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_w_load:
4257 ; CHECK64-IZHINXMIN: # %bb.0:
4258 ; CHECK64-IZHINXMIN-NEXT: lw a0, 0(a0)
4259 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.l a0, a0
4260 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4261 ; CHECK64-IZHINXMIN-NEXT: ret
4263 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_w_load:
4264 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
4265 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a0, 0(a0)
4266 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.w a0, a0
4267 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4268 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
4270 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_w_load:
4271 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
4272 ; CHECK64-IZDINXZHINXMIN-NEXT: lw a0, 0(a0)
4273 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.l a0, a0
4274 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4275 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
4276 %a = load i32, ptr %p
4277 %1 = sitofp i32 %a to half
4281 define half @fcvt_h_wu(i32 %a) nounwind {
4282 ; CHECKIZFH-LABEL: fcvt_h_wu:
4283 ; CHECKIZFH: # %bb.0:
4284 ; CHECKIZFH-NEXT: fcvt.h.wu fa0, a0
4285 ; CHECKIZFH-NEXT: ret
4287 ; RV32IDZFH-LABEL: fcvt_h_wu:
4288 ; RV32IDZFH: # %bb.0:
4289 ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0
4290 ; RV32IDZFH-NEXT: ret
4292 ; RV64IDZFH-LABEL: fcvt_h_wu:
4293 ; RV64IDZFH: # %bb.0:
4294 ; RV64IDZFH-NEXT: fcvt.h.wu fa0, a0
4295 ; RV64IDZFH-NEXT: ret
4297 ; CHECKIZHINX-LABEL: fcvt_h_wu:
4298 ; CHECKIZHINX: # %bb.0:
4299 ; CHECKIZHINX-NEXT: fcvt.h.wu a0, a0
4300 ; CHECKIZHINX-NEXT: ret
4302 ; CHECKIZDINXZHINX-LABEL: fcvt_h_wu:
4303 ; CHECKIZDINXZHINX: # %bb.0:
4304 ; CHECKIZDINXZHINX-NEXT: fcvt.h.wu a0, a0
4305 ; CHECKIZDINXZHINX-NEXT: ret
4307 ; RV32I-LABEL: fcvt_h_wu:
4309 ; RV32I-NEXT: addi sp, sp, -16
4310 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4311 ; RV32I-NEXT: call __floatunsisf
4312 ; RV32I-NEXT: call __truncsfhf2
4313 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4314 ; RV32I-NEXT: addi sp, sp, 16
4317 ; RV64I-LABEL: fcvt_h_wu:
4319 ; RV64I-NEXT: addi sp, sp, -16
4320 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4321 ; RV64I-NEXT: sext.w a0, a0
4322 ; RV64I-NEXT: call __floatunsisf
4323 ; RV64I-NEXT: call __truncsfhf2
4324 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4325 ; RV64I-NEXT: addi sp, sp, 16
4328 ; RV32ID-ILP32-LABEL: fcvt_h_wu:
4329 ; RV32ID-ILP32: # %bb.0:
4330 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
4331 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4332 ; RV32ID-ILP32-NEXT: fcvt.s.wu fa5, a0
4333 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
4334 ; RV32ID-ILP32-NEXT: call __truncsfhf2
4335 ; RV32ID-ILP32-NEXT: lui a1, 1048560
4336 ; RV32ID-ILP32-NEXT: or a0, a0, a1
4337 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4338 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
4339 ; RV32ID-ILP32-NEXT: ret
4341 ; RV64ID-LP64-LABEL: fcvt_h_wu:
4342 ; RV64ID-LP64: # %bb.0:
4343 ; RV64ID-LP64-NEXT: addi sp, sp, -16
4344 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4345 ; RV64ID-LP64-NEXT: fcvt.s.wu fa5, a0
4346 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
4347 ; RV64ID-LP64-NEXT: call __truncsfhf2
4348 ; RV64ID-LP64-NEXT: lui a1, 1048560
4349 ; RV64ID-LP64-NEXT: or a0, a0, a1
4350 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4351 ; RV64ID-LP64-NEXT: addi sp, sp, 16
4352 ; RV64ID-LP64-NEXT: ret
4354 ; RV32ID-LABEL: fcvt_h_wu:
4356 ; RV32ID-NEXT: addi sp, sp, -16
4357 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4358 ; RV32ID-NEXT: fcvt.s.wu fa0, a0
4359 ; RV32ID-NEXT: call __truncsfhf2
4360 ; RV32ID-NEXT: fmv.x.w a0, fa0
4361 ; RV32ID-NEXT: lui a1, 1048560
4362 ; RV32ID-NEXT: or a0, a0, a1
4363 ; RV32ID-NEXT: fmv.w.x fa0, a0
4364 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4365 ; RV32ID-NEXT: addi sp, sp, 16
4368 ; RV64ID-LABEL: fcvt_h_wu:
4370 ; RV64ID-NEXT: addi sp, sp, -16
4371 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4372 ; RV64ID-NEXT: fcvt.s.wu fa0, a0
4373 ; RV64ID-NEXT: call __truncsfhf2
4374 ; RV64ID-NEXT: fmv.x.w a0, fa0
4375 ; RV64ID-NEXT: lui a1, 1048560
4376 ; RV64ID-NEXT: or a0, a0, a1
4377 ; RV64ID-NEXT: fmv.w.x fa0, a0
4378 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4379 ; RV64ID-NEXT: addi sp, sp, 16
4382 ; CHECK32-IZFHMIN-LABEL: fcvt_h_wu:
4383 ; CHECK32-IZFHMIN: # %bb.0:
4384 ; CHECK32-IZFHMIN-NEXT: fcvt.s.wu fa5, a0
4385 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4386 ; CHECK32-IZFHMIN-NEXT: ret
4388 ; CHECK64-IZFHMIN-LABEL: fcvt_h_wu:
4389 ; CHECK64-IZFHMIN: # %bb.0:
4390 ; CHECK64-IZFHMIN-NEXT: slli a0, a0, 32
4391 ; CHECK64-IZFHMIN-NEXT: srli a0, a0, 32
4392 ; CHECK64-IZFHMIN-NEXT: fcvt.s.lu fa5, a0
4393 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4394 ; CHECK64-IZFHMIN-NEXT: ret
4396 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_wu:
4397 ; CHECK32-IZHINXMIN: # %bb.0:
4398 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.wu a0, a0
4399 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4400 ; CHECK32-IZHINXMIN-NEXT: ret
4402 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_wu:
4403 ; CHECK64-IZHINXMIN: # %bb.0:
4404 ; CHECK64-IZHINXMIN-NEXT: slli a0, a0, 32
4405 ; CHECK64-IZHINXMIN-NEXT: srli a0, a0, 32
4406 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.lu a0, a0
4407 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4408 ; CHECK64-IZHINXMIN-NEXT: ret
4410 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_wu:
4411 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
4412 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.wu a0, a0
4413 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4414 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
4416 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_wu:
4417 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
4418 ; CHECK64-IZDINXZHINXMIN-NEXT: slli a0, a0, 32
4419 ; CHECK64-IZDINXZHINXMIN-NEXT: srli a0, a0, 32
4420 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.lu a0, a0
4421 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4422 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
4423 %1 = uitofp i32 %a to half
4427 define half @fcvt_h_wu_load(ptr %p) nounwind {
4428 ; RV32IZFH-LABEL: fcvt_h_wu_load:
4429 ; RV32IZFH: # %bb.0:
4430 ; RV32IZFH-NEXT: lw a0, 0(a0)
4431 ; RV32IZFH-NEXT: fcvt.h.wu fa0, a0
4432 ; RV32IZFH-NEXT: ret
4434 ; RV64IZFH-LABEL: fcvt_h_wu_load:
4435 ; RV64IZFH: # %bb.0:
4436 ; RV64IZFH-NEXT: lwu a0, 0(a0)
4437 ; RV64IZFH-NEXT: fcvt.h.wu fa0, a0
4438 ; RV64IZFH-NEXT: ret
4440 ; RV32IDZFH-LABEL: fcvt_h_wu_load:
4441 ; RV32IDZFH: # %bb.0:
4442 ; RV32IDZFH-NEXT: lw a0, 0(a0)
4443 ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0
4444 ; RV32IDZFH-NEXT: ret
4446 ; RV64IDZFH-LABEL: fcvt_h_wu_load:
4447 ; RV64IDZFH: # %bb.0:
4448 ; RV64IDZFH-NEXT: lwu a0, 0(a0)
4449 ; RV64IDZFH-NEXT: fcvt.h.wu fa0, a0
4450 ; RV64IDZFH-NEXT: ret
4452 ; RV32IZHINX-LABEL: fcvt_h_wu_load:
4453 ; RV32IZHINX: # %bb.0:
4454 ; RV32IZHINX-NEXT: lw a0, 0(a0)
4455 ; RV32IZHINX-NEXT: fcvt.h.wu a0, a0
4456 ; RV32IZHINX-NEXT: ret
4458 ; RV64IZHINX-LABEL: fcvt_h_wu_load:
4459 ; RV64IZHINX: # %bb.0:
4460 ; RV64IZHINX-NEXT: lwu a0, 0(a0)
4461 ; RV64IZHINX-NEXT: fcvt.h.wu a0, a0
4462 ; RV64IZHINX-NEXT: ret
4464 ; RV32IZDINXZHINX-LABEL: fcvt_h_wu_load:
4465 ; RV32IZDINXZHINX: # %bb.0:
4466 ; RV32IZDINXZHINX-NEXT: lw a0, 0(a0)
4467 ; RV32IZDINXZHINX-NEXT: fcvt.h.wu a0, a0
4468 ; RV32IZDINXZHINX-NEXT: ret
4470 ; RV64IZDINXZHINX-LABEL: fcvt_h_wu_load:
4471 ; RV64IZDINXZHINX: # %bb.0:
4472 ; RV64IZDINXZHINX-NEXT: lwu a0, 0(a0)
4473 ; RV64IZDINXZHINX-NEXT: fcvt.h.wu a0, a0
4474 ; RV64IZDINXZHINX-NEXT: ret
4476 ; RV32I-LABEL: fcvt_h_wu_load:
4478 ; RV32I-NEXT: addi sp, sp, -16
4479 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4480 ; RV32I-NEXT: lw a0, 0(a0)
4481 ; RV32I-NEXT: call __floatunsisf
4482 ; RV32I-NEXT: call __truncsfhf2
4483 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4484 ; RV32I-NEXT: addi sp, sp, 16
4487 ; RV64I-LABEL: fcvt_h_wu_load:
4489 ; RV64I-NEXT: addi sp, sp, -16
4490 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4491 ; RV64I-NEXT: lw a0, 0(a0)
4492 ; RV64I-NEXT: call __floatunsisf
4493 ; RV64I-NEXT: call __truncsfhf2
4494 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4495 ; RV64I-NEXT: addi sp, sp, 16
4498 ; RV32ID-ILP32-LABEL: fcvt_h_wu_load:
4499 ; RV32ID-ILP32: # %bb.0:
4500 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
4501 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4502 ; RV32ID-ILP32-NEXT: lw a0, 0(a0)
4503 ; RV32ID-ILP32-NEXT: fcvt.s.wu fa5, a0
4504 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
4505 ; RV32ID-ILP32-NEXT: call __truncsfhf2
4506 ; RV32ID-ILP32-NEXT: lui a1, 1048560
4507 ; RV32ID-ILP32-NEXT: or a0, a0, a1
4508 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4509 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
4510 ; RV32ID-ILP32-NEXT: ret
4512 ; RV64ID-LP64-LABEL: fcvt_h_wu_load:
4513 ; RV64ID-LP64: # %bb.0:
4514 ; RV64ID-LP64-NEXT: addi sp, sp, -16
4515 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4516 ; RV64ID-LP64-NEXT: lwu a0, 0(a0)
4517 ; RV64ID-LP64-NEXT: fcvt.s.wu fa5, a0
4518 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
4519 ; RV64ID-LP64-NEXT: call __truncsfhf2
4520 ; RV64ID-LP64-NEXT: lui a1, 1048560
4521 ; RV64ID-LP64-NEXT: or a0, a0, a1
4522 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4523 ; RV64ID-LP64-NEXT: addi sp, sp, 16
4524 ; RV64ID-LP64-NEXT: ret
4526 ; RV32ID-LABEL: fcvt_h_wu_load:
4528 ; RV32ID-NEXT: addi sp, sp, -16
4529 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4530 ; RV32ID-NEXT: lw a0, 0(a0)
4531 ; RV32ID-NEXT: fcvt.s.wu fa0, a0
4532 ; RV32ID-NEXT: call __truncsfhf2
4533 ; RV32ID-NEXT: fmv.x.w a0, fa0
4534 ; RV32ID-NEXT: lui a1, 1048560
4535 ; RV32ID-NEXT: or a0, a0, a1
4536 ; RV32ID-NEXT: fmv.w.x fa0, a0
4537 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4538 ; RV32ID-NEXT: addi sp, sp, 16
4541 ; RV64ID-LABEL: fcvt_h_wu_load:
4543 ; RV64ID-NEXT: addi sp, sp, -16
4544 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4545 ; RV64ID-NEXT: lwu a0, 0(a0)
4546 ; RV64ID-NEXT: fcvt.s.wu fa0, a0
4547 ; RV64ID-NEXT: call __truncsfhf2
4548 ; RV64ID-NEXT: fmv.x.w a0, fa0
4549 ; RV64ID-NEXT: lui a1, 1048560
4550 ; RV64ID-NEXT: or a0, a0, a1
4551 ; RV64ID-NEXT: fmv.w.x fa0, a0
4552 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4553 ; RV64ID-NEXT: addi sp, sp, 16
4556 ; CHECK32-IZFHMIN-LABEL: fcvt_h_wu_load:
4557 ; CHECK32-IZFHMIN: # %bb.0:
4558 ; CHECK32-IZFHMIN-NEXT: lw a0, 0(a0)
4559 ; CHECK32-IZFHMIN-NEXT: fcvt.s.wu fa5, a0
4560 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4561 ; CHECK32-IZFHMIN-NEXT: ret
4563 ; CHECK64-IZFHMIN-LABEL: fcvt_h_wu_load:
4564 ; CHECK64-IZFHMIN: # %bb.0:
4565 ; CHECK64-IZFHMIN-NEXT: lwu a0, 0(a0)
4566 ; CHECK64-IZFHMIN-NEXT: fcvt.s.lu fa5, a0
4567 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4568 ; CHECK64-IZFHMIN-NEXT: ret
4570 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_wu_load:
4571 ; CHECK32-IZHINXMIN: # %bb.0:
4572 ; CHECK32-IZHINXMIN-NEXT: lw a0, 0(a0)
4573 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.wu a0, a0
4574 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4575 ; CHECK32-IZHINXMIN-NEXT: ret
4577 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_wu_load:
4578 ; CHECK64-IZHINXMIN: # %bb.0:
4579 ; CHECK64-IZHINXMIN-NEXT: lwu a0, 0(a0)
4580 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.lu a0, a0
4581 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4582 ; CHECK64-IZHINXMIN-NEXT: ret
4584 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_wu_load:
4585 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
4586 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a0, 0(a0)
4587 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.wu a0, a0
4588 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4589 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
4591 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_wu_load:
4592 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
4593 ; CHECK64-IZDINXZHINXMIN-NEXT: lwu a0, 0(a0)
4594 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.lu a0, a0
4595 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4596 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
4597 %a = load i32, ptr %p
4598 %1 = uitofp i32 %a to half
4602 define half @fcvt_h_l(i64 %a) nounwind {
4603 ; RV32IZFH-LABEL: fcvt_h_l:
4604 ; RV32IZFH: # %bb.0:
4605 ; RV32IZFH-NEXT: addi sp, sp, -16
4606 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4607 ; RV32IZFH-NEXT: call __floatdihf
4608 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4609 ; RV32IZFH-NEXT: addi sp, sp, 16
4610 ; RV32IZFH-NEXT: ret
4612 ; RV64IZFH-LABEL: fcvt_h_l:
4613 ; RV64IZFH: # %bb.0:
4614 ; RV64IZFH-NEXT: fcvt.h.l fa0, a0
4615 ; RV64IZFH-NEXT: ret
4617 ; RV32IDZFH-LABEL: fcvt_h_l:
4618 ; RV32IDZFH: # %bb.0:
4619 ; RV32IDZFH-NEXT: addi sp, sp, -16
4620 ; RV32IDZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4621 ; RV32IDZFH-NEXT: call __floatdihf
4622 ; RV32IDZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4623 ; RV32IDZFH-NEXT: addi sp, sp, 16
4624 ; RV32IDZFH-NEXT: ret
4626 ; RV64IDZFH-LABEL: fcvt_h_l:
4627 ; RV64IDZFH: # %bb.0:
4628 ; RV64IDZFH-NEXT: fcvt.h.l fa0, a0
4629 ; RV64IDZFH-NEXT: ret
4631 ; RV32IZHINX-LABEL: fcvt_h_l:
4632 ; RV32IZHINX: # %bb.0:
4633 ; RV32IZHINX-NEXT: addi sp, sp, -16
4634 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4635 ; RV32IZHINX-NEXT: call __floatdihf
4636 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4637 ; RV32IZHINX-NEXT: addi sp, sp, 16
4638 ; RV32IZHINX-NEXT: ret
4640 ; RV64IZHINX-LABEL: fcvt_h_l:
4641 ; RV64IZHINX: # %bb.0:
4642 ; RV64IZHINX-NEXT: fcvt.h.l a0, a0
4643 ; RV64IZHINX-NEXT: ret
4645 ; RV32IZDINXZHINX-LABEL: fcvt_h_l:
4646 ; RV32IZDINXZHINX: # %bb.0:
4647 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
4648 ; RV32IZDINXZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4649 ; RV32IZDINXZHINX-NEXT: call __floatdihf
4650 ; RV32IZDINXZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4651 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
4652 ; RV32IZDINXZHINX-NEXT: ret
4654 ; RV64IZDINXZHINX-LABEL: fcvt_h_l:
4655 ; RV64IZDINXZHINX: # %bb.0:
4656 ; RV64IZDINXZHINX-NEXT: fcvt.h.l a0, a0
4657 ; RV64IZDINXZHINX-NEXT: ret
4659 ; RV32I-LABEL: fcvt_h_l:
4661 ; RV32I-NEXT: addi sp, sp, -16
4662 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4663 ; RV32I-NEXT: call __floatdisf
4664 ; RV32I-NEXT: call __truncsfhf2
4665 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4666 ; RV32I-NEXT: addi sp, sp, 16
4669 ; RV64I-LABEL: fcvt_h_l:
4671 ; RV64I-NEXT: addi sp, sp, -16
4672 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4673 ; RV64I-NEXT: call __floatdisf
4674 ; RV64I-NEXT: call __truncsfhf2
4675 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4676 ; RV64I-NEXT: addi sp, sp, 16
4679 ; RV32ID-ILP32-LABEL: fcvt_h_l:
4680 ; RV32ID-ILP32: # %bb.0:
4681 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
4682 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4683 ; RV32ID-ILP32-NEXT: call __floatdisf
4684 ; RV32ID-ILP32-NEXT: call __truncsfhf2
4685 ; RV32ID-ILP32-NEXT: lui a1, 1048560
4686 ; RV32ID-ILP32-NEXT: or a0, a0, a1
4687 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4688 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
4689 ; RV32ID-ILP32-NEXT: ret
4691 ; RV64ID-LP64-LABEL: fcvt_h_l:
4692 ; RV64ID-LP64: # %bb.0:
4693 ; RV64ID-LP64-NEXT: addi sp, sp, -16
4694 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4695 ; RV64ID-LP64-NEXT: fcvt.s.l fa5, a0
4696 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
4697 ; RV64ID-LP64-NEXT: call __truncsfhf2
4698 ; RV64ID-LP64-NEXT: lui a1, 1048560
4699 ; RV64ID-LP64-NEXT: or a0, a0, a1
4700 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4701 ; RV64ID-LP64-NEXT: addi sp, sp, 16
4702 ; RV64ID-LP64-NEXT: ret
4704 ; RV32ID-LABEL: fcvt_h_l:
4706 ; RV32ID-NEXT: addi sp, sp, -16
4707 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4708 ; RV32ID-NEXT: call __floatdisf
4709 ; RV32ID-NEXT: call __truncsfhf2
4710 ; RV32ID-NEXT: fmv.x.w a0, fa0
4711 ; RV32ID-NEXT: lui a1, 1048560
4712 ; RV32ID-NEXT: or a0, a0, a1
4713 ; RV32ID-NEXT: fmv.w.x fa0, a0
4714 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4715 ; RV32ID-NEXT: addi sp, sp, 16
4718 ; RV64ID-LABEL: fcvt_h_l:
4720 ; RV64ID-NEXT: addi sp, sp, -16
4721 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4722 ; RV64ID-NEXT: fcvt.s.l fa0, a0
4723 ; RV64ID-NEXT: call __truncsfhf2
4724 ; RV64ID-NEXT: fmv.x.w a0, fa0
4725 ; RV64ID-NEXT: lui a1, 1048560
4726 ; RV64ID-NEXT: or a0, a0, a1
4727 ; RV64ID-NEXT: fmv.w.x fa0, a0
4728 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4729 ; RV64ID-NEXT: addi sp, sp, 16
4732 ; CHECK32-IZFHMIN-LABEL: fcvt_h_l:
4733 ; CHECK32-IZFHMIN: # %bb.0:
4734 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, -16
4735 ; CHECK32-IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4736 ; CHECK32-IZFHMIN-NEXT: call __floatdihf
4737 ; CHECK32-IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4738 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, 16
4739 ; CHECK32-IZFHMIN-NEXT: ret
4741 ; CHECK64-IZFHMIN-LABEL: fcvt_h_l:
4742 ; CHECK64-IZFHMIN: # %bb.0:
4743 ; CHECK64-IZFHMIN-NEXT: fcvt.s.l fa5, a0
4744 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4745 ; CHECK64-IZFHMIN-NEXT: ret
4747 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_l:
4748 ; CHECK32-IZHINXMIN: # %bb.0:
4749 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
4750 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4751 ; CHECK32-IZHINXMIN-NEXT: call __floatdihf
4752 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4753 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
4754 ; CHECK32-IZHINXMIN-NEXT: ret
4756 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_l:
4757 ; CHECK64-IZHINXMIN: # %bb.0:
4758 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.l a0, a0
4759 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4760 ; CHECK64-IZHINXMIN-NEXT: ret
4762 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_l:
4763 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
4764 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
4765 ; CHECK32-IZDINXZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4766 ; CHECK32-IZDINXZHINXMIN-NEXT: call __floatdihf
4767 ; CHECK32-IZDINXZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4768 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
4769 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
4771 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_l:
4772 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
4773 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.l a0, a0
4774 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4775 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
4776 %1 = sitofp i64 %a to half
4780 define half @fcvt_h_lu(i64 %a) nounwind {
4781 ; RV32IZFH-LABEL: fcvt_h_lu:
4782 ; RV32IZFH: # %bb.0:
4783 ; RV32IZFH-NEXT: addi sp, sp, -16
4784 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4785 ; RV32IZFH-NEXT: call __floatundihf
4786 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4787 ; RV32IZFH-NEXT: addi sp, sp, 16
4788 ; RV32IZFH-NEXT: ret
4790 ; RV64IZFH-LABEL: fcvt_h_lu:
4791 ; RV64IZFH: # %bb.0:
4792 ; RV64IZFH-NEXT: fcvt.h.lu fa0, a0
4793 ; RV64IZFH-NEXT: ret
4795 ; RV32IDZFH-LABEL: fcvt_h_lu:
4796 ; RV32IDZFH: # %bb.0:
4797 ; RV32IDZFH-NEXT: addi sp, sp, -16
4798 ; RV32IDZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4799 ; RV32IDZFH-NEXT: call __floatundihf
4800 ; RV32IDZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4801 ; RV32IDZFH-NEXT: addi sp, sp, 16
4802 ; RV32IDZFH-NEXT: ret
4804 ; RV64IDZFH-LABEL: fcvt_h_lu:
4805 ; RV64IDZFH: # %bb.0:
4806 ; RV64IDZFH-NEXT: fcvt.h.lu fa0, a0
4807 ; RV64IDZFH-NEXT: ret
4809 ; RV32IZHINX-LABEL: fcvt_h_lu:
4810 ; RV32IZHINX: # %bb.0:
4811 ; RV32IZHINX-NEXT: addi sp, sp, -16
4812 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4813 ; RV32IZHINX-NEXT: call __floatundihf
4814 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4815 ; RV32IZHINX-NEXT: addi sp, sp, 16
4816 ; RV32IZHINX-NEXT: ret
4818 ; RV64IZHINX-LABEL: fcvt_h_lu:
4819 ; RV64IZHINX: # %bb.0:
4820 ; RV64IZHINX-NEXT: fcvt.h.lu a0, a0
4821 ; RV64IZHINX-NEXT: ret
4823 ; RV32IZDINXZHINX-LABEL: fcvt_h_lu:
4824 ; RV32IZDINXZHINX: # %bb.0:
4825 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
4826 ; RV32IZDINXZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4827 ; RV32IZDINXZHINX-NEXT: call __floatundihf
4828 ; RV32IZDINXZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4829 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
4830 ; RV32IZDINXZHINX-NEXT: ret
4832 ; RV64IZDINXZHINX-LABEL: fcvt_h_lu:
4833 ; RV64IZDINXZHINX: # %bb.0:
4834 ; RV64IZDINXZHINX-NEXT: fcvt.h.lu a0, a0
4835 ; RV64IZDINXZHINX-NEXT: ret
4837 ; RV32I-LABEL: fcvt_h_lu:
4839 ; RV32I-NEXT: addi sp, sp, -16
4840 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4841 ; RV32I-NEXT: call __floatundisf
4842 ; RV32I-NEXT: call __truncsfhf2
4843 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4844 ; RV32I-NEXT: addi sp, sp, 16
4847 ; RV64I-LABEL: fcvt_h_lu:
4849 ; RV64I-NEXT: addi sp, sp, -16
4850 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4851 ; RV64I-NEXT: call __floatundisf
4852 ; RV64I-NEXT: call __truncsfhf2
4853 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4854 ; RV64I-NEXT: addi sp, sp, 16
4857 ; RV32ID-ILP32-LABEL: fcvt_h_lu:
4858 ; RV32ID-ILP32: # %bb.0:
4859 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
4860 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4861 ; RV32ID-ILP32-NEXT: call __floatundisf
4862 ; RV32ID-ILP32-NEXT: call __truncsfhf2
4863 ; RV32ID-ILP32-NEXT: lui a1, 1048560
4864 ; RV32ID-ILP32-NEXT: or a0, a0, a1
4865 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4866 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
4867 ; RV32ID-ILP32-NEXT: ret
4869 ; RV64ID-LP64-LABEL: fcvt_h_lu:
4870 ; RV64ID-LP64: # %bb.0:
4871 ; RV64ID-LP64-NEXT: addi sp, sp, -16
4872 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4873 ; RV64ID-LP64-NEXT: fcvt.s.lu fa5, a0
4874 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
4875 ; RV64ID-LP64-NEXT: call __truncsfhf2
4876 ; RV64ID-LP64-NEXT: lui a1, 1048560
4877 ; RV64ID-LP64-NEXT: or a0, a0, a1
4878 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4879 ; RV64ID-LP64-NEXT: addi sp, sp, 16
4880 ; RV64ID-LP64-NEXT: ret
4882 ; RV32ID-LABEL: fcvt_h_lu:
4884 ; RV32ID-NEXT: addi sp, sp, -16
4885 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4886 ; RV32ID-NEXT: call __floatundisf
4887 ; RV32ID-NEXT: call __truncsfhf2
4888 ; RV32ID-NEXT: fmv.x.w a0, fa0
4889 ; RV32ID-NEXT: lui a1, 1048560
4890 ; RV32ID-NEXT: or a0, a0, a1
4891 ; RV32ID-NEXT: fmv.w.x fa0, a0
4892 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4893 ; RV32ID-NEXT: addi sp, sp, 16
4896 ; RV64ID-LABEL: fcvt_h_lu:
4898 ; RV64ID-NEXT: addi sp, sp, -16
4899 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4900 ; RV64ID-NEXT: fcvt.s.lu fa0, a0
4901 ; RV64ID-NEXT: call __truncsfhf2
4902 ; RV64ID-NEXT: fmv.x.w a0, fa0
4903 ; RV64ID-NEXT: lui a1, 1048560
4904 ; RV64ID-NEXT: or a0, a0, a1
4905 ; RV64ID-NEXT: fmv.w.x fa0, a0
4906 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4907 ; RV64ID-NEXT: addi sp, sp, 16
4910 ; CHECK32-IZFHMIN-LABEL: fcvt_h_lu:
4911 ; CHECK32-IZFHMIN: # %bb.0:
4912 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, -16
4913 ; CHECK32-IZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4914 ; CHECK32-IZFHMIN-NEXT: call __floatundihf
4915 ; CHECK32-IZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4916 ; CHECK32-IZFHMIN-NEXT: addi sp, sp, 16
4917 ; CHECK32-IZFHMIN-NEXT: ret
4919 ; CHECK64-IZFHMIN-LABEL: fcvt_h_lu:
4920 ; CHECK64-IZFHMIN: # %bb.0:
4921 ; CHECK64-IZFHMIN-NEXT: fcvt.s.lu fa5, a0
4922 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa5
4923 ; CHECK64-IZFHMIN-NEXT: ret
4925 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_lu:
4926 ; CHECK32-IZHINXMIN: # %bb.0:
4927 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
4928 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4929 ; CHECK32-IZHINXMIN-NEXT: call __floatundihf
4930 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4931 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
4932 ; CHECK32-IZHINXMIN-NEXT: ret
4934 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_lu:
4935 ; CHECK64-IZHINXMIN: # %bb.0:
4936 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.lu a0, a0
4937 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
4938 ; CHECK64-IZHINXMIN-NEXT: ret
4940 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_lu:
4941 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
4942 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
4943 ; CHECK32-IZDINXZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4944 ; CHECK32-IZDINXZHINXMIN-NEXT: call __floatundihf
4945 ; CHECK32-IZDINXZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4946 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
4947 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
4949 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_lu:
4950 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
4951 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.lu a0, a0
4952 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
4953 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
4954 %1 = uitofp i64 %a to half
4958 define half @fcvt_h_s(float %a) nounwind {
4959 ; CHECKIZFH-LABEL: fcvt_h_s:
4960 ; CHECKIZFH: # %bb.0:
4961 ; CHECKIZFH-NEXT: fcvt.h.s fa0, fa0
4962 ; CHECKIZFH-NEXT: ret
4964 ; RV32IDZFH-LABEL: fcvt_h_s:
4965 ; RV32IDZFH: # %bb.0:
4966 ; RV32IDZFH-NEXT: fcvt.h.s fa0, fa0
4967 ; RV32IDZFH-NEXT: ret
4969 ; RV64IDZFH-LABEL: fcvt_h_s:
4970 ; RV64IDZFH: # %bb.0:
4971 ; RV64IDZFH-NEXT: fcvt.h.s fa0, fa0
4972 ; RV64IDZFH-NEXT: ret
4974 ; CHECKIZHINX-LABEL: fcvt_h_s:
4975 ; CHECKIZHINX: # %bb.0:
4976 ; CHECKIZHINX-NEXT: fcvt.h.s a0, a0
4977 ; CHECKIZHINX-NEXT: ret
4979 ; CHECKIZDINXZHINX-LABEL: fcvt_h_s:
4980 ; CHECKIZDINXZHINX: # %bb.0:
4981 ; CHECKIZDINXZHINX-NEXT: fcvt.h.s a0, a0
4982 ; CHECKIZDINXZHINX-NEXT: ret
4984 ; RV32I-LABEL: fcvt_h_s:
4986 ; RV32I-NEXT: addi sp, sp, -16
4987 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
4988 ; RV32I-NEXT: call __truncsfhf2
4989 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
4990 ; RV32I-NEXT: addi sp, sp, 16
4993 ; RV64I-LABEL: fcvt_h_s:
4995 ; RV64I-NEXT: addi sp, sp, -16
4996 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
4997 ; RV64I-NEXT: call __truncsfhf2
4998 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
4999 ; RV64I-NEXT: addi sp, sp, 16
5002 ; RV32ID-ILP32-LABEL: fcvt_h_s:
5003 ; RV32ID-ILP32: # %bb.0:
5004 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
5005 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5006 ; RV32ID-ILP32-NEXT: call __truncsfhf2
5007 ; RV32ID-ILP32-NEXT: lui a1, 1048560
5008 ; RV32ID-ILP32-NEXT: or a0, a0, a1
5009 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5010 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
5011 ; RV32ID-ILP32-NEXT: ret
5013 ; RV64ID-LP64-LABEL: fcvt_h_s:
5014 ; RV64ID-LP64: # %bb.0:
5015 ; RV64ID-LP64-NEXT: addi sp, sp, -16
5016 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5017 ; RV64ID-LP64-NEXT: call __truncsfhf2
5018 ; RV64ID-LP64-NEXT: lui a1, 1048560
5019 ; RV64ID-LP64-NEXT: or a0, a0, a1
5020 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5021 ; RV64ID-LP64-NEXT: addi sp, sp, 16
5022 ; RV64ID-LP64-NEXT: ret
5024 ; RV32ID-LABEL: fcvt_h_s:
5026 ; RV32ID-NEXT: addi sp, sp, -16
5027 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5028 ; RV32ID-NEXT: call __truncsfhf2
5029 ; RV32ID-NEXT: fmv.x.w a0, fa0
5030 ; RV32ID-NEXT: lui a1, 1048560
5031 ; RV32ID-NEXT: or a0, a0, a1
5032 ; RV32ID-NEXT: fmv.w.x fa0, a0
5033 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5034 ; RV32ID-NEXT: addi sp, sp, 16
5037 ; RV64ID-LABEL: fcvt_h_s:
5039 ; RV64ID-NEXT: addi sp, sp, -16
5040 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5041 ; RV64ID-NEXT: call __truncsfhf2
5042 ; RV64ID-NEXT: fmv.x.w a0, fa0
5043 ; RV64ID-NEXT: lui a1, 1048560
5044 ; RV64ID-NEXT: or a0, a0, a1
5045 ; RV64ID-NEXT: fmv.w.x fa0, a0
5046 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5047 ; RV64ID-NEXT: addi sp, sp, 16
5050 ; CHECK32-IZFHMIN-LABEL: fcvt_h_s:
5051 ; CHECK32-IZFHMIN: # %bb.0:
5052 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa0, fa0
5053 ; CHECK32-IZFHMIN-NEXT: ret
5055 ; CHECK64-IZFHMIN-LABEL: fcvt_h_s:
5056 ; CHECK64-IZFHMIN: # %bb.0:
5057 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa0, fa0
5058 ; CHECK64-IZFHMIN-NEXT: ret
5060 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_s:
5061 ; CHECK32-IZHINXMIN: # %bb.0:
5062 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a0, a0
5063 ; CHECK32-IZHINXMIN-NEXT: ret
5065 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_s:
5066 ; CHECK64-IZHINXMIN: # %bb.0:
5067 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a0, a0
5068 ; CHECK64-IZHINXMIN-NEXT: ret
5070 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_s:
5071 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5072 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
5073 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5075 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_s:
5076 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5077 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a0, a0
5078 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5079 %1 = fptrunc float %a to half
5083 define float @fcvt_s_h(half %a) nounwind {
5084 ; CHECKIZFH-LABEL: fcvt_s_h:
5085 ; CHECKIZFH: # %bb.0:
5086 ; CHECKIZFH-NEXT: fcvt.s.h fa0, fa0
5087 ; CHECKIZFH-NEXT: ret
5089 ; RV32IDZFH-LABEL: fcvt_s_h:
5090 ; RV32IDZFH: # %bb.0:
5091 ; RV32IDZFH-NEXT: fcvt.s.h fa0, fa0
5092 ; RV32IDZFH-NEXT: ret
5094 ; RV64IDZFH-LABEL: fcvt_s_h:
5095 ; RV64IDZFH: # %bb.0:
5096 ; RV64IDZFH-NEXT: fcvt.s.h fa0, fa0
5097 ; RV64IDZFH-NEXT: ret
5099 ; CHECKIZHINX-LABEL: fcvt_s_h:
5100 ; CHECKIZHINX: # %bb.0:
5101 ; CHECKIZHINX-NEXT: fcvt.s.h a0, a0
5102 ; CHECKIZHINX-NEXT: ret
5104 ; CHECKIZDINXZHINX-LABEL: fcvt_s_h:
5105 ; CHECKIZDINXZHINX: # %bb.0:
5106 ; CHECKIZDINXZHINX-NEXT: fcvt.s.h a0, a0
5107 ; CHECKIZDINXZHINX-NEXT: ret
5109 ; RV32I-LABEL: fcvt_s_h:
5111 ; RV32I-NEXT: addi sp, sp, -16
5112 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5113 ; RV32I-NEXT: call __extendhfsf2
5114 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5115 ; RV32I-NEXT: addi sp, sp, 16
5118 ; RV64I-LABEL: fcvt_s_h:
5120 ; RV64I-NEXT: addi sp, sp, -16
5121 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5122 ; RV64I-NEXT: call __extendhfsf2
5123 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5124 ; RV64I-NEXT: addi sp, sp, 16
5127 ; RV32ID-ILP32-LABEL: fcvt_s_h:
5128 ; RV32ID-ILP32: # %bb.0:
5129 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
5130 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5131 ; RV32ID-ILP32-NEXT: call __extendhfsf2
5132 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5133 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
5134 ; RV32ID-ILP32-NEXT: ret
5136 ; RV64ID-LP64-LABEL: fcvt_s_h:
5137 ; RV64ID-LP64: # %bb.0:
5138 ; RV64ID-LP64-NEXT: addi sp, sp, -16
5139 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5140 ; RV64ID-LP64-NEXT: call __extendhfsf2
5141 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5142 ; RV64ID-LP64-NEXT: addi sp, sp, 16
5143 ; RV64ID-LP64-NEXT: ret
5145 ; RV32ID-LABEL: fcvt_s_h:
5147 ; RV32ID-NEXT: addi sp, sp, -16
5148 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5149 ; RV32ID-NEXT: call __extendhfsf2
5150 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5151 ; RV32ID-NEXT: addi sp, sp, 16
5154 ; RV64ID-LABEL: fcvt_s_h:
5156 ; RV64ID-NEXT: addi sp, sp, -16
5157 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5158 ; RV64ID-NEXT: call __extendhfsf2
5159 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5160 ; RV64ID-NEXT: addi sp, sp, 16
5163 ; CHECK32-IZFHMIN-LABEL: fcvt_s_h:
5164 ; CHECK32-IZFHMIN: # %bb.0:
5165 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa0, fa0
5166 ; CHECK32-IZFHMIN-NEXT: ret
5168 ; CHECK64-IZFHMIN-LABEL: fcvt_s_h:
5169 ; CHECK64-IZFHMIN: # %bb.0:
5170 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa0, fa0
5171 ; CHECK64-IZFHMIN-NEXT: ret
5173 ; CHECK32-IZHINXMIN-LABEL: fcvt_s_h:
5174 ; CHECK32-IZHINXMIN: # %bb.0:
5175 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
5176 ; CHECK32-IZHINXMIN-NEXT: ret
5178 ; CHECK64-IZHINXMIN-LABEL: fcvt_s_h:
5179 ; CHECK64-IZHINXMIN: # %bb.0:
5180 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
5181 ; CHECK64-IZHINXMIN-NEXT: ret
5183 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_s_h:
5184 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5185 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
5186 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5188 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_s_h:
5189 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5190 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
5191 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5192 %1 = fpext half %a to float
5196 define half @fcvt_h_d(double %a) nounwind {
5197 ; RV32IZFH-LABEL: fcvt_h_d:
5198 ; RV32IZFH: # %bb.0:
5199 ; RV32IZFH-NEXT: addi sp, sp, -16
5200 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5201 ; RV32IZFH-NEXT: call __truncdfhf2
5202 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5203 ; RV32IZFH-NEXT: addi sp, sp, 16
5204 ; RV32IZFH-NEXT: ret
5206 ; RV64IZFH-LABEL: fcvt_h_d:
5207 ; RV64IZFH: # %bb.0:
5208 ; RV64IZFH-NEXT: addi sp, sp, -16
5209 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5210 ; RV64IZFH-NEXT: call __truncdfhf2
5211 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5212 ; RV64IZFH-NEXT: addi sp, sp, 16
5213 ; RV64IZFH-NEXT: ret
5215 ; RV32IDZFH-LABEL: fcvt_h_d:
5216 ; RV32IDZFH: # %bb.0:
5217 ; RV32IDZFH-NEXT: fcvt.h.d fa0, fa0
5218 ; RV32IDZFH-NEXT: ret
5220 ; RV64IDZFH-LABEL: fcvt_h_d:
5221 ; RV64IDZFH: # %bb.0:
5222 ; RV64IDZFH-NEXT: fcvt.h.d fa0, fa0
5223 ; RV64IDZFH-NEXT: ret
5225 ; RV32IZHINX-LABEL: fcvt_h_d:
5226 ; RV32IZHINX: # %bb.0:
5227 ; RV32IZHINX-NEXT: addi sp, sp, -16
5228 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5229 ; RV32IZHINX-NEXT: call __truncdfhf2
5230 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5231 ; RV32IZHINX-NEXT: addi sp, sp, 16
5232 ; RV32IZHINX-NEXT: ret
5234 ; RV64IZHINX-LABEL: fcvt_h_d:
5235 ; RV64IZHINX: # %bb.0:
5236 ; RV64IZHINX-NEXT: addi sp, sp, -16
5237 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5238 ; RV64IZHINX-NEXT: call __truncdfhf2
5239 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5240 ; RV64IZHINX-NEXT: addi sp, sp, 16
5241 ; RV64IZHINX-NEXT: ret
5243 ; RV32IZDINXZHINX-LABEL: fcvt_h_d:
5244 ; RV32IZDINXZHINX: # %bb.0:
5245 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
5246 ; RV32IZDINXZHINX-NEXT: sw a0, 8(sp)
5247 ; RV32IZDINXZHINX-NEXT: sw a1, 12(sp)
5248 ; RV32IZDINXZHINX-NEXT: lw a0, 8(sp)
5249 ; RV32IZDINXZHINX-NEXT: lw a1, 12(sp)
5250 ; RV32IZDINXZHINX-NEXT: fcvt.h.d a0, a0
5251 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
5252 ; RV32IZDINXZHINX-NEXT: ret
5254 ; RV64IZDINXZHINX-LABEL: fcvt_h_d:
5255 ; RV64IZDINXZHINX: # %bb.0:
5256 ; RV64IZDINXZHINX-NEXT: fcvt.h.d a0, a0
5257 ; RV64IZDINXZHINX-NEXT: ret
5259 ; RV32I-LABEL: fcvt_h_d:
5261 ; RV32I-NEXT: addi sp, sp, -16
5262 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5263 ; RV32I-NEXT: call __truncdfhf2
5264 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5265 ; RV32I-NEXT: addi sp, sp, 16
5268 ; RV64I-LABEL: fcvt_h_d:
5270 ; RV64I-NEXT: addi sp, sp, -16
5271 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5272 ; RV64I-NEXT: call __truncdfhf2
5273 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5274 ; RV64I-NEXT: addi sp, sp, 16
5277 ; RV32ID-ILP32-LABEL: fcvt_h_d:
5278 ; RV32ID-ILP32: # %bb.0:
5279 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
5280 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5281 ; RV32ID-ILP32-NEXT: call __truncdfhf2
5282 ; RV32ID-ILP32-NEXT: lui a1, 1048560
5283 ; RV32ID-ILP32-NEXT: or a0, a0, a1
5284 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5285 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
5286 ; RV32ID-ILP32-NEXT: ret
5288 ; RV64ID-LP64-LABEL: fcvt_h_d:
5289 ; RV64ID-LP64: # %bb.0:
5290 ; RV64ID-LP64-NEXT: addi sp, sp, -16
5291 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5292 ; RV64ID-LP64-NEXT: call __truncdfhf2
5293 ; RV64ID-LP64-NEXT: lui a1, 1048560
5294 ; RV64ID-LP64-NEXT: or a0, a0, a1
5295 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5296 ; RV64ID-LP64-NEXT: addi sp, sp, 16
5297 ; RV64ID-LP64-NEXT: ret
5299 ; RV32ID-LABEL: fcvt_h_d:
5301 ; RV32ID-NEXT: addi sp, sp, -16
5302 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5303 ; RV32ID-NEXT: call __truncdfhf2
5304 ; RV32ID-NEXT: fmv.x.w a0, fa0
5305 ; RV32ID-NEXT: lui a1, 1048560
5306 ; RV32ID-NEXT: or a0, a0, a1
5307 ; RV32ID-NEXT: fmv.w.x fa0, a0
5308 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5309 ; RV32ID-NEXT: addi sp, sp, 16
5312 ; RV64ID-LABEL: fcvt_h_d:
5314 ; RV64ID-NEXT: addi sp, sp, -16
5315 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5316 ; RV64ID-NEXT: call __truncdfhf2
5317 ; RV64ID-NEXT: fmv.x.w a0, fa0
5318 ; RV64ID-NEXT: lui a1, 1048560
5319 ; RV64ID-NEXT: or a0, a0, a1
5320 ; RV64ID-NEXT: fmv.w.x fa0, a0
5321 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5322 ; RV64ID-NEXT: addi sp, sp, 16
5325 ; RV32IFZFHMIN-LABEL: fcvt_h_d:
5326 ; RV32IFZFHMIN: # %bb.0:
5327 ; RV32IFZFHMIN-NEXT: addi sp, sp, -16
5328 ; RV32IFZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5329 ; RV32IFZFHMIN-NEXT: call __truncdfhf2
5330 ; RV32IFZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5331 ; RV32IFZFHMIN-NEXT: addi sp, sp, 16
5332 ; RV32IFZFHMIN-NEXT: ret
5334 ; RV64IFZFHMIN-LABEL: fcvt_h_d:
5335 ; RV64IFZFHMIN: # %bb.0:
5336 ; RV64IFZFHMIN-NEXT: addi sp, sp, -16
5337 ; RV64IFZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5338 ; RV64IFZFHMIN-NEXT: call __truncdfhf2
5339 ; RV64IFZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5340 ; RV64IFZFHMIN-NEXT: addi sp, sp, 16
5341 ; RV64IFZFHMIN-NEXT: ret
5343 ; RV32IDZFHMIN-LABEL: fcvt_h_d:
5344 ; RV32IDZFHMIN: # %bb.0:
5345 ; RV32IDZFHMIN-NEXT: fcvt.h.d fa0, fa0
5346 ; RV32IDZFHMIN-NEXT: ret
5348 ; RV64IDZFHMIN-LABEL: fcvt_h_d:
5349 ; RV64IDZFHMIN: # %bb.0:
5350 ; RV64IDZFHMIN-NEXT: fcvt.h.d fa0, fa0
5351 ; RV64IDZFHMIN-NEXT: ret
5353 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_d:
5354 ; CHECK32-IZHINXMIN: # %bb.0:
5355 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
5356 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5357 ; CHECK32-IZHINXMIN-NEXT: call __truncdfhf2
5358 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5359 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
5360 ; CHECK32-IZHINXMIN-NEXT: ret
5362 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_d:
5363 ; CHECK64-IZHINXMIN: # %bb.0:
5364 ; CHECK64-IZHINXMIN-NEXT: addi sp, sp, -16
5365 ; CHECK64-IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5366 ; CHECK64-IZHINXMIN-NEXT: call __truncdfhf2
5367 ; CHECK64-IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5368 ; CHECK64-IZHINXMIN-NEXT: addi sp, sp, 16
5369 ; CHECK64-IZHINXMIN-NEXT: ret
5371 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_d:
5372 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5373 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
5374 ; CHECK32-IZDINXZHINXMIN-NEXT: sw a0, 8(sp)
5375 ; CHECK32-IZDINXZHINXMIN-NEXT: sw a1, 12(sp)
5376 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a0, 8(sp)
5377 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a1, 12(sp)
5378 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.d a0, a0
5379 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
5380 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5382 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_d:
5383 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5384 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.d a0, a0
5385 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5386 %1 = fptrunc double %a to half
5390 define double @fcvt_d_h(half %a) nounwind {
5391 ; RV32IZFH-LABEL: fcvt_d_h:
5392 ; RV32IZFH: # %bb.0:
5393 ; RV32IZFH-NEXT: addi sp, sp, -16
5394 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5395 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
5396 ; RV32IZFH-NEXT: call __extendsfdf2
5397 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5398 ; RV32IZFH-NEXT: addi sp, sp, 16
5399 ; RV32IZFH-NEXT: ret
5401 ; RV64IZFH-LABEL: fcvt_d_h:
5402 ; RV64IZFH: # %bb.0:
5403 ; RV64IZFH-NEXT: addi sp, sp, -16
5404 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5405 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
5406 ; RV64IZFH-NEXT: call __extendsfdf2
5407 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5408 ; RV64IZFH-NEXT: addi sp, sp, 16
5409 ; RV64IZFH-NEXT: ret
5411 ; RV32IDZFH-LABEL: fcvt_d_h:
5412 ; RV32IDZFH: # %bb.0:
5413 ; RV32IDZFH-NEXT: fcvt.d.h fa0, fa0
5414 ; RV32IDZFH-NEXT: ret
5416 ; RV64IDZFH-LABEL: fcvt_d_h:
5417 ; RV64IDZFH: # %bb.0:
5418 ; RV64IDZFH-NEXT: fcvt.d.h fa0, fa0
5419 ; RV64IDZFH-NEXT: ret
5421 ; RV32IZHINX-LABEL: fcvt_d_h:
5422 ; RV32IZHINX: # %bb.0:
5423 ; RV32IZHINX-NEXT: addi sp, sp, -16
5424 ; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5425 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
5426 ; RV32IZHINX-NEXT: call __extendsfdf2
5427 ; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5428 ; RV32IZHINX-NEXT: addi sp, sp, 16
5429 ; RV32IZHINX-NEXT: ret
5431 ; RV64IZHINX-LABEL: fcvt_d_h:
5432 ; RV64IZHINX: # %bb.0:
5433 ; RV64IZHINX-NEXT: addi sp, sp, -16
5434 ; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5435 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
5436 ; RV64IZHINX-NEXT: call __extendsfdf2
5437 ; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5438 ; RV64IZHINX-NEXT: addi sp, sp, 16
5439 ; RV64IZHINX-NEXT: ret
5441 ; RV32IZDINXZHINX-LABEL: fcvt_d_h:
5442 ; RV32IZDINXZHINX: # %bb.0:
5443 ; RV32IZDINXZHINX-NEXT: addi sp, sp, -16
5444 ; RV32IZDINXZHINX-NEXT: fcvt.d.h a0, a0
5445 ; RV32IZDINXZHINX-NEXT: sw a0, 8(sp)
5446 ; RV32IZDINXZHINX-NEXT: sw a1, 12(sp)
5447 ; RV32IZDINXZHINX-NEXT: lw a0, 8(sp)
5448 ; RV32IZDINXZHINX-NEXT: lw a1, 12(sp)
5449 ; RV32IZDINXZHINX-NEXT: addi sp, sp, 16
5450 ; RV32IZDINXZHINX-NEXT: ret
5452 ; RV64IZDINXZHINX-LABEL: fcvt_d_h:
5453 ; RV64IZDINXZHINX: # %bb.0:
5454 ; RV64IZDINXZHINX-NEXT: fcvt.d.h a0, a0
5455 ; RV64IZDINXZHINX-NEXT: ret
5457 ; RV32I-LABEL: fcvt_d_h:
5459 ; RV32I-NEXT: addi sp, sp, -16
5460 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5461 ; RV32I-NEXT: call __extendhfsf2
5462 ; RV32I-NEXT: call __extendsfdf2
5463 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5464 ; RV32I-NEXT: addi sp, sp, 16
5467 ; RV64I-LABEL: fcvt_d_h:
5469 ; RV64I-NEXT: addi sp, sp, -16
5470 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5471 ; RV64I-NEXT: call __extendhfsf2
5472 ; RV64I-NEXT: call __extendsfdf2
5473 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5474 ; RV64I-NEXT: addi sp, sp, 16
5477 ; RV32ID-ILP32-LABEL: fcvt_d_h:
5478 ; RV32ID-ILP32: # %bb.0:
5479 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
5480 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5481 ; RV32ID-ILP32-NEXT: call __extendhfsf2
5482 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
5483 ; RV32ID-ILP32-NEXT: fcvt.d.s fa5, fa5
5484 ; RV32ID-ILP32-NEXT: fsd fa5, 0(sp)
5485 ; RV32ID-ILP32-NEXT: lw a0, 0(sp)
5486 ; RV32ID-ILP32-NEXT: lw a1, 4(sp)
5487 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5488 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
5489 ; RV32ID-ILP32-NEXT: ret
5491 ; RV64ID-LP64-LABEL: fcvt_d_h:
5492 ; RV64ID-LP64: # %bb.0:
5493 ; RV64ID-LP64-NEXT: addi sp, sp, -16
5494 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5495 ; RV64ID-LP64-NEXT: call __extendhfsf2
5496 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
5497 ; RV64ID-LP64-NEXT: fcvt.d.s fa5, fa5
5498 ; RV64ID-LP64-NEXT: fmv.x.d a0, fa5
5499 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5500 ; RV64ID-LP64-NEXT: addi sp, sp, 16
5501 ; RV64ID-LP64-NEXT: ret
5503 ; RV32ID-LABEL: fcvt_d_h:
5505 ; RV32ID-NEXT: addi sp, sp, -16
5506 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5507 ; RV32ID-NEXT: call __extendhfsf2
5508 ; RV32ID-NEXT: fcvt.d.s fa0, fa0
5509 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5510 ; RV32ID-NEXT: addi sp, sp, 16
5513 ; RV64ID-LABEL: fcvt_d_h:
5515 ; RV64ID-NEXT: addi sp, sp, -16
5516 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5517 ; RV64ID-NEXT: call __extendhfsf2
5518 ; RV64ID-NEXT: fcvt.d.s fa0, fa0
5519 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5520 ; RV64ID-NEXT: addi sp, sp, 16
5523 ; RV32IFZFHMIN-LABEL: fcvt_d_h:
5524 ; RV32IFZFHMIN: # %bb.0:
5525 ; RV32IFZFHMIN-NEXT: addi sp, sp, -16
5526 ; RV32IFZFHMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5527 ; RV32IFZFHMIN-NEXT: fcvt.s.h fa0, fa0
5528 ; RV32IFZFHMIN-NEXT: call __extendsfdf2
5529 ; RV32IFZFHMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5530 ; RV32IFZFHMIN-NEXT: addi sp, sp, 16
5531 ; RV32IFZFHMIN-NEXT: ret
5533 ; RV64IFZFHMIN-LABEL: fcvt_d_h:
5534 ; RV64IFZFHMIN: # %bb.0:
5535 ; RV64IFZFHMIN-NEXT: addi sp, sp, -16
5536 ; RV64IFZFHMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5537 ; RV64IFZFHMIN-NEXT: fcvt.s.h fa0, fa0
5538 ; RV64IFZFHMIN-NEXT: call __extendsfdf2
5539 ; RV64IFZFHMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5540 ; RV64IFZFHMIN-NEXT: addi sp, sp, 16
5541 ; RV64IFZFHMIN-NEXT: ret
5543 ; RV32IDZFHMIN-LABEL: fcvt_d_h:
5544 ; RV32IDZFHMIN: # %bb.0:
5545 ; RV32IDZFHMIN-NEXT: fcvt.d.h fa0, fa0
5546 ; RV32IDZFHMIN-NEXT: ret
5548 ; RV64IDZFHMIN-LABEL: fcvt_d_h:
5549 ; RV64IDZFHMIN: # %bb.0:
5550 ; RV64IDZFHMIN-NEXT: fcvt.d.h fa0, fa0
5551 ; RV64IDZFHMIN-NEXT: ret
5553 ; CHECK32-IZHINXMIN-LABEL: fcvt_d_h:
5554 ; CHECK32-IZHINXMIN: # %bb.0:
5555 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, -16
5556 ; CHECK32-IZHINXMIN-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5557 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
5558 ; CHECK32-IZHINXMIN-NEXT: call __extendsfdf2
5559 ; CHECK32-IZHINXMIN-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5560 ; CHECK32-IZHINXMIN-NEXT: addi sp, sp, 16
5561 ; CHECK32-IZHINXMIN-NEXT: ret
5563 ; CHECK64-IZHINXMIN-LABEL: fcvt_d_h:
5564 ; CHECK64-IZHINXMIN: # %bb.0:
5565 ; CHECK64-IZHINXMIN-NEXT: addi sp, sp, -16
5566 ; CHECK64-IZHINXMIN-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
5567 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
5568 ; CHECK64-IZHINXMIN-NEXT: call __extendsfdf2
5569 ; CHECK64-IZHINXMIN-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
5570 ; CHECK64-IZHINXMIN-NEXT: addi sp, sp, 16
5571 ; CHECK64-IZHINXMIN-NEXT: ret
5573 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_d_h:
5574 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5575 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, -16
5576 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.d.h a0, a0
5577 ; CHECK32-IZDINXZHINXMIN-NEXT: sw a0, 8(sp)
5578 ; CHECK32-IZDINXZHINXMIN-NEXT: sw a1, 12(sp)
5579 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a0, 8(sp)
5580 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a1, 12(sp)
5581 ; CHECK32-IZDINXZHINXMIN-NEXT: addi sp, sp, 16
5582 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5584 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_d_h:
5585 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5586 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.d.h a0, a0
5587 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5588 %1 = fpext half %a to double
5592 define half @bitcast_h_i16(i16 %a) nounwind {
5593 ; CHECKIZFH-LABEL: bitcast_h_i16:
5594 ; CHECKIZFH: # %bb.0:
5595 ; CHECKIZFH-NEXT: fmv.h.x fa0, a0
5596 ; CHECKIZFH-NEXT: ret
5598 ; RV32IDZFH-LABEL: bitcast_h_i16:
5599 ; RV32IDZFH: # %bb.0:
5600 ; RV32IDZFH-NEXT: fmv.h.x fa0, a0
5601 ; RV32IDZFH-NEXT: ret
5603 ; RV64IDZFH-LABEL: bitcast_h_i16:
5604 ; RV64IDZFH: # %bb.0:
5605 ; RV64IDZFH-NEXT: fmv.h.x fa0, a0
5606 ; RV64IDZFH-NEXT: ret
5608 ; CHECKIZHINX-LABEL: bitcast_h_i16:
5609 ; CHECKIZHINX: # %bb.0:
5610 ; CHECKIZHINX-NEXT: ret
5612 ; CHECKIZDINXZHINX-LABEL: bitcast_h_i16:
5613 ; CHECKIZDINXZHINX: # %bb.0:
5614 ; CHECKIZDINXZHINX-NEXT: ret
5616 ; RV32I-LABEL: bitcast_h_i16:
5620 ; RV64I-LABEL: bitcast_h_i16:
5624 ; RV32ID-ILP32-LABEL: bitcast_h_i16:
5625 ; RV32ID-ILP32: # %bb.0:
5626 ; RV32ID-ILP32-NEXT: lui a1, 1048560
5627 ; RV32ID-ILP32-NEXT: or a0, a0, a1
5628 ; RV32ID-ILP32-NEXT: ret
5630 ; RV64ID-LP64-LABEL: bitcast_h_i16:
5631 ; RV64ID-LP64: # %bb.0:
5632 ; RV64ID-LP64-NEXT: lui a1, 1048560
5633 ; RV64ID-LP64-NEXT: or a0, a0, a1
5634 ; RV64ID-LP64-NEXT: ret
5636 ; RV32ID-LABEL: bitcast_h_i16:
5638 ; RV32ID-NEXT: lui a1, 1048560
5639 ; RV32ID-NEXT: or a0, a0, a1
5640 ; RV32ID-NEXT: fmv.w.x fa0, a0
5643 ; RV64ID-LABEL: bitcast_h_i16:
5645 ; RV64ID-NEXT: lui a1, 1048560
5646 ; RV64ID-NEXT: or a0, a0, a1
5647 ; RV64ID-NEXT: fmv.w.x fa0, a0
5650 ; CHECK32-IZFHMIN-LABEL: bitcast_h_i16:
5651 ; CHECK32-IZFHMIN: # %bb.0:
5652 ; CHECK32-IZFHMIN-NEXT: fmv.h.x fa0, a0
5653 ; CHECK32-IZFHMIN-NEXT: ret
5655 ; CHECK64-IZFHMIN-LABEL: bitcast_h_i16:
5656 ; CHECK64-IZFHMIN: # %bb.0:
5657 ; CHECK64-IZFHMIN-NEXT: fmv.h.x fa0, a0
5658 ; CHECK64-IZFHMIN-NEXT: ret
5660 ; CHECK32-IZHINXMIN-LABEL: bitcast_h_i16:
5661 ; CHECK32-IZHINXMIN: # %bb.0:
5662 ; CHECK32-IZHINXMIN-NEXT: ret
5664 ; CHECK64-IZHINXMIN-LABEL: bitcast_h_i16:
5665 ; CHECK64-IZHINXMIN: # %bb.0:
5666 ; CHECK64-IZHINXMIN-NEXT: ret
5668 ; CHECK32-IZDINXZHINXMIN-LABEL: bitcast_h_i16:
5669 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5670 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5672 ; CHECK64-IZDINXZHINXMIN-LABEL: bitcast_h_i16:
5673 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5674 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5675 %1 = bitcast i16 %a to half
5679 define i16 @bitcast_i16_h(half %a) nounwind {
5680 ; CHECKIZFH-LABEL: bitcast_i16_h:
5681 ; CHECKIZFH: # %bb.0:
5682 ; CHECKIZFH-NEXT: fmv.x.h a0, fa0
5683 ; CHECKIZFH-NEXT: ret
5685 ; RV32IDZFH-LABEL: bitcast_i16_h:
5686 ; RV32IDZFH: # %bb.0:
5687 ; RV32IDZFH-NEXT: fmv.x.h a0, fa0
5688 ; RV32IDZFH-NEXT: ret
5690 ; RV64IDZFH-LABEL: bitcast_i16_h:
5691 ; RV64IDZFH: # %bb.0:
5692 ; RV64IDZFH-NEXT: fmv.x.h a0, fa0
5693 ; RV64IDZFH-NEXT: ret
5695 ; CHECKIZHINX-LABEL: bitcast_i16_h:
5696 ; CHECKIZHINX: # %bb.0:
5697 ; CHECKIZHINX-NEXT: ret
5699 ; CHECKIZDINXZHINX-LABEL: bitcast_i16_h:
5700 ; CHECKIZDINXZHINX: # %bb.0:
5701 ; CHECKIZDINXZHINX-NEXT: ret
5703 ; RV32I-LABEL: bitcast_i16_h:
5707 ; RV64I-LABEL: bitcast_i16_h:
5711 ; RV32ID-ILP32-LABEL: bitcast_i16_h:
5712 ; RV32ID-ILP32: # %bb.0:
5713 ; RV32ID-ILP32-NEXT: ret
5715 ; RV64ID-LP64-LABEL: bitcast_i16_h:
5716 ; RV64ID-LP64: # %bb.0:
5717 ; RV64ID-LP64-NEXT: ret
5719 ; RV32ID-LABEL: bitcast_i16_h:
5721 ; RV32ID-NEXT: fmv.x.w a0, fa0
5724 ; RV64ID-LABEL: bitcast_i16_h:
5726 ; RV64ID-NEXT: fmv.x.w a0, fa0
5729 ; CHECK32-IZFHMIN-LABEL: bitcast_i16_h:
5730 ; CHECK32-IZFHMIN: # %bb.0:
5731 ; CHECK32-IZFHMIN-NEXT: fmv.x.h a0, fa0
5732 ; CHECK32-IZFHMIN-NEXT: ret
5734 ; CHECK64-IZFHMIN-LABEL: bitcast_i16_h:
5735 ; CHECK64-IZFHMIN: # %bb.0:
5736 ; CHECK64-IZFHMIN-NEXT: fmv.x.h a0, fa0
5737 ; CHECK64-IZFHMIN-NEXT: ret
5739 ; CHECK32-IZHINXMIN-LABEL: bitcast_i16_h:
5740 ; CHECK32-IZHINXMIN: # %bb.0:
5741 ; CHECK32-IZHINXMIN-NEXT: ret
5743 ; CHECK64-IZHINXMIN-LABEL: bitcast_i16_h:
5744 ; CHECK64-IZHINXMIN: # %bb.0:
5745 ; CHECK64-IZHINXMIN-NEXT: ret
5747 ; CHECK32-IZDINXZHINXMIN-LABEL: bitcast_i16_h:
5748 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5749 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5751 ; CHECK64-IZDINXZHINXMIN-LABEL: bitcast_i16_h:
5752 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5753 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5754 %1 = bitcast half %a to i16
5758 ; Make sure we select W version of addi on RV64.
5759 define signext i32 @fcvt_h_w_demanded_bits(i32 signext %0, ptr %1) nounwind {
5760 ; RV32IZFH-LABEL: fcvt_h_w_demanded_bits:
5761 ; RV32IZFH: # %bb.0:
5762 ; RV32IZFH-NEXT: addi a0, a0, 1
5763 ; RV32IZFH-NEXT: fcvt.h.w fa5, a0
5764 ; RV32IZFH-NEXT: fsh fa5, 0(a1)
5765 ; RV32IZFH-NEXT: ret
5767 ; RV64IZFH-LABEL: fcvt_h_w_demanded_bits:
5768 ; RV64IZFH: # %bb.0:
5769 ; RV64IZFH-NEXT: addiw a0, a0, 1
5770 ; RV64IZFH-NEXT: fcvt.h.w fa5, a0
5771 ; RV64IZFH-NEXT: fsh fa5, 0(a1)
5772 ; RV64IZFH-NEXT: ret
5774 ; RV32IDZFH-LABEL: fcvt_h_w_demanded_bits:
5775 ; RV32IDZFH: # %bb.0:
5776 ; RV32IDZFH-NEXT: addi a0, a0, 1
5777 ; RV32IDZFH-NEXT: fcvt.h.w fa5, a0
5778 ; RV32IDZFH-NEXT: fsh fa5, 0(a1)
5779 ; RV32IDZFH-NEXT: ret
5781 ; RV64IDZFH-LABEL: fcvt_h_w_demanded_bits:
5782 ; RV64IDZFH: # %bb.0:
5783 ; RV64IDZFH-NEXT: addiw a0, a0, 1
5784 ; RV64IDZFH-NEXT: fcvt.h.w fa5, a0
5785 ; RV64IDZFH-NEXT: fsh fa5, 0(a1)
5786 ; RV64IDZFH-NEXT: ret
5788 ; RV32IZHINX-LABEL: fcvt_h_w_demanded_bits:
5789 ; RV32IZHINX: # %bb.0:
5790 ; RV32IZHINX-NEXT: addi a0, a0, 1
5791 ; RV32IZHINX-NEXT: fcvt.h.w a2, a0
5792 ; RV32IZHINX-NEXT: sh a2, 0(a1)
5793 ; RV32IZHINX-NEXT: ret
5795 ; RV64IZHINX-LABEL: fcvt_h_w_demanded_bits:
5796 ; RV64IZHINX: # %bb.0:
5797 ; RV64IZHINX-NEXT: addiw a2, a0, 1
5798 ; RV64IZHINX-NEXT: addi a0, a0, 1
5799 ; RV64IZHINX-NEXT: fcvt.h.w a0, a0
5800 ; RV64IZHINX-NEXT: sh a0, 0(a1)
5801 ; RV64IZHINX-NEXT: mv a0, a2
5802 ; RV64IZHINX-NEXT: ret
5804 ; RV32IZDINXZHINX-LABEL: fcvt_h_w_demanded_bits:
5805 ; RV32IZDINXZHINX: # %bb.0:
5806 ; RV32IZDINXZHINX-NEXT: addi a0, a0, 1
5807 ; RV32IZDINXZHINX-NEXT: fcvt.h.w a2, a0
5808 ; RV32IZDINXZHINX-NEXT: sh a2, 0(a1)
5809 ; RV32IZDINXZHINX-NEXT: ret
5811 ; RV64IZDINXZHINX-LABEL: fcvt_h_w_demanded_bits:
5812 ; RV64IZDINXZHINX: # %bb.0:
5813 ; RV64IZDINXZHINX-NEXT: addiw a2, a0, 1
5814 ; RV64IZDINXZHINX-NEXT: addi a0, a0, 1
5815 ; RV64IZDINXZHINX-NEXT: fcvt.h.w a0, a0
5816 ; RV64IZDINXZHINX-NEXT: sh a0, 0(a1)
5817 ; RV64IZDINXZHINX-NEXT: mv a0, a2
5818 ; RV64IZDINXZHINX-NEXT: ret
5820 ; RV32I-LABEL: fcvt_h_w_demanded_bits:
5822 ; RV32I-NEXT: addi sp, sp, -16
5823 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5824 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
5825 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
5826 ; RV32I-NEXT: mv s0, a1
5827 ; RV32I-NEXT: addi s1, a0, 1
5828 ; RV32I-NEXT: mv a0, s1
5829 ; RV32I-NEXT: call __floatsisf
5830 ; RV32I-NEXT: call __truncsfhf2
5831 ; RV32I-NEXT: sh a0, 0(s0)
5832 ; RV32I-NEXT: mv a0, s1
5833 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5834 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
5835 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
5836 ; RV32I-NEXT: addi sp, sp, 16
5839 ; RV64I-LABEL: fcvt_h_w_demanded_bits:
5841 ; RV64I-NEXT: addi sp, sp, -32
5842 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
5843 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
5844 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
5845 ; RV64I-NEXT: mv s0, a1
5846 ; RV64I-NEXT: addiw s1, a0, 1
5847 ; RV64I-NEXT: mv a0, s1
5848 ; RV64I-NEXT: call __floatsisf
5849 ; RV64I-NEXT: call __truncsfhf2
5850 ; RV64I-NEXT: sh a0, 0(s0)
5851 ; RV64I-NEXT: mv a0, s1
5852 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
5853 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
5854 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
5855 ; RV64I-NEXT: addi sp, sp, 32
5858 ; RV32ID-ILP32-LABEL: fcvt_h_w_demanded_bits:
5859 ; RV32ID-ILP32: # %bb.0:
5860 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
5861 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5862 ; RV32ID-ILP32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
5863 ; RV32ID-ILP32-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
5864 ; RV32ID-ILP32-NEXT: mv s0, a1
5865 ; RV32ID-ILP32-NEXT: addi s1, a0, 1
5866 ; RV32ID-ILP32-NEXT: fcvt.s.w fa5, s1
5867 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
5868 ; RV32ID-ILP32-NEXT: call __truncsfhf2
5869 ; RV32ID-ILP32-NEXT: sh a0, 0(s0)
5870 ; RV32ID-ILP32-NEXT: mv a0, s1
5871 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5872 ; RV32ID-ILP32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
5873 ; RV32ID-ILP32-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
5874 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
5875 ; RV32ID-ILP32-NEXT: ret
5877 ; RV64ID-LP64-LABEL: fcvt_h_w_demanded_bits:
5878 ; RV64ID-LP64: # %bb.0:
5879 ; RV64ID-LP64-NEXT: addi sp, sp, -32
5880 ; RV64ID-LP64-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
5881 ; RV64ID-LP64-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
5882 ; RV64ID-LP64-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
5883 ; RV64ID-LP64-NEXT: mv s0, a1
5884 ; RV64ID-LP64-NEXT: addiw s1, a0, 1
5885 ; RV64ID-LP64-NEXT: fcvt.s.w fa5, s1
5886 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
5887 ; RV64ID-LP64-NEXT: call __truncsfhf2
5888 ; RV64ID-LP64-NEXT: sh a0, 0(s0)
5889 ; RV64ID-LP64-NEXT: mv a0, s1
5890 ; RV64ID-LP64-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
5891 ; RV64ID-LP64-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
5892 ; RV64ID-LP64-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
5893 ; RV64ID-LP64-NEXT: addi sp, sp, 32
5894 ; RV64ID-LP64-NEXT: ret
5896 ; RV32ID-LABEL: fcvt_h_w_demanded_bits:
5898 ; RV32ID-NEXT: addi sp, sp, -16
5899 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
5900 ; RV32ID-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
5901 ; RV32ID-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
5902 ; RV32ID-NEXT: mv s0, a1
5903 ; RV32ID-NEXT: addi s1, a0, 1
5904 ; RV32ID-NEXT: fcvt.s.w fa0, s1
5905 ; RV32ID-NEXT: call __truncsfhf2
5906 ; RV32ID-NEXT: fmv.x.w a0, fa0
5907 ; RV32ID-NEXT: sh a0, 0(s0)
5908 ; RV32ID-NEXT: mv a0, s1
5909 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
5910 ; RV32ID-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
5911 ; RV32ID-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
5912 ; RV32ID-NEXT: addi sp, sp, 16
5915 ; RV64ID-LABEL: fcvt_h_w_demanded_bits:
5917 ; RV64ID-NEXT: addi sp, sp, -32
5918 ; RV64ID-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
5919 ; RV64ID-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
5920 ; RV64ID-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
5921 ; RV64ID-NEXT: mv s0, a1
5922 ; RV64ID-NEXT: addiw s1, a0, 1
5923 ; RV64ID-NEXT: fcvt.s.w fa0, s1
5924 ; RV64ID-NEXT: call __truncsfhf2
5925 ; RV64ID-NEXT: fmv.x.w a0, fa0
5926 ; RV64ID-NEXT: sh a0, 0(s0)
5927 ; RV64ID-NEXT: mv a0, s1
5928 ; RV64ID-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
5929 ; RV64ID-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
5930 ; RV64ID-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
5931 ; RV64ID-NEXT: addi sp, sp, 32
5934 ; CHECK32-IZFHMIN-LABEL: fcvt_h_w_demanded_bits:
5935 ; CHECK32-IZFHMIN: # %bb.0:
5936 ; CHECK32-IZFHMIN-NEXT: addi a0, a0, 1
5937 ; CHECK32-IZFHMIN-NEXT: fcvt.s.w fa5, a0
5938 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa5, fa5
5939 ; CHECK32-IZFHMIN-NEXT: fsh fa5, 0(a1)
5940 ; CHECK32-IZFHMIN-NEXT: ret
5942 ; CHECK64-IZFHMIN-LABEL: fcvt_h_w_demanded_bits:
5943 ; CHECK64-IZFHMIN: # %bb.0:
5944 ; CHECK64-IZFHMIN-NEXT: addiw a0, a0, 1
5945 ; CHECK64-IZFHMIN-NEXT: fcvt.s.l fa5, a0
5946 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa5, fa5
5947 ; CHECK64-IZFHMIN-NEXT: fsh fa5, 0(a1)
5948 ; CHECK64-IZFHMIN-NEXT: ret
5950 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_w_demanded_bits:
5951 ; CHECK32-IZHINXMIN: # %bb.0:
5952 ; CHECK32-IZHINXMIN-NEXT: addi a0, a0, 1
5953 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.w a2, a0
5954 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a2, a2
5955 ; CHECK32-IZHINXMIN-NEXT: sh a2, 0(a1)
5956 ; CHECK32-IZHINXMIN-NEXT: ret
5958 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_w_demanded_bits:
5959 ; CHECK64-IZHINXMIN: # %bb.0:
5960 ; CHECK64-IZHINXMIN-NEXT: addiw a0, a0, 1
5961 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.l a2, a0
5962 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a2, a2
5963 ; CHECK64-IZHINXMIN-NEXT: sh a2, 0(a1)
5964 ; CHECK64-IZHINXMIN-NEXT: ret
5966 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_w_demanded_bits:
5967 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
5968 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a0, a0, 1
5969 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.w a2, a0
5970 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a2, a2
5971 ; CHECK32-IZDINXZHINXMIN-NEXT: sh a2, 0(a1)
5972 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
5974 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_w_demanded_bits:
5975 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
5976 ; CHECK64-IZDINXZHINXMIN-NEXT: addiw a0, a0, 1
5977 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.l a2, a0
5978 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a2, a2
5979 ; CHECK64-IZDINXZHINXMIN-NEXT: sh a2, 0(a1)
5980 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
5982 %4 = sitofp i32 %3 to half
5983 store half %4, ptr %1, align 2
5987 ; Make sure we select W version of addi on RV64.
5988 define signext i32 @fcvt_h_wu_demanded_bits(i32 signext %0, ptr %1) nounwind {
5989 ; RV32IZFH-LABEL: fcvt_h_wu_demanded_bits:
5990 ; RV32IZFH: # %bb.0:
5991 ; RV32IZFH-NEXT: addi a0, a0, 1
5992 ; RV32IZFH-NEXT: fcvt.h.wu fa5, a0
5993 ; RV32IZFH-NEXT: fsh fa5, 0(a1)
5994 ; RV32IZFH-NEXT: ret
5996 ; RV64IZFH-LABEL: fcvt_h_wu_demanded_bits:
5997 ; RV64IZFH: # %bb.0:
5998 ; RV64IZFH-NEXT: addiw a0, a0, 1
5999 ; RV64IZFH-NEXT: fcvt.h.wu fa5, a0
6000 ; RV64IZFH-NEXT: fsh fa5, 0(a1)
6001 ; RV64IZFH-NEXT: ret
6003 ; RV32IDZFH-LABEL: fcvt_h_wu_demanded_bits:
6004 ; RV32IDZFH: # %bb.0:
6005 ; RV32IDZFH-NEXT: addi a0, a0, 1
6006 ; RV32IDZFH-NEXT: fcvt.h.wu fa5, a0
6007 ; RV32IDZFH-NEXT: fsh fa5, 0(a1)
6008 ; RV32IDZFH-NEXT: ret
6010 ; RV64IDZFH-LABEL: fcvt_h_wu_demanded_bits:
6011 ; RV64IDZFH: # %bb.0:
6012 ; RV64IDZFH-NEXT: addiw a0, a0, 1
6013 ; RV64IDZFH-NEXT: fcvt.h.wu fa5, a0
6014 ; RV64IDZFH-NEXT: fsh fa5, 0(a1)
6015 ; RV64IDZFH-NEXT: ret
6017 ; RV32IZHINX-LABEL: fcvt_h_wu_demanded_bits:
6018 ; RV32IZHINX: # %bb.0:
6019 ; RV32IZHINX-NEXT: addi a0, a0, 1
6020 ; RV32IZHINX-NEXT: fcvt.h.wu a2, a0
6021 ; RV32IZHINX-NEXT: sh a2, 0(a1)
6022 ; RV32IZHINX-NEXT: ret
6024 ; RV64IZHINX-LABEL: fcvt_h_wu_demanded_bits:
6025 ; RV64IZHINX: # %bb.0:
6026 ; RV64IZHINX-NEXT: addiw a0, a0, 1
6027 ; RV64IZHINX-NEXT: fcvt.h.wu a2, a0
6028 ; RV64IZHINX-NEXT: sh a2, 0(a1)
6029 ; RV64IZHINX-NEXT: ret
6031 ; RV32IZDINXZHINX-LABEL: fcvt_h_wu_demanded_bits:
6032 ; RV32IZDINXZHINX: # %bb.0:
6033 ; RV32IZDINXZHINX-NEXT: addi a0, a0, 1
6034 ; RV32IZDINXZHINX-NEXT: fcvt.h.wu a2, a0
6035 ; RV32IZDINXZHINX-NEXT: sh a2, 0(a1)
6036 ; RV32IZDINXZHINX-NEXT: ret
6038 ; RV64IZDINXZHINX-LABEL: fcvt_h_wu_demanded_bits:
6039 ; RV64IZDINXZHINX: # %bb.0:
6040 ; RV64IZDINXZHINX-NEXT: addiw a0, a0, 1
6041 ; RV64IZDINXZHINX-NEXT: fcvt.h.wu a2, a0
6042 ; RV64IZDINXZHINX-NEXT: sh a2, 0(a1)
6043 ; RV64IZDINXZHINX-NEXT: ret
6045 ; RV32I-LABEL: fcvt_h_wu_demanded_bits:
6047 ; RV32I-NEXT: addi sp, sp, -16
6048 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6049 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
6050 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
6051 ; RV32I-NEXT: mv s0, a1
6052 ; RV32I-NEXT: addi s1, a0, 1
6053 ; RV32I-NEXT: mv a0, s1
6054 ; RV32I-NEXT: call __floatunsisf
6055 ; RV32I-NEXT: call __truncsfhf2
6056 ; RV32I-NEXT: sh a0, 0(s0)
6057 ; RV32I-NEXT: mv a0, s1
6058 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6059 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
6060 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
6061 ; RV32I-NEXT: addi sp, sp, 16
6064 ; RV64I-LABEL: fcvt_h_wu_demanded_bits:
6066 ; RV64I-NEXT: addi sp, sp, -32
6067 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
6068 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
6069 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
6070 ; RV64I-NEXT: mv s0, a1
6071 ; RV64I-NEXT: addiw s1, a0, 1
6072 ; RV64I-NEXT: mv a0, s1
6073 ; RV64I-NEXT: call __floatunsisf
6074 ; RV64I-NEXT: call __truncsfhf2
6075 ; RV64I-NEXT: sh a0, 0(s0)
6076 ; RV64I-NEXT: mv a0, s1
6077 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
6078 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
6079 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
6080 ; RV64I-NEXT: addi sp, sp, 32
6083 ; RV32ID-ILP32-LABEL: fcvt_h_wu_demanded_bits:
6084 ; RV32ID-ILP32: # %bb.0:
6085 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
6086 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6087 ; RV32ID-ILP32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
6088 ; RV32ID-ILP32-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
6089 ; RV32ID-ILP32-NEXT: mv s0, a1
6090 ; RV32ID-ILP32-NEXT: addi s1, a0, 1
6091 ; RV32ID-ILP32-NEXT: fcvt.s.wu fa5, s1
6092 ; RV32ID-ILP32-NEXT: fmv.x.w a0, fa5
6093 ; RV32ID-ILP32-NEXT: call __truncsfhf2
6094 ; RV32ID-ILP32-NEXT: sh a0, 0(s0)
6095 ; RV32ID-ILP32-NEXT: mv a0, s1
6096 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6097 ; RV32ID-ILP32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
6098 ; RV32ID-ILP32-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
6099 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
6100 ; RV32ID-ILP32-NEXT: ret
6102 ; RV64ID-LP64-LABEL: fcvt_h_wu_demanded_bits:
6103 ; RV64ID-LP64: # %bb.0:
6104 ; RV64ID-LP64-NEXT: addi sp, sp, -32
6105 ; RV64ID-LP64-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
6106 ; RV64ID-LP64-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
6107 ; RV64ID-LP64-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
6108 ; RV64ID-LP64-NEXT: mv s0, a1
6109 ; RV64ID-LP64-NEXT: addiw s1, a0, 1
6110 ; RV64ID-LP64-NEXT: fcvt.s.wu fa5, s1
6111 ; RV64ID-LP64-NEXT: fmv.x.w a0, fa5
6112 ; RV64ID-LP64-NEXT: call __truncsfhf2
6113 ; RV64ID-LP64-NEXT: sh a0, 0(s0)
6114 ; RV64ID-LP64-NEXT: mv a0, s1
6115 ; RV64ID-LP64-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
6116 ; RV64ID-LP64-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
6117 ; RV64ID-LP64-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
6118 ; RV64ID-LP64-NEXT: addi sp, sp, 32
6119 ; RV64ID-LP64-NEXT: ret
6121 ; RV32ID-LABEL: fcvt_h_wu_demanded_bits:
6123 ; RV32ID-NEXT: addi sp, sp, -16
6124 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6125 ; RV32ID-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
6126 ; RV32ID-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
6127 ; RV32ID-NEXT: mv s0, a1
6128 ; RV32ID-NEXT: addi s1, a0, 1
6129 ; RV32ID-NEXT: fcvt.s.wu fa0, s1
6130 ; RV32ID-NEXT: call __truncsfhf2
6131 ; RV32ID-NEXT: fmv.x.w a0, fa0
6132 ; RV32ID-NEXT: sh a0, 0(s0)
6133 ; RV32ID-NEXT: mv a0, s1
6134 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6135 ; RV32ID-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
6136 ; RV32ID-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
6137 ; RV32ID-NEXT: addi sp, sp, 16
6140 ; RV64ID-LABEL: fcvt_h_wu_demanded_bits:
6142 ; RV64ID-NEXT: addi sp, sp, -32
6143 ; RV64ID-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
6144 ; RV64ID-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
6145 ; RV64ID-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
6146 ; RV64ID-NEXT: mv s0, a1
6147 ; RV64ID-NEXT: addiw s1, a0, 1
6148 ; RV64ID-NEXT: fcvt.s.wu fa0, s1
6149 ; RV64ID-NEXT: call __truncsfhf2
6150 ; RV64ID-NEXT: fmv.x.w a0, fa0
6151 ; RV64ID-NEXT: sh a0, 0(s0)
6152 ; RV64ID-NEXT: mv a0, s1
6153 ; RV64ID-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
6154 ; RV64ID-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
6155 ; RV64ID-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
6156 ; RV64ID-NEXT: addi sp, sp, 32
6159 ; CHECK32-IZFHMIN-LABEL: fcvt_h_wu_demanded_bits:
6160 ; CHECK32-IZFHMIN: # %bb.0:
6161 ; CHECK32-IZFHMIN-NEXT: addi a0, a0, 1
6162 ; CHECK32-IZFHMIN-NEXT: fcvt.s.wu fa5, a0
6163 ; CHECK32-IZFHMIN-NEXT: fcvt.h.s fa5, fa5
6164 ; CHECK32-IZFHMIN-NEXT: fsh fa5, 0(a1)
6165 ; CHECK32-IZFHMIN-NEXT: ret
6167 ; CHECK64-IZFHMIN-LABEL: fcvt_h_wu_demanded_bits:
6168 ; CHECK64-IZFHMIN: # %bb.0:
6169 ; CHECK64-IZFHMIN-NEXT: addiw a0, a0, 1
6170 ; CHECK64-IZFHMIN-NEXT: slli a2, a0, 32
6171 ; CHECK64-IZFHMIN-NEXT: srli a2, a2, 32
6172 ; CHECK64-IZFHMIN-NEXT: fcvt.s.lu fa5, a2
6173 ; CHECK64-IZFHMIN-NEXT: fcvt.h.s fa5, fa5
6174 ; CHECK64-IZFHMIN-NEXT: fsh fa5, 0(a1)
6175 ; CHECK64-IZFHMIN-NEXT: ret
6177 ; CHECK32-IZHINXMIN-LABEL: fcvt_h_wu_demanded_bits:
6178 ; CHECK32-IZHINXMIN: # %bb.0:
6179 ; CHECK32-IZHINXMIN-NEXT: addi a0, a0, 1
6180 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.wu a2, a0
6181 ; CHECK32-IZHINXMIN-NEXT: fcvt.h.s a2, a2
6182 ; CHECK32-IZHINXMIN-NEXT: sh a2, 0(a1)
6183 ; CHECK32-IZHINXMIN-NEXT: ret
6185 ; CHECK64-IZHINXMIN-LABEL: fcvt_h_wu_demanded_bits:
6186 ; CHECK64-IZHINXMIN: # %bb.0:
6187 ; CHECK64-IZHINXMIN-NEXT: addiw a0, a0, 1
6188 ; CHECK64-IZHINXMIN-NEXT: slli a2, a0, 32
6189 ; CHECK64-IZHINXMIN-NEXT: srli a2, a2, 32
6190 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.lu a2, a2
6191 ; CHECK64-IZHINXMIN-NEXT: fcvt.h.s a2, a2
6192 ; CHECK64-IZHINXMIN-NEXT: sh a2, 0(a1)
6193 ; CHECK64-IZHINXMIN-NEXT: ret
6195 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_h_wu_demanded_bits:
6196 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
6197 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a0, a0, 1
6198 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.wu a2, a0
6199 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.h.s a2, a2
6200 ; CHECK32-IZDINXZHINXMIN-NEXT: sh a2, 0(a1)
6201 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
6203 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_h_wu_demanded_bits:
6204 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
6205 ; CHECK64-IZDINXZHINXMIN-NEXT: addiw a0, a0, 1
6206 ; CHECK64-IZDINXZHINXMIN-NEXT: slli a2, a0, 32
6207 ; CHECK64-IZDINXZHINXMIN-NEXT: srli a2, a2, 32
6208 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.lu a2, a2
6209 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.h.s a2, a2
6210 ; CHECK64-IZDINXZHINXMIN-NEXT: sh a2, 0(a1)
6211 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
6213 %4 = uitofp i32 %3 to half
6214 store half %4, ptr %1, align 2
6218 define signext i16 @fcvt_w_s_i16(half %a) nounwind {
6219 ; RV32IZFH-LABEL: fcvt_w_s_i16:
6220 ; RV32IZFH: # %bb.0:
6221 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rtz
6222 ; RV32IZFH-NEXT: ret
6224 ; RV64IZFH-LABEL: fcvt_w_s_i16:
6225 ; RV64IZFH: # %bb.0:
6226 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
6227 ; RV64IZFH-NEXT: ret
6229 ; RV32IDZFH-LABEL: fcvt_w_s_i16:
6230 ; RV32IDZFH: # %bb.0:
6231 ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
6232 ; RV32IDZFH-NEXT: ret
6234 ; RV64IDZFH-LABEL: fcvt_w_s_i16:
6235 ; RV64IDZFH: # %bb.0:
6236 ; RV64IDZFH-NEXT: fcvt.l.h a0, fa0, rtz
6237 ; RV64IDZFH-NEXT: ret
6239 ; RV32IZHINX-LABEL: fcvt_w_s_i16:
6240 ; RV32IZHINX: # %bb.0:
6241 ; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz
6242 ; RV32IZHINX-NEXT: ret
6244 ; RV64IZHINX-LABEL: fcvt_w_s_i16:
6245 ; RV64IZHINX: # %bb.0:
6246 ; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz
6247 ; RV64IZHINX-NEXT: ret
6249 ; RV32IZDINXZHINX-LABEL: fcvt_w_s_i16:
6250 ; RV32IZDINXZHINX: # %bb.0:
6251 ; RV32IZDINXZHINX-NEXT: fcvt.w.h a0, a0, rtz
6252 ; RV32IZDINXZHINX-NEXT: ret
6254 ; RV64IZDINXZHINX-LABEL: fcvt_w_s_i16:
6255 ; RV64IZDINXZHINX: # %bb.0:
6256 ; RV64IZDINXZHINX-NEXT: fcvt.l.h a0, a0, rtz
6257 ; RV64IZDINXZHINX-NEXT: ret
6259 ; RV32I-LABEL: fcvt_w_s_i16:
6261 ; RV32I-NEXT: addi sp, sp, -16
6262 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6263 ; RV32I-NEXT: slli a0, a0, 16
6264 ; RV32I-NEXT: srli a0, a0, 16
6265 ; RV32I-NEXT: call __extendhfsf2
6266 ; RV32I-NEXT: call __fixsfsi
6267 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6268 ; RV32I-NEXT: addi sp, sp, 16
6271 ; RV64I-LABEL: fcvt_w_s_i16:
6273 ; RV64I-NEXT: addi sp, sp, -16
6274 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6275 ; RV64I-NEXT: slli a0, a0, 48
6276 ; RV64I-NEXT: srli a0, a0, 48
6277 ; RV64I-NEXT: call __extendhfsf2
6278 ; RV64I-NEXT: call __fixsfdi
6279 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6280 ; RV64I-NEXT: addi sp, sp, 16
6283 ; RV32ID-ILP32-LABEL: fcvt_w_s_i16:
6284 ; RV32ID-ILP32: # %bb.0:
6285 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
6286 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6287 ; RV32ID-ILP32-NEXT: call __extendhfsf2
6288 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
6289 ; RV32ID-ILP32-NEXT: fcvt.w.s a0, fa5, rtz
6290 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6291 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
6292 ; RV32ID-ILP32-NEXT: ret
6294 ; RV64ID-LP64-LABEL: fcvt_w_s_i16:
6295 ; RV64ID-LP64: # %bb.0:
6296 ; RV64ID-LP64-NEXT: addi sp, sp, -16
6297 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6298 ; RV64ID-LP64-NEXT: call __extendhfsf2
6299 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
6300 ; RV64ID-LP64-NEXT: fcvt.l.s a0, fa5, rtz
6301 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6302 ; RV64ID-LP64-NEXT: addi sp, sp, 16
6303 ; RV64ID-LP64-NEXT: ret
6305 ; RV32ID-LABEL: fcvt_w_s_i16:
6307 ; RV32ID-NEXT: addi sp, sp, -16
6308 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6309 ; RV32ID-NEXT: call __extendhfsf2
6310 ; RV32ID-NEXT: fcvt.w.s a0, fa0, rtz
6311 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6312 ; RV32ID-NEXT: addi sp, sp, 16
6315 ; RV64ID-LABEL: fcvt_w_s_i16:
6317 ; RV64ID-NEXT: addi sp, sp, -16
6318 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6319 ; RV64ID-NEXT: call __extendhfsf2
6320 ; RV64ID-NEXT: fcvt.l.s a0, fa0, rtz
6321 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6322 ; RV64ID-NEXT: addi sp, sp, 16
6325 ; CHECK32-IZFHMIN-LABEL: fcvt_w_s_i16:
6326 ; CHECK32-IZFHMIN: # %bb.0:
6327 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
6328 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
6329 ; CHECK32-IZFHMIN-NEXT: ret
6331 ; CHECK64-IZFHMIN-LABEL: fcvt_w_s_i16:
6332 ; CHECK64-IZFHMIN: # %bb.0:
6333 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
6334 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a0, fa5, rtz
6335 ; CHECK64-IZFHMIN-NEXT: ret
6337 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_s_i16:
6338 ; CHECK32-IZHINXMIN: # %bb.0:
6339 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
6340 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
6341 ; CHECK32-IZHINXMIN-NEXT: ret
6343 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_s_i16:
6344 ; CHECK64-IZHINXMIN: # %bb.0:
6345 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
6346 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
6347 ; CHECK64-IZHINXMIN-NEXT: ret
6349 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_s_i16:
6350 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
6351 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
6352 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
6353 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
6355 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_s_i16:
6356 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
6357 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
6358 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
6359 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
6360 %1 = fptosi half %a to i16
6364 define signext i16 @fcvt_w_s_sat_i16(half %a) nounwind {
6365 ; RV32IZFH-LABEL: fcvt_w_s_sat_i16:
6366 ; RV32IZFH: # %bb.0: # %start
6367 ; RV32IZFH-NEXT: fcvt.s.h fa5, fa0
6368 ; RV32IZFH-NEXT: feq.s a0, fa5, fa5
6369 ; RV32IZFH-NEXT: neg a0, a0
6370 ; RV32IZFH-NEXT: lui a1, %hi(.LCPI32_0)
6371 ; RV32IZFH-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6372 ; RV32IZFH-NEXT: lui a1, 815104
6373 ; RV32IZFH-NEXT: fmv.w.x fa3, a1
6374 ; RV32IZFH-NEXT: fmax.s fa5, fa5, fa3
6375 ; RV32IZFH-NEXT: fmin.s fa5, fa5, fa4
6376 ; RV32IZFH-NEXT: fcvt.w.s a1, fa5, rtz
6377 ; RV32IZFH-NEXT: and a0, a0, a1
6378 ; RV32IZFH-NEXT: ret
6380 ; RV64IZFH-LABEL: fcvt_w_s_sat_i16:
6381 ; RV64IZFH: # %bb.0: # %start
6382 ; RV64IZFH-NEXT: fcvt.s.h fa5, fa0
6383 ; RV64IZFH-NEXT: feq.s a0, fa5, fa5
6384 ; RV64IZFH-NEXT: lui a1, %hi(.LCPI32_0)
6385 ; RV64IZFH-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6386 ; RV64IZFH-NEXT: lui a1, 815104
6387 ; RV64IZFH-NEXT: fmv.w.x fa3, a1
6388 ; RV64IZFH-NEXT: fmax.s fa5, fa5, fa3
6389 ; RV64IZFH-NEXT: neg a0, a0
6390 ; RV64IZFH-NEXT: fmin.s fa5, fa5, fa4
6391 ; RV64IZFH-NEXT: fcvt.l.s a1, fa5, rtz
6392 ; RV64IZFH-NEXT: and a0, a0, a1
6393 ; RV64IZFH-NEXT: ret
6395 ; RV32IDZFH-LABEL: fcvt_w_s_sat_i16:
6396 ; RV32IDZFH: # %bb.0: # %start
6397 ; RV32IDZFH-NEXT: fcvt.s.h fa5, fa0
6398 ; RV32IDZFH-NEXT: feq.s a0, fa5, fa5
6399 ; RV32IDZFH-NEXT: neg a0, a0
6400 ; RV32IDZFH-NEXT: lui a1, %hi(.LCPI32_0)
6401 ; RV32IDZFH-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6402 ; RV32IDZFH-NEXT: lui a1, 815104
6403 ; RV32IDZFH-NEXT: fmv.w.x fa3, a1
6404 ; RV32IDZFH-NEXT: fmax.s fa5, fa5, fa3
6405 ; RV32IDZFH-NEXT: fmin.s fa5, fa5, fa4
6406 ; RV32IDZFH-NEXT: fcvt.w.s a1, fa5, rtz
6407 ; RV32IDZFH-NEXT: and a0, a0, a1
6408 ; RV32IDZFH-NEXT: ret
6410 ; RV64IDZFH-LABEL: fcvt_w_s_sat_i16:
6411 ; RV64IDZFH: # %bb.0: # %start
6412 ; RV64IDZFH-NEXT: fcvt.s.h fa5, fa0
6413 ; RV64IDZFH-NEXT: feq.s a0, fa5, fa5
6414 ; RV64IDZFH-NEXT: lui a1, %hi(.LCPI32_0)
6415 ; RV64IDZFH-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6416 ; RV64IDZFH-NEXT: lui a1, 815104
6417 ; RV64IDZFH-NEXT: fmv.w.x fa3, a1
6418 ; RV64IDZFH-NEXT: fmax.s fa5, fa5, fa3
6419 ; RV64IDZFH-NEXT: neg a0, a0
6420 ; RV64IDZFH-NEXT: fmin.s fa5, fa5, fa4
6421 ; RV64IDZFH-NEXT: fcvt.l.s a1, fa5, rtz
6422 ; RV64IDZFH-NEXT: and a0, a0, a1
6423 ; RV64IDZFH-NEXT: ret
6425 ; RV32IZHINX-LABEL: fcvt_w_s_sat_i16:
6426 ; RV32IZHINX: # %bb.0: # %start
6427 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
6428 ; RV32IZHINX-NEXT: feq.s a1, a0, a0
6429 ; RV32IZHINX-NEXT: lui a2, %hi(.LCPI32_0)
6430 ; RV32IZHINX-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6431 ; RV32IZHINX-NEXT: neg a1, a1
6432 ; RV32IZHINX-NEXT: lui a3, 815104
6433 ; RV32IZHINX-NEXT: fmax.s a0, a0, a3
6434 ; RV32IZHINX-NEXT: fmin.s a0, a0, a2
6435 ; RV32IZHINX-NEXT: fcvt.w.s a0, a0, rtz
6436 ; RV32IZHINX-NEXT: and a0, a1, a0
6437 ; RV32IZHINX-NEXT: ret
6439 ; RV64IZHINX-LABEL: fcvt_w_s_sat_i16:
6440 ; RV64IZHINX: # %bb.0: # %start
6441 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
6442 ; RV64IZHINX-NEXT: lui a1, 815104
6443 ; RV64IZHINX-NEXT: lui a2, %hi(.LCPI32_0)
6444 ; RV64IZHINX-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6445 ; RV64IZHINX-NEXT: fmax.s a1, a0, a1
6446 ; RV64IZHINX-NEXT: feq.s a0, a0, a0
6447 ; RV64IZHINX-NEXT: neg a0, a0
6448 ; RV64IZHINX-NEXT: fmin.s a1, a1, a2
6449 ; RV64IZHINX-NEXT: fcvt.l.s a1, a1, rtz
6450 ; RV64IZHINX-NEXT: and a0, a0, a1
6451 ; RV64IZHINX-NEXT: ret
6453 ; RV32IZDINXZHINX-LABEL: fcvt_w_s_sat_i16:
6454 ; RV32IZDINXZHINX: # %bb.0: # %start
6455 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
6456 ; RV32IZDINXZHINX-NEXT: feq.s a1, a0, a0
6457 ; RV32IZDINXZHINX-NEXT: lui a2, %hi(.LCPI32_0)
6458 ; RV32IZDINXZHINX-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6459 ; RV32IZDINXZHINX-NEXT: neg a1, a1
6460 ; RV32IZDINXZHINX-NEXT: lui a3, 815104
6461 ; RV32IZDINXZHINX-NEXT: fmax.s a0, a0, a3
6462 ; RV32IZDINXZHINX-NEXT: fmin.s a0, a0, a2
6463 ; RV32IZDINXZHINX-NEXT: fcvt.w.s a0, a0, rtz
6464 ; RV32IZDINXZHINX-NEXT: and a0, a1, a0
6465 ; RV32IZDINXZHINX-NEXT: ret
6467 ; RV64IZDINXZHINX-LABEL: fcvt_w_s_sat_i16:
6468 ; RV64IZDINXZHINX: # %bb.0: # %start
6469 ; RV64IZDINXZHINX-NEXT: fcvt.s.h a0, a0
6470 ; RV64IZDINXZHINX-NEXT: lui a1, 815104
6471 ; RV64IZDINXZHINX-NEXT: lui a2, %hi(.LCPI32_0)
6472 ; RV64IZDINXZHINX-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6473 ; RV64IZDINXZHINX-NEXT: fmax.s a1, a0, a1
6474 ; RV64IZDINXZHINX-NEXT: feq.s a0, a0, a0
6475 ; RV64IZDINXZHINX-NEXT: neg a0, a0
6476 ; RV64IZDINXZHINX-NEXT: fmin.s a1, a1, a2
6477 ; RV64IZDINXZHINX-NEXT: fcvt.l.s a1, a1, rtz
6478 ; RV64IZDINXZHINX-NEXT: and a0, a0, a1
6479 ; RV64IZDINXZHINX-NEXT: ret
6481 ; RV32I-LABEL: fcvt_w_s_sat_i16:
6482 ; RV32I: # %bb.0: # %start
6483 ; RV32I-NEXT: addi sp, sp, -16
6484 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6485 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
6486 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
6487 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
6488 ; RV32I-NEXT: slli a0, a0, 16
6489 ; RV32I-NEXT: srli a0, a0, 16
6490 ; RV32I-NEXT: call __extendhfsf2
6491 ; RV32I-NEXT: mv s0, a0
6492 ; RV32I-NEXT: lui a1, 815104
6493 ; RV32I-NEXT: call __gesf2
6494 ; RV32I-NEXT: mv s2, a0
6495 ; RV32I-NEXT: mv a0, s0
6496 ; RV32I-NEXT: call __fixsfsi
6497 ; RV32I-NEXT: mv s1, a0
6498 ; RV32I-NEXT: bgez s2, .LBB32_2
6499 ; RV32I-NEXT: # %bb.1: # %start
6500 ; RV32I-NEXT: lui s1, 1048568
6501 ; RV32I-NEXT: .LBB32_2: # %start
6502 ; RV32I-NEXT: lui a0, 290816
6503 ; RV32I-NEXT: addi a1, a0, -512
6504 ; RV32I-NEXT: mv a0, s0
6505 ; RV32I-NEXT: call __gtsf2
6506 ; RV32I-NEXT: blez a0, .LBB32_4
6507 ; RV32I-NEXT: # %bb.3: # %start
6508 ; RV32I-NEXT: lui s1, 8
6509 ; RV32I-NEXT: addi s1, s1, -1
6510 ; RV32I-NEXT: .LBB32_4: # %start
6511 ; RV32I-NEXT: mv a0, s0
6512 ; RV32I-NEXT: mv a1, s0
6513 ; RV32I-NEXT: call __unordsf2
6514 ; RV32I-NEXT: snez a0, a0
6515 ; RV32I-NEXT: addi a0, a0, -1
6516 ; RV32I-NEXT: and a0, a0, s1
6517 ; RV32I-NEXT: slli a0, a0, 16
6518 ; RV32I-NEXT: srai a0, a0, 16
6519 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6520 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
6521 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
6522 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
6523 ; RV32I-NEXT: addi sp, sp, 16
6526 ; RV64I-LABEL: fcvt_w_s_sat_i16:
6527 ; RV64I: # %bb.0: # %start
6528 ; RV64I-NEXT: addi sp, sp, -32
6529 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
6530 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
6531 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
6532 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
6533 ; RV64I-NEXT: slli a0, a0, 48
6534 ; RV64I-NEXT: srli a0, a0, 48
6535 ; RV64I-NEXT: call __extendhfsf2
6536 ; RV64I-NEXT: mv s0, a0
6537 ; RV64I-NEXT: lui a1, 815104
6538 ; RV64I-NEXT: call __gesf2
6539 ; RV64I-NEXT: mv s2, a0
6540 ; RV64I-NEXT: mv a0, s0
6541 ; RV64I-NEXT: call __fixsfdi
6542 ; RV64I-NEXT: mv s1, a0
6543 ; RV64I-NEXT: bgez s2, .LBB32_2
6544 ; RV64I-NEXT: # %bb.1: # %start
6545 ; RV64I-NEXT: lui s1, 1048568
6546 ; RV64I-NEXT: .LBB32_2: # %start
6547 ; RV64I-NEXT: lui a0, 290816
6548 ; RV64I-NEXT: addiw a1, a0, -512
6549 ; RV64I-NEXT: mv a0, s0
6550 ; RV64I-NEXT: call __gtsf2
6551 ; RV64I-NEXT: blez a0, .LBB32_4
6552 ; RV64I-NEXT: # %bb.3: # %start
6553 ; RV64I-NEXT: lui s1, 8
6554 ; RV64I-NEXT: addi s1, s1, -1
6555 ; RV64I-NEXT: .LBB32_4: # %start
6556 ; RV64I-NEXT: mv a0, s0
6557 ; RV64I-NEXT: mv a1, s0
6558 ; RV64I-NEXT: call __unordsf2
6559 ; RV64I-NEXT: snez a0, a0
6560 ; RV64I-NEXT: addi a0, a0, -1
6561 ; RV64I-NEXT: and a0, a0, s1
6562 ; RV64I-NEXT: slli a0, a0, 48
6563 ; RV64I-NEXT: srai a0, a0, 48
6564 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
6565 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
6566 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
6567 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
6568 ; RV64I-NEXT: addi sp, sp, 32
6571 ; RV32ID-ILP32-LABEL: fcvt_w_s_sat_i16:
6572 ; RV32ID-ILP32: # %bb.0: # %start
6573 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
6574 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6575 ; RV32ID-ILP32-NEXT: call __extendhfsf2
6576 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
6577 ; RV32ID-ILP32-NEXT: feq.s a0, fa5, fa5
6578 ; RV32ID-ILP32-NEXT: neg a0, a0
6579 ; RV32ID-ILP32-NEXT: lui a1, %hi(.LCPI32_0)
6580 ; RV32ID-ILP32-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6581 ; RV32ID-ILP32-NEXT: lui a1, 815104
6582 ; RV32ID-ILP32-NEXT: fmv.w.x fa3, a1
6583 ; RV32ID-ILP32-NEXT: fmax.s fa5, fa5, fa3
6584 ; RV32ID-ILP32-NEXT: fmin.s fa5, fa5, fa4
6585 ; RV32ID-ILP32-NEXT: fcvt.w.s a1, fa5, rtz
6586 ; RV32ID-ILP32-NEXT: and a0, a0, a1
6587 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6588 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
6589 ; RV32ID-ILP32-NEXT: ret
6591 ; RV64ID-LP64-LABEL: fcvt_w_s_sat_i16:
6592 ; RV64ID-LP64: # %bb.0: # %start
6593 ; RV64ID-LP64-NEXT: addi sp, sp, -16
6594 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6595 ; RV64ID-LP64-NEXT: call __extendhfsf2
6596 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
6597 ; RV64ID-LP64-NEXT: feq.s a0, fa5, fa5
6598 ; RV64ID-LP64-NEXT: lui a1, %hi(.LCPI32_0)
6599 ; RV64ID-LP64-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6600 ; RV64ID-LP64-NEXT: lui a1, 815104
6601 ; RV64ID-LP64-NEXT: fmv.w.x fa3, a1
6602 ; RV64ID-LP64-NEXT: fmax.s fa5, fa5, fa3
6603 ; RV64ID-LP64-NEXT: neg a0, a0
6604 ; RV64ID-LP64-NEXT: fmin.s fa5, fa5, fa4
6605 ; RV64ID-LP64-NEXT: fcvt.l.s a1, fa5, rtz
6606 ; RV64ID-LP64-NEXT: and a0, a0, a1
6607 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6608 ; RV64ID-LP64-NEXT: addi sp, sp, 16
6609 ; RV64ID-LP64-NEXT: ret
6611 ; RV32ID-LABEL: fcvt_w_s_sat_i16:
6612 ; RV32ID: # %bb.0: # %start
6613 ; RV32ID-NEXT: addi sp, sp, -16
6614 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6615 ; RV32ID-NEXT: call __extendhfsf2
6616 ; RV32ID-NEXT: feq.s a0, fa0, fa0
6617 ; RV32ID-NEXT: neg a0, a0
6618 ; RV32ID-NEXT: lui a1, %hi(.LCPI32_0)
6619 ; RV32ID-NEXT: flw fa5, %lo(.LCPI32_0)(a1)
6620 ; RV32ID-NEXT: lui a1, 815104
6621 ; RV32ID-NEXT: fmv.w.x fa4, a1
6622 ; RV32ID-NEXT: fmax.s fa4, fa0, fa4
6623 ; RV32ID-NEXT: fmin.s fa5, fa4, fa5
6624 ; RV32ID-NEXT: fcvt.w.s a1, fa5, rtz
6625 ; RV32ID-NEXT: and a0, a0, a1
6626 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6627 ; RV32ID-NEXT: addi sp, sp, 16
6630 ; RV64ID-LABEL: fcvt_w_s_sat_i16:
6631 ; RV64ID: # %bb.0: # %start
6632 ; RV64ID-NEXT: addi sp, sp, -16
6633 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6634 ; RV64ID-NEXT: call __extendhfsf2
6635 ; RV64ID-NEXT: feq.s a0, fa0, fa0
6636 ; RV64ID-NEXT: lui a1, %hi(.LCPI32_0)
6637 ; RV64ID-NEXT: flw fa5, %lo(.LCPI32_0)(a1)
6638 ; RV64ID-NEXT: lui a1, 815104
6639 ; RV64ID-NEXT: fmv.w.x fa4, a1
6640 ; RV64ID-NEXT: fmax.s fa4, fa0, fa4
6641 ; RV64ID-NEXT: neg a0, a0
6642 ; RV64ID-NEXT: fmin.s fa5, fa4, fa5
6643 ; RV64ID-NEXT: fcvt.l.s a1, fa5, rtz
6644 ; RV64ID-NEXT: and a0, a0, a1
6645 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6646 ; RV64ID-NEXT: addi sp, sp, 16
6649 ; CHECK32-IZFHMIN-LABEL: fcvt_w_s_sat_i16:
6650 ; CHECK32-IZFHMIN: # %bb.0: # %start
6651 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
6652 ; CHECK32-IZFHMIN-NEXT: feq.s a0, fa5, fa5
6653 ; CHECK32-IZFHMIN-NEXT: neg a0, a0
6654 ; CHECK32-IZFHMIN-NEXT: lui a1, %hi(.LCPI32_0)
6655 ; CHECK32-IZFHMIN-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6656 ; CHECK32-IZFHMIN-NEXT: lui a1, 815104
6657 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa3, a1
6658 ; CHECK32-IZFHMIN-NEXT: fmax.s fa5, fa5, fa3
6659 ; CHECK32-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
6660 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a1, fa5, rtz
6661 ; CHECK32-IZFHMIN-NEXT: and a0, a0, a1
6662 ; CHECK32-IZFHMIN-NEXT: ret
6664 ; CHECK64-IZFHMIN-LABEL: fcvt_w_s_sat_i16:
6665 ; CHECK64-IZFHMIN: # %bb.0: # %start
6666 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
6667 ; CHECK64-IZFHMIN-NEXT: feq.s a0, fa5, fa5
6668 ; CHECK64-IZFHMIN-NEXT: lui a1, %hi(.LCPI32_0)
6669 ; CHECK64-IZFHMIN-NEXT: flw fa4, %lo(.LCPI32_0)(a1)
6670 ; CHECK64-IZFHMIN-NEXT: lui a1, 815104
6671 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa3, a1
6672 ; CHECK64-IZFHMIN-NEXT: fmax.s fa5, fa5, fa3
6673 ; CHECK64-IZFHMIN-NEXT: neg a0, a0
6674 ; CHECK64-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
6675 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a1, fa5, rtz
6676 ; CHECK64-IZFHMIN-NEXT: and a0, a0, a1
6677 ; CHECK64-IZFHMIN-NEXT: ret
6679 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_s_sat_i16:
6680 ; CHECK32-IZHINXMIN: # %bb.0: # %start
6681 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
6682 ; CHECK32-IZHINXMIN-NEXT: feq.s a1, a0, a0
6683 ; CHECK32-IZHINXMIN-NEXT: lui a2, %hi(.LCPI32_0)
6684 ; CHECK32-IZHINXMIN-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6685 ; CHECK32-IZHINXMIN-NEXT: neg a1, a1
6686 ; CHECK32-IZHINXMIN-NEXT: lui a3, 815104
6687 ; CHECK32-IZHINXMIN-NEXT: fmax.s a0, a0, a3
6688 ; CHECK32-IZHINXMIN-NEXT: fmin.s a0, a0, a2
6689 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
6690 ; CHECK32-IZHINXMIN-NEXT: and a0, a1, a0
6691 ; CHECK32-IZHINXMIN-NEXT: ret
6693 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_s_sat_i16:
6694 ; CHECK64-IZHINXMIN: # %bb.0: # %start
6695 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
6696 ; CHECK64-IZHINXMIN-NEXT: lui a1, 815104
6697 ; CHECK64-IZHINXMIN-NEXT: lui a2, %hi(.LCPI32_0)
6698 ; CHECK64-IZHINXMIN-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6699 ; CHECK64-IZHINXMIN-NEXT: fmax.s a1, a0, a1
6700 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
6701 ; CHECK64-IZHINXMIN-NEXT: neg a0, a0
6702 ; CHECK64-IZHINXMIN-NEXT: fmin.s a1, a1, a2
6703 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a1, a1, rtz
6704 ; CHECK64-IZHINXMIN-NEXT: and a0, a0, a1
6705 ; CHECK64-IZHINXMIN-NEXT: ret
6707 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_s_sat_i16:
6708 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
6709 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
6710 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a1, a0, a0
6711 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a2, %hi(.LCPI32_0)
6712 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6713 ; CHECK32-IZDINXZHINXMIN-NEXT: neg a1, a1
6714 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a3, 815104
6715 ; CHECK32-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, a3
6716 ; CHECK32-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a2
6717 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
6718 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a1, a0
6719 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
6721 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_s_sat_i16:
6722 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
6723 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
6724 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a1, 815104
6725 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a2, %hi(.LCPI32_0)
6726 ; CHECK64-IZDINXZHINXMIN-NEXT: lw a2, %lo(.LCPI32_0)(a2)
6727 ; CHECK64-IZDINXZHINXMIN-NEXT: fmax.s a1, a0, a1
6728 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
6729 ; CHECK64-IZDINXZHINXMIN-NEXT: neg a0, a0
6730 ; CHECK64-IZDINXZHINXMIN-NEXT: fmin.s a1, a1, a2
6731 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a1, a1, rtz
6732 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a0, a1
6733 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
6735 %0 = tail call i16 @llvm.fptosi.sat.i16.f16(half %a)
6739 define zeroext i16 @fcvt_wu_s_i16(half %a) nounwind {
6740 ; RV32IZFH-LABEL: fcvt_wu_s_i16:
6741 ; RV32IZFH: # %bb.0:
6742 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
6743 ; RV32IZFH-NEXT: ret
6745 ; RV64IZFH-LABEL: fcvt_wu_s_i16:
6746 ; RV64IZFH: # %bb.0:
6747 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
6748 ; RV64IZFH-NEXT: ret
6750 ; RV32IDZFH-LABEL: fcvt_wu_s_i16:
6751 ; RV32IDZFH: # %bb.0:
6752 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
6753 ; RV32IDZFH-NEXT: ret
6755 ; RV64IDZFH-LABEL: fcvt_wu_s_i16:
6756 ; RV64IDZFH: # %bb.0:
6757 ; RV64IDZFH-NEXT: fcvt.lu.h a0, fa0, rtz
6758 ; RV64IDZFH-NEXT: ret
6760 ; RV32IZHINX-LABEL: fcvt_wu_s_i16:
6761 ; RV32IZHINX: # %bb.0:
6762 ; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz
6763 ; RV32IZHINX-NEXT: ret
6765 ; RV64IZHINX-LABEL: fcvt_wu_s_i16:
6766 ; RV64IZHINX: # %bb.0:
6767 ; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz
6768 ; RV64IZHINX-NEXT: ret
6770 ; RV32IZDINXZHINX-LABEL: fcvt_wu_s_i16:
6771 ; RV32IZDINXZHINX: # %bb.0:
6772 ; RV32IZDINXZHINX-NEXT: fcvt.wu.h a0, a0, rtz
6773 ; RV32IZDINXZHINX-NEXT: ret
6775 ; RV64IZDINXZHINX-LABEL: fcvt_wu_s_i16:
6776 ; RV64IZDINXZHINX: # %bb.0:
6777 ; RV64IZDINXZHINX-NEXT: fcvt.lu.h a0, a0, rtz
6778 ; RV64IZDINXZHINX-NEXT: ret
6780 ; RV32I-LABEL: fcvt_wu_s_i16:
6782 ; RV32I-NEXT: addi sp, sp, -16
6783 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6784 ; RV32I-NEXT: slli a0, a0, 16
6785 ; RV32I-NEXT: srli a0, a0, 16
6786 ; RV32I-NEXT: call __extendhfsf2
6787 ; RV32I-NEXT: call __fixunssfsi
6788 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6789 ; RV32I-NEXT: addi sp, sp, 16
6792 ; RV64I-LABEL: fcvt_wu_s_i16:
6794 ; RV64I-NEXT: addi sp, sp, -16
6795 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6796 ; RV64I-NEXT: slli a0, a0, 48
6797 ; RV64I-NEXT: srli a0, a0, 48
6798 ; RV64I-NEXT: call __extendhfsf2
6799 ; RV64I-NEXT: call __fixunssfdi
6800 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6801 ; RV64I-NEXT: addi sp, sp, 16
6804 ; RV32ID-ILP32-LABEL: fcvt_wu_s_i16:
6805 ; RV32ID-ILP32: # %bb.0:
6806 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
6807 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6808 ; RV32ID-ILP32-NEXT: call __extendhfsf2
6809 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
6810 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
6811 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6812 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
6813 ; RV32ID-ILP32-NEXT: ret
6815 ; RV64ID-LP64-LABEL: fcvt_wu_s_i16:
6816 ; RV64ID-LP64: # %bb.0:
6817 ; RV64ID-LP64-NEXT: addi sp, sp, -16
6818 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6819 ; RV64ID-LP64-NEXT: call __extendhfsf2
6820 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
6821 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
6822 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6823 ; RV64ID-LP64-NEXT: addi sp, sp, 16
6824 ; RV64ID-LP64-NEXT: ret
6826 ; RV32ID-LABEL: fcvt_wu_s_i16:
6828 ; RV32ID-NEXT: addi sp, sp, -16
6829 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
6830 ; RV32ID-NEXT: call __extendhfsf2
6831 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
6832 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
6833 ; RV32ID-NEXT: addi sp, sp, 16
6836 ; RV64ID-LABEL: fcvt_wu_s_i16:
6838 ; RV64ID-NEXT: addi sp, sp, -16
6839 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
6840 ; RV64ID-NEXT: call __extendhfsf2
6841 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
6842 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
6843 ; RV64ID-NEXT: addi sp, sp, 16
6846 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_s_i16:
6847 ; CHECK32-IZFHMIN: # %bb.0:
6848 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
6849 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
6850 ; CHECK32-IZFHMIN-NEXT: ret
6852 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_s_i16:
6853 ; CHECK64-IZFHMIN: # %bb.0:
6854 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
6855 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
6856 ; CHECK64-IZFHMIN-NEXT: ret
6858 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_s_i16:
6859 ; CHECK32-IZHINXMIN: # %bb.0:
6860 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
6861 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
6862 ; CHECK32-IZHINXMIN-NEXT: ret
6864 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_s_i16:
6865 ; CHECK64-IZHINXMIN: # %bb.0:
6866 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
6867 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
6868 ; CHECK64-IZHINXMIN-NEXT: ret
6870 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_s_i16:
6871 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
6872 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
6873 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
6874 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
6876 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_s_i16:
6877 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
6878 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
6879 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
6880 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
6881 %1 = fptoui half %a to i16
6885 define zeroext i16 @fcvt_wu_s_sat_i16(half %a) nounwind {
6886 ; RV32IZFH-LABEL: fcvt_wu_s_sat_i16:
6887 ; RV32IZFH: # %bb.0: # %start
6888 ; RV32IZFH-NEXT: lui a0, %hi(.LCPI34_0)
6889 ; RV32IZFH-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
6890 ; RV32IZFH-NEXT: fcvt.s.h fa4, fa0
6891 ; RV32IZFH-NEXT: fmv.w.x fa3, zero
6892 ; RV32IZFH-NEXT: fmax.s fa4, fa4, fa3
6893 ; RV32IZFH-NEXT: fmin.s fa5, fa4, fa5
6894 ; RV32IZFH-NEXT: fcvt.wu.s a0, fa5, rtz
6895 ; RV32IZFH-NEXT: ret
6897 ; RV64IZFH-LABEL: fcvt_wu_s_sat_i16:
6898 ; RV64IZFH: # %bb.0: # %start
6899 ; RV64IZFH-NEXT: lui a0, %hi(.LCPI34_0)
6900 ; RV64IZFH-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
6901 ; RV64IZFH-NEXT: fcvt.s.h fa4, fa0
6902 ; RV64IZFH-NEXT: fmv.w.x fa3, zero
6903 ; RV64IZFH-NEXT: fmax.s fa4, fa4, fa3
6904 ; RV64IZFH-NEXT: fmin.s fa5, fa4, fa5
6905 ; RV64IZFH-NEXT: fcvt.lu.s a0, fa5, rtz
6906 ; RV64IZFH-NEXT: ret
6908 ; RV32IDZFH-LABEL: fcvt_wu_s_sat_i16:
6909 ; RV32IDZFH: # %bb.0: # %start
6910 ; RV32IDZFH-NEXT: lui a0, %hi(.LCPI34_0)
6911 ; RV32IDZFH-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
6912 ; RV32IDZFH-NEXT: fcvt.s.h fa4, fa0
6913 ; RV32IDZFH-NEXT: fmv.w.x fa3, zero
6914 ; RV32IDZFH-NEXT: fmax.s fa4, fa4, fa3
6915 ; RV32IDZFH-NEXT: fmin.s fa5, fa4, fa5
6916 ; RV32IDZFH-NEXT: fcvt.wu.s a0, fa5, rtz
6917 ; RV32IDZFH-NEXT: ret
6919 ; RV64IDZFH-LABEL: fcvt_wu_s_sat_i16:
6920 ; RV64IDZFH: # %bb.0: # %start
6921 ; RV64IDZFH-NEXT: lui a0, %hi(.LCPI34_0)
6922 ; RV64IDZFH-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
6923 ; RV64IDZFH-NEXT: fcvt.s.h fa4, fa0
6924 ; RV64IDZFH-NEXT: fmv.w.x fa3, zero
6925 ; RV64IDZFH-NEXT: fmax.s fa4, fa4, fa3
6926 ; RV64IDZFH-NEXT: fmin.s fa5, fa4, fa5
6927 ; RV64IDZFH-NEXT: fcvt.lu.s a0, fa5, rtz
6928 ; RV64IDZFH-NEXT: ret
6930 ; RV32IZHINX-LABEL: fcvt_wu_s_sat_i16:
6931 ; RV32IZHINX: # %bb.0: # %start
6932 ; RV32IZHINX-NEXT: lui a1, %hi(.LCPI34_0)
6933 ; RV32IZHINX-NEXT: lw a1, %lo(.LCPI34_0)(a1)
6934 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
6935 ; RV32IZHINX-NEXT: fmax.s a0, a0, zero
6936 ; RV32IZHINX-NEXT: fmin.s a0, a0, a1
6937 ; RV32IZHINX-NEXT: fcvt.wu.s a0, a0, rtz
6938 ; RV32IZHINX-NEXT: ret
6940 ; RV64IZHINX-LABEL: fcvt_wu_s_sat_i16:
6941 ; RV64IZHINX: # %bb.0: # %start
6942 ; RV64IZHINX-NEXT: lui a1, %hi(.LCPI34_0)
6943 ; RV64IZHINX-NEXT: lw a1, %lo(.LCPI34_0)(a1)
6944 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
6945 ; RV64IZHINX-NEXT: fmax.s a0, a0, zero
6946 ; RV64IZHINX-NEXT: fmin.s a0, a0, a1
6947 ; RV64IZHINX-NEXT: fcvt.lu.s a0, a0, rtz
6948 ; RV64IZHINX-NEXT: ret
6950 ; RV32IZDINXZHINX-LABEL: fcvt_wu_s_sat_i16:
6951 ; RV32IZDINXZHINX: # %bb.0: # %start
6952 ; RV32IZDINXZHINX-NEXT: lui a1, %hi(.LCPI34_0)
6953 ; RV32IZDINXZHINX-NEXT: lw a1, %lo(.LCPI34_0)(a1)
6954 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
6955 ; RV32IZDINXZHINX-NEXT: fmax.s a0, a0, zero
6956 ; RV32IZDINXZHINX-NEXT: fmin.s a0, a0, a1
6957 ; RV32IZDINXZHINX-NEXT: fcvt.wu.s a0, a0, rtz
6958 ; RV32IZDINXZHINX-NEXT: ret
6960 ; RV64IZDINXZHINX-LABEL: fcvt_wu_s_sat_i16:
6961 ; RV64IZDINXZHINX: # %bb.0: # %start
6962 ; RV64IZDINXZHINX-NEXT: lui a1, %hi(.LCPI34_0)
6963 ; RV64IZDINXZHINX-NEXT: lw a1, %lo(.LCPI34_0)(a1)
6964 ; RV64IZDINXZHINX-NEXT: fcvt.s.h a0, a0
6965 ; RV64IZDINXZHINX-NEXT: fmax.s a0, a0, zero
6966 ; RV64IZDINXZHINX-NEXT: fmin.s a0, a0, a1
6967 ; RV64IZDINXZHINX-NEXT: fcvt.lu.s a0, a0, rtz
6968 ; RV64IZDINXZHINX-NEXT: ret
6970 ; RV32I-LABEL: fcvt_wu_s_sat_i16:
6971 ; RV32I: # %bb.0: # %start
6972 ; RV32I-NEXT: addi sp, sp, -32
6973 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
6974 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
6975 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
6976 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
6977 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
6978 ; RV32I-NEXT: lui s3, 16
6979 ; RV32I-NEXT: addi s3, s3, -1
6980 ; RV32I-NEXT: and a0, a0, s3
6981 ; RV32I-NEXT: call __extendhfsf2
6982 ; RV32I-NEXT: mv s2, a0
6983 ; RV32I-NEXT: call __fixunssfsi
6984 ; RV32I-NEXT: mv s0, a0
6985 ; RV32I-NEXT: mv a0, s2
6986 ; RV32I-NEXT: li a1, 0
6987 ; RV32I-NEXT: call __gesf2
6988 ; RV32I-NEXT: mv s1, a0
6989 ; RV32I-NEXT: lui a0, 292864
6990 ; RV32I-NEXT: addi a1, a0, -256
6991 ; RV32I-NEXT: mv a0, s2
6992 ; RV32I-NEXT: call __gtsf2
6993 ; RV32I-NEXT: blez a0, .LBB34_2
6994 ; RV32I-NEXT: # %bb.1: # %start
6995 ; RV32I-NEXT: mv a0, s3
6996 ; RV32I-NEXT: j .LBB34_3
6997 ; RV32I-NEXT: .LBB34_2:
6998 ; RV32I-NEXT: slti a0, s1, 0
6999 ; RV32I-NEXT: addi a0, a0, -1
7000 ; RV32I-NEXT: and a0, a0, s0
7001 ; RV32I-NEXT: .LBB34_3: # %start
7002 ; RV32I-NEXT: and a0, a0, s3
7003 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
7004 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
7005 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
7006 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
7007 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
7008 ; RV32I-NEXT: addi sp, sp, 32
7011 ; RV64I-LABEL: fcvt_wu_s_sat_i16:
7012 ; RV64I: # %bb.0: # %start
7013 ; RV64I-NEXT: addi sp, sp, -48
7014 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
7015 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
7016 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
7017 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
7018 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
7019 ; RV64I-NEXT: lui s3, 16
7020 ; RV64I-NEXT: addiw s3, s3, -1
7021 ; RV64I-NEXT: and a0, a0, s3
7022 ; RV64I-NEXT: call __extendhfsf2
7023 ; RV64I-NEXT: mv s2, a0
7024 ; RV64I-NEXT: call __fixunssfdi
7025 ; RV64I-NEXT: mv s0, a0
7026 ; RV64I-NEXT: mv a0, s2
7027 ; RV64I-NEXT: li a1, 0
7028 ; RV64I-NEXT: call __gesf2
7029 ; RV64I-NEXT: mv s1, a0
7030 ; RV64I-NEXT: lui a0, 292864
7031 ; RV64I-NEXT: addiw a1, a0, -256
7032 ; RV64I-NEXT: mv a0, s2
7033 ; RV64I-NEXT: call __gtsf2
7034 ; RV64I-NEXT: blez a0, .LBB34_2
7035 ; RV64I-NEXT: # %bb.1: # %start
7036 ; RV64I-NEXT: mv a0, s3
7037 ; RV64I-NEXT: j .LBB34_3
7038 ; RV64I-NEXT: .LBB34_2:
7039 ; RV64I-NEXT: slti a0, s1, 0
7040 ; RV64I-NEXT: addi a0, a0, -1
7041 ; RV64I-NEXT: and a0, a0, s0
7042 ; RV64I-NEXT: .LBB34_3: # %start
7043 ; RV64I-NEXT: and a0, a0, s3
7044 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
7045 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
7046 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
7047 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
7048 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
7049 ; RV64I-NEXT: addi sp, sp, 48
7052 ; RV32ID-ILP32-LABEL: fcvt_wu_s_sat_i16:
7053 ; RV32ID-ILP32: # %bb.0: # %start
7054 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
7055 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7056 ; RV32ID-ILP32-NEXT: call __extendhfsf2
7057 ; RV32ID-ILP32-NEXT: lui a1, %hi(.LCPI34_0)
7058 ; RV32ID-ILP32-NEXT: flw fa5, %lo(.LCPI34_0)(a1)
7059 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a0
7060 ; RV32ID-ILP32-NEXT: fmv.w.x fa3, zero
7061 ; RV32ID-ILP32-NEXT: fmax.s fa4, fa4, fa3
7062 ; RV32ID-ILP32-NEXT: fmin.s fa5, fa4, fa5
7063 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
7064 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7065 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
7066 ; RV32ID-ILP32-NEXT: ret
7068 ; RV64ID-LP64-LABEL: fcvt_wu_s_sat_i16:
7069 ; RV64ID-LP64: # %bb.0: # %start
7070 ; RV64ID-LP64-NEXT: addi sp, sp, -16
7071 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7072 ; RV64ID-LP64-NEXT: call __extendhfsf2
7073 ; RV64ID-LP64-NEXT: lui a1, %hi(.LCPI34_0)
7074 ; RV64ID-LP64-NEXT: flw fa5, %lo(.LCPI34_0)(a1)
7075 ; RV64ID-LP64-NEXT: fmv.w.x fa4, a0
7076 ; RV64ID-LP64-NEXT: fmv.w.x fa3, zero
7077 ; RV64ID-LP64-NEXT: fmax.s fa4, fa4, fa3
7078 ; RV64ID-LP64-NEXT: fmin.s fa5, fa4, fa5
7079 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
7080 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7081 ; RV64ID-LP64-NEXT: addi sp, sp, 16
7082 ; RV64ID-LP64-NEXT: ret
7084 ; RV32ID-LABEL: fcvt_wu_s_sat_i16:
7085 ; RV32ID: # %bb.0: # %start
7086 ; RV32ID-NEXT: addi sp, sp, -16
7087 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7088 ; RV32ID-NEXT: call __extendhfsf2
7089 ; RV32ID-NEXT: lui a0, %hi(.LCPI34_0)
7090 ; RV32ID-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
7091 ; RV32ID-NEXT: fmv.w.x fa4, zero
7092 ; RV32ID-NEXT: fmax.s fa4, fa0, fa4
7093 ; RV32ID-NEXT: fmin.s fa5, fa4, fa5
7094 ; RV32ID-NEXT: fcvt.wu.s a0, fa5, rtz
7095 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7096 ; RV32ID-NEXT: addi sp, sp, 16
7099 ; RV64ID-LABEL: fcvt_wu_s_sat_i16:
7100 ; RV64ID: # %bb.0: # %start
7101 ; RV64ID-NEXT: addi sp, sp, -16
7102 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7103 ; RV64ID-NEXT: call __extendhfsf2
7104 ; RV64ID-NEXT: lui a0, %hi(.LCPI34_0)
7105 ; RV64ID-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
7106 ; RV64ID-NEXT: fmv.w.x fa4, zero
7107 ; RV64ID-NEXT: fmax.s fa4, fa0, fa4
7108 ; RV64ID-NEXT: fmin.s fa5, fa4, fa5
7109 ; RV64ID-NEXT: fcvt.lu.s a0, fa5, rtz
7110 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7111 ; RV64ID-NEXT: addi sp, sp, 16
7114 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_s_sat_i16:
7115 ; CHECK32-IZFHMIN: # %bb.0: # %start
7116 ; CHECK32-IZFHMIN-NEXT: lui a0, %hi(.LCPI34_0)
7117 ; CHECK32-IZFHMIN-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
7118 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa4, fa0
7119 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa3, zero
7120 ; CHECK32-IZFHMIN-NEXT: fmax.s fa4, fa4, fa3
7121 ; CHECK32-IZFHMIN-NEXT: fmin.s fa5, fa4, fa5
7122 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
7123 ; CHECK32-IZFHMIN-NEXT: ret
7125 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_s_sat_i16:
7126 ; CHECK64-IZFHMIN: # %bb.0: # %start
7127 ; CHECK64-IZFHMIN-NEXT: lui a0, %hi(.LCPI34_0)
7128 ; CHECK64-IZFHMIN-NEXT: flw fa5, %lo(.LCPI34_0)(a0)
7129 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa4, fa0
7130 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa3, zero
7131 ; CHECK64-IZFHMIN-NEXT: fmax.s fa4, fa4, fa3
7132 ; CHECK64-IZFHMIN-NEXT: fmin.s fa5, fa4, fa5
7133 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
7134 ; CHECK64-IZFHMIN-NEXT: ret
7136 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_s_sat_i16:
7137 ; CHECK32-IZHINXMIN: # %bb.0: # %start
7138 ; CHECK32-IZHINXMIN-NEXT: lui a1, %hi(.LCPI34_0)
7139 ; CHECK32-IZHINXMIN-NEXT: lw a1, %lo(.LCPI34_0)(a1)
7140 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7141 ; CHECK32-IZHINXMIN-NEXT: fmax.s a0, a0, zero
7142 ; CHECK32-IZHINXMIN-NEXT: fmin.s a0, a0, a1
7143 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
7144 ; CHECK32-IZHINXMIN-NEXT: ret
7146 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_s_sat_i16:
7147 ; CHECK64-IZHINXMIN: # %bb.0: # %start
7148 ; CHECK64-IZHINXMIN-NEXT: lui a1, %hi(.LCPI34_0)
7149 ; CHECK64-IZHINXMIN-NEXT: lw a1, %lo(.LCPI34_0)(a1)
7150 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7151 ; CHECK64-IZHINXMIN-NEXT: fmax.s a0, a0, zero
7152 ; CHECK64-IZHINXMIN-NEXT: fmin.s a0, a0, a1
7153 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
7154 ; CHECK64-IZHINXMIN-NEXT: ret
7156 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_s_sat_i16:
7157 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
7158 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a1, %hi(.LCPI34_0)
7159 ; CHECK32-IZDINXZHINXMIN-NEXT: lw a1, %lo(.LCPI34_0)(a1)
7160 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7161 ; CHECK32-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, zero
7162 ; CHECK32-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a1
7163 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
7164 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
7166 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_s_sat_i16:
7167 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
7168 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a1, %hi(.LCPI34_0)
7169 ; CHECK64-IZDINXZHINXMIN-NEXT: lw a1, %lo(.LCPI34_0)(a1)
7170 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7171 ; CHECK64-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, zero
7172 ; CHECK64-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a1
7173 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
7174 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
7176 %0 = tail call i16 @llvm.fptoui.sat.i16.f16(half %a)
7180 define signext i8 @fcvt_w_s_i8(half %a) nounwind {
7181 ; RV32IZFH-LABEL: fcvt_w_s_i8:
7182 ; RV32IZFH: # %bb.0:
7183 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rtz
7184 ; RV32IZFH-NEXT: ret
7186 ; RV64IZFH-LABEL: fcvt_w_s_i8:
7187 ; RV64IZFH: # %bb.0:
7188 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
7189 ; RV64IZFH-NEXT: ret
7191 ; RV32IDZFH-LABEL: fcvt_w_s_i8:
7192 ; RV32IDZFH: # %bb.0:
7193 ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
7194 ; RV32IDZFH-NEXT: ret
7196 ; RV64IDZFH-LABEL: fcvt_w_s_i8:
7197 ; RV64IDZFH: # %bb.0:
7198 ; RV64IDZFH-NEXT: fcvt.l.h a0, fa0, rtz
7199 ; RV64IDZFH-NEXT: ret
7201 ; RV32IZHINX-LABEL: fcvt_w_s_i8:
7202 ; RV32IZHINX: # %bb.0:
7203 ; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz
7204 ; RV32IZHINX-NEXT: ret
7206 ; RV64IZHINX-LABEL: fcvt_w_s_i8:
7207 ; RV64IZHINX: # %bb.0:
7208 ; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz
7209 ; RV64IZHINX-NEXT: ret
7211 ; RV32IZDINXZHINX-LABEL: fcvt_w_s_i8:
7212 ; RV32IZDINXZHINX: # %bb.0:
7213 ; RV32IZDINXZHINX-NEXT: fcvt.w.h a0, a0, rtz
7214 ; RV32IZDINXZHINX-NEXT: ret
7216 ; RV64IZDINXZHINX-LABEL: fcvt_w_s_i8:
7217 ; RV64IZDINXZHINX: # %bb.0:
7218 ; RV64IZDINXZHINX-NEXT: fcvt.l.h a0, a0, rtz
7219 ; RV64IZDINXZHINX-NEXT: ret
7221 ; RV32I-LABEL: fcvt_w_s_i8:
7223 ; RV32I-NEXT: addi sp, sp, -16
7224 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7225 ; RV32I-NEXT: slli a0, a0, 16
7226 ; RV32I-NEXT: srli a0, a0, 16
7227 ; RV32I-NEXT: call __extendhfsf2
7228 ; RV32I-NEXT: call __fixsfsi
7229 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7230 ; RV32I-NEXT: addi sp, sp, 16
7233 ; RV64I-LABEL: fcvt_w_s_i8:
7235 ; RV64I-NEXT: addi sp, sp, -16
7236 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7237 ; RV64I-NEXT: slli a0, a0, 48
7238 ; RV64I-NEXT: srli a0, a0, 48
7239 ; RV64I-NEXT: call __extendhfsf2
7240 ; RV64I-NEXT: call __fixsfdi
7241 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7242 ; RV64I-NEXT: addi sp, sp, 16
7245 ; RV32ID-ILP32-LABEL: fcvt_w_s_i8:
7246 ; RV32ID-ILP32: # %bb.0:
7247 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
7248 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7249 ; RV32ID-ILP32-NEXT: call __extendhfsf2
7250 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
7251 ; RV32ID-ILP32-NEXT: fcvt.w.s a0, fa5, rtz
7252 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7253 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
7254 ; RV32ID-ILP32-NEXT: ret
7256 ; RV64ID-LP64-LABEL: fcvt_w_s_i8:
7257 ; RV64ID-LP64: # %bb.0:
7258 ; RV64ID-LP64-NEXT: addi sp, sp, -16
7259 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7260 ; RV64ID-LP64-NEXT: call __extendhfsf2
7261 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
7262 ; RV64ID-LP64-NEXT: fcvt.l.s a0, fa5, rtz
7263 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7264 ; RV64ID-LP64-NEXT: addi sp, sp, 16
7265 ; RV64ID-LP64-NEXT: ret
7267 ; RV32ID-LABEL: fcvt_w_s_i8:
7269 ; RV32ID-NEXT: addi sp, sp, -16
7270 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7271 ; RV32ID-NEXT: call __extendhfsf2
7272 ; RV32ID-NEXT: fcvt.w.s a0, fa0, rtz
7273 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7274 ; RV32ID-NEXT: addi sp, sp, 16
7277 ; RV64ID-LABEL: fcvt_w_s_i8:
7279 ; RV64ID-NEXT: addi sp, sp, -16
7280 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7281 ; RV64ID-NEXT: call __extendhfsf2
7282 ; RV64ID-NEXT: fcvt.l.s a0, fa0, rtz
7283 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7284 ; RV64ID-NEXT: addi sp, sp, 16
7287 ; CHECK32-IZFHMIN-LABEL: fcvt_w_s_i8:
7288 ; CHECK32-IZFHMIN: # %bb.0:
7289 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
7290 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
7291 ; CHECK32-IZFHMIN-NEXT: ret
7293 ; CHECK64-IZFHMIN-LABEL: fcvt_w_s_i8:
7294 ; CHECK64-IZFHMIN: # %bb.0:
7295 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
7296 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a0, fa5, rtz
7297 ; CHECK64-IZFHMIN-NEXT: ret
7299 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_s_i8:
7300 ; CHECK32-IZHINXMIN: # %bb.0:
7301 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7302 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
7303 ; CHECK32-IZHINXMIN-NEXT: ret
7305 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_s_i8:
7306 ; CHECK64-IZHINXMIN: # %bb.0:
7307 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7308 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
7309 ; CHECK64-IZHINXMIN-NEXT: ret
7311 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_s_i8:
7312 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
7313 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7314 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
7315 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
7317 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_s_i8:
7318 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
7319 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7320 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
7321 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
7322 %1 = fptosi half %a to i8
7326 define signext i8 @fcvt_w_s_sat_i8(half %a) nounwind {
7327 ; RV32IZFH-LABEL: fcvt_w_s_sat_i8:
7328 ; RV32IZFH: # %bb.0: # %start
7329 ; RV32IZFH-NEXT: fcvt.s.h fa5, fa0
7330 ; RV32IZFH-NEXT: feq.s a0, fa5, fa5
7331 ; RV32IZFH-NEXT: neg a0, a0
7332 ; RV32IZFH-NEXT: lui a1, 798720
7333 ; RV32IZFH-NEXT: fmv.w.x fa4, a1
7334 ; RV32IZFH-NEXT: fmax.s fa5, fa5, fa4
7335 ; RV32IZFH-NEXT: lui a1, 274400
7336 ; RV32IZFH-NEXT: fmv.w.x fa4, a1
7337 ; RV32IZFH-NEXT: fmin.s fa5, fa5, fa4
7338 ; RV32IZFH-NEXT: fcvt.w.s a1, fa5, rtz
7339 ; RV32IZFH-NEXT: and a0, a0, a1
7340 ; RV32IZFH-NEXT: ret
7342 ; RV64IZFH-LABEL: fcvt_w_s_sat_i8:
7343 ; RV64IZFH: # %bb.0: # %start
7344 ; RV64IZFH-NEXT: fcvt.s.h fa5, fa0
7345 ; RV64IZFH-NEXT: feq.s a0, fa5, fa5
7346 ; RV64IZFH-NEXT: neg a0, a0
7347 ; RV64IZFH-NEXT: lui a1, 798720
7348 ; RV64IZFH-NEXT: fmv.w.x fa4, a1
7349 ; RV64IZFH-NEXT: fmax.s fa5, fa5, fa4
7350 ; RV64IZFH-NEXT: lui a1, 274400
7351 ; RV64IZFH-NEXT: fmv.w.x fa4, a1
7352 ; RV64IZFH-NEXT: fmin.s fa5, fa5, fa4
7353 ; RV64IZFH-NEXT: fcvt.l.s a1, fa5, rtz
7354 ; RV64IZFH-NEXT: and a0, a0, a1
7355 ; RV64IZFH-NEXT: ret
7357 ; RV32IDZFH-LABEL: fcvt_w_s_sat_i8:
7358 ; RV32IDZFH: # %bb.0: # %start
7359 ; RV32IDZFH-NEXT: fcvt.s.h fa5, fa0
7360 ; RV32IDZFH-NEXT: feq.s a0, fa5, fa5
7361 ; RV32IDZFH-NEXT: neg a0, a0
7362 ; RV32IDZFH-NEXT: lui a1, 798720
7363 ; RV32IDZFH-NEXT: fmv.w.x fa4, a1
7364 ; RV32IDZFH-NEXT: fmax.s fa5, fa5, fa4
7365 ; RV32IDZFH-NEXT: lui a1, 274400
7366 ; RV32IDZFH-NEXT: fmv.w.x fa4, a1
7367 ; RV32IDZFH-NEXT: fmin.s fa5, fa5, fa4
7368 ; RV32IDZFH-NEXT: fcvt.w.s a1, fa5, rtz
7369 ; RV32IDZFH-NEXT: and a0, a0, a1
7370 ; RV32IDZFH-NEXT: ret
7372 ; RV64IDZFH-LABEL: fcvt_w_s_sat_i8:
7373 ; RV64IDZFH: # %bb.0: # %start
7374 ; RV64IDZFH-NEXT: fcvt.s.h fa5, fa0
7375 ; RV64IDZFH-NEXT: feq.s a0, fa5, fa5
7376 ; RV64IDZFH-NEXT: neg a0, a0
7377 ; RV64IDZFH-NEXT: lui a1, 798720
7378 ; RV64IDZFH-NEXT: fmv.w.x fa4, a1
7379 ; RV64IDZFH-NEXT: fmax.s fa5, fa5, fa4
7380 ; RV64IDZFH-NEXT: lui a1, 274400
7381 ; RV64IDZFH-NEXT: fmv.w.x fa4, a1
7382 ; RV64IDZFH-NEXT: fmin.s fa5, fa5, fa4
7383 ; RV64IDZFH-NEXT: fcvt.l.s a1, fa5, rtz
7384 ; RV64IDZFH-NEXT: and a0, a0, a1
7385 ; RV64IDZFH-NEXT: ret
7387 ; RV32IZHINX-LABEL: fcvt_w_s_sat_i8:
7388 ; RV32IZHINX: # %bb.0: # %start
7389 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
7390 ; RV32IZHINX-NEXT: feq.s a1, a0, a0
7391 ; RV32IZHINX-NEXT: neg a1, a1
7392 ; RV32IZHINX-NEXT: lui a2, 798720
7393 ; RV32IZHINX-NEXT: fmax.s a0, a0, a2
7394 ; RV32IZHINX-NEXT: lui a2, 274400
7395 ; RV32IZHINX-NEXT: fmin.s a0, a0, a2
7396 ; RV32IZHINX-NEXT: fcvt.w.s a0, a0, rtz
7397 ; RV32IZHINX-NEXT: and a0, a1, a0
7398 ; RV32IZHINX-NEXT: ret
7400 ; RV64IZHINX-LABEL: fcvt_w_s_sat_i8:
7401 ; RV64IZHINX: # %bb.0: # %start
7402 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
7403 ; RV64IZHINX-NEXT: feq.s a1, a0, a0
7404 ; RV64IZHINX-NEXT: neg a1, a1
7405 ; RV64IZHINX-NEXT: lui a2, 798720
7406 ; RV64IZHINX-NEXT: fmax.s a0, a0, a2
7407 ; RV64IZHINX-NEXT: lui a2, 274400
7408 ; RV64IZHINX-NEXT: fmin.s a0, a0, a2
7409 ; RV64IZHINX-NEXT: fcvt.l.s a0, a0, rtz
7410 ; RV64IZHINX-NEXT: and a0, a1, a0
7411 ; RV64IZHINX-NEXT: ret
7413 ; RV32IZDINXZHINX-LABEL: fcvt_w_s_sat_i8:
7414 ; RV32IZDINXZHINX: # %bb.0: # %start
7415 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
7416 ; RV32IZDINXZHINX-NEXT: feq.s a1, a0, a0
7417 ; RV32IZDINXZHINX-NEXT: neg a1, a1
7418 ; RV32IZDINXZHINX-NEXT: lui a2, 798720
7419 ; RV32IZDINXZHINX-NEXT: fmax.s a0, a0, a2
7420 ; RV32IZDINXZHINX-NEXT: lui a2, 274400
7421 ; RV32IZDINXZHINX-NEXT: fmin.s a0, a0, a2
7422 ; RV32IZDINXZHINX-NEXT: fcvt.w.s a0, a0, rtz
7423 ; RV32IZDINXZHINX-NEXT: and a0, a1, a0
7424 ; RV32IZDINXZHINX-NEXT: ret
7426 ; RV64IZDINXZHINX-LABEL: fcvt_w_s_sat_i8:
7427 ; RV64IZDINXZHINX: # %bb.0: # %start
7428 ; RV64IZDINXZHINX-NEXT: fcvt.s.h a0, a0
7429 ; RV64IZDINXZHINX-NEXT: feq.s a1, a0, a0
7430 ; RV64IZDINXZHINX-NEXT: neg a1, a1
7431 ; RV64IZDINXZHINX-NEXT: lui a2, 798720
7432 ; RV64IZDINXZHINX-NEXT: fmax.s a0, a0, a2
7433 ; RV64IZDINXZHINX-NEXT: lui a2, 274400
7434 ; RV64IZDINXZHINX-NEXT: fmin.s a0, a0, a2
7435 ; RV64IZDINXZHINX-NEXT: fcvt.l.s a0, a0, rtz
7436 ; RV64IZDINXZHINX-NEXT: and a0, a1, a0
7437 ; RV64IZDINXZHINX-NEXT: ret
7439 ; RV32I-LABEL: fcvt_w_s_sat_i8:
7440 ; RV32I: # %bb.0: # %start
7441 ; RV32I-NEXT: addi sp, sp, -16
7442 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7443 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
7444 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
7445 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
7446 ; RV32I-NEXT: slli a0, a0, 16
7447 ; RV32I-NEXT: srli a0, a0, 16
7448 ; RV32I-NEXT: call __extendhfsf2
7449 ; RV32I-NEXT: mv s0, a0
7450 ; RV32I-NEXT: lui a1, 798720
7451 ; RV32I-NEXT: call __gesf2
7452 ; RV32I-NEXT: mv s2, a0
7453 ; RV32I-NEXT: mv a0, s0
7454 ; RV32I-NEXT: call __fixsfsi
7455 ; RV32I-NEXT: mv s1, a0
7456 ; RV32I-NEXT: bgez s2, .LBB36_2
7457 ; RV32I-NEXT: # %bb.1: # %start
7458 ; RV32I-NEXT: li s1, -128
7459 ; RV32I-NEXT: .LBB36_2: # %start
7460 ; RV32I-NEXT: lui a1, 274400
7461 ; RV32I-NEXT: mv a0, s0
7462 ; RV32I-NEXT: call __gtsf2
7463 ; RV32I-NEXT: blez a0, .LBB36_4
7464 ; RV32I-NEXT: # %bb.3: # %start
7465 ; RV32I-NEXT: li s1, 127
7466 ; RV32I-NEXT: .LBB36_4: # %start
7467 ; RV32I-NEXT: mv a0, s0
7468 ; RV32I-NEXT: mv a1, s0
7469 ; RV32I-NEXT: call __unordsf2
7470 ; RV32I-NEXT: snez a0, a0
7471 ; RV32I-NEXT: addi a0, a0, -1
7472 ; RV32I-NEXT: and a0, a0, s1
7473 ; RV32I-NEXT: slli a0, a0, 24
7474 ; RV32I-NEXT: srai a0, a0, 24
7475 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7476 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
7477 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
7478 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
7479 ; RV32I-NEXT: addi sp, sp, 16
7482 ; RV64I-LABEL: fcvt_w_s_sat_i8:
7483 ; RV64I: # %bb.0: # %start
7484 ; RV64I-NEXT: addi sp, sp, -32
7485 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
7486 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
7487 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
7488 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
7489 ; RV64I-NEXT: slli a0, a0, 48
7490 ; RV64I-NEXT: srli a0, a0, 48
7491 ; RV64I-NEXT: call __extendhfsf2
7492 ; RV64I-NEXT: mv s0, a0
7493 ; RV64I-NEXT: lui a1, 798720
7494 ; RV64I-NEXT: call __gesf2
7495 ; RV64I-NEXT: mv s2, a0
7496 ; RV64I-NEXT: mv a0, s0
7497 ; RV64I-NEXT: call __fixsfdi
7498 ; RV64I-NEXT: mv s1, a0
7499 ; RV64I-NEXT: bgez s2, .LBB36_2
7500 ; RV64I-NEXT: # %bb.1: # %start
7501 ; RV64I-NEXT: li s1, -128
7502 ; RV64I-NEXT: .LBB36_2: # %start
7503 ; RV64I-NEXT: lui a1, 274400
7504 ; RV64I-NEXT: mv a0, s0
7505 ; RV64I-NEXT: call __gtsf2
7506 ; RV64I-NEXT: blez a0, .LBB36_4
7507 ; RV64I-NEXT: # %bb.3: # %start
7508 ; RV64I-NEXT: li s1, 127
7509 ; RV64I-NEXT: .LBB36_4: # %start
7510 ; RV64I-NEXT: mv a0, s0
7511 ; RV64I-NEXT: mv a1, s0
7512 ; RV64I-NEXT: call __unordsf2
7513 ; RV64I-NEXT: snez a0, a0
7514 ; RV64I-NEXT: addi a0, a0, -1
7515 ; RV64I-NEXT: and a0, a0, s1
7516 ; RV64I-NEXT: slli a0, a0, 56
7517 ; RV64I-NEXT: srai a0, a0, 56
7518 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
7519 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
7520 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
7521 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
7522 ; RV64I-NEXT: addi sp, sp, 32
7525 ; RV32ID-ILP32-LABEL: fcvt_w_s_sat_i8:
7526 ; RV32ID-ILP32: # %bb.0: # %start
7527 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
7528 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7529 ; RV32ID-ILP32-NEXT: call __extendhfsf2
7530 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
7531 ; RV32ID-ILP32-NEXT: feq.s a0, fa5, fa5
7532 ; RV32ID-ILP32-NEXT: neg a0, a0
7533 ; RV32ID-ILP32-NEXT: lui a1, 798720
7534 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a1
7535 ; RV32ID-ILP32-NEXT: fmax.s fa5, fa5, fa4
7536 ; RV32ID-ILP32-NEXT: lui a1, 274400
7537 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a1
7538 ; RV32ID-ILP32-NEXT: fmin.s fa5, fa5, fa4
7539 ; RV32ID-ILP32-NEXT: fcvt.w.s a1, fa5, rtz
7540 ; RV32ID-ILP32-NEXT: and a0, a0, a1
7541 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7542 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
7543 ; RV32ID-ILP32-NEXT: ret
7545 ; RV64ID-LP64-LABEL: fcvt_w_s_sat_i8:
7546 ; RV64ID-LP64: # %bb.0: # %start
7547 ; RV64ID-LP64-NEXT: addi sp, sp, -16
7548 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7549 ; RV64ID-LP64-NEXT: call __extendhfsf2
7550 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
7551 ; RV64ID-LP64-NEXT: feq.s a0, fa5, fa5
7552 ; RV64ID-LP64-NEXT: neg a0, a0
7553 ; RV64ID-LP64-NEXT: lui a1, 798720
7554 ; RV64ID-LP64-NEXT: fmv.w.x fa4, a1
7555 ; RV64ID-LP64-NEXT: fmax.s fa5, fa5, fa4
7556 ; RV64ID-LP64-NEXT: lui a1, 274400
7557 ; RV64ID-LP64-NEXT: fmv.w.x fa4, a1
7558 ; RV64ID-LP64-NEXT: fmin.s fa5, fa5, fa4
7559 ; RV64ID-LP64-NEXT: fcvt.l.s a1, fa5, rtz
7560 ; RV64ID-LP64-NEXT: and a0, a0, a1
7561 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7562 ; RV64ID-LP64-NEXT: addi sp, sp, 16
7563 ; RV64ID-LP64-NEXT: ret
7565 ; RV32ID-LABEL: fcvt_w_s_sat_i8:
7566 ; RV32ID: # %bb.0: # %start
7567 ; RV32ID-NEXT: addi sp, sp, -16
7568 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7569 ; RV32ID-NEXT: call __extendhfsf2
7570 ; RV32ID-NEXT: feq.s a0, fa0, fa0
7571 ; RV32ID-NEXT: neg a0, a0
7572 ; RV32ID-NEXT: lui a1, 798720
7573 ; RV32ID-NEXT: fmv.w.x fa5, a1
7574 ; RV32ID-NEXT: fmax.s fa5, fa0, fa5
7575 ; RV32ID-NEXT: lui a1, 274400
7576 ; RV32ID-NEXT: fmv.w.x fa4, a1
7577 ; RV32ID-NEXT: fmin.s fa5, fa5, fa4
7578 ; RV32ID-NEXT: fcvt.w.s a1, fa5, rtz
7579 ; RV32ID-NEXT: and a0, a0, a1
7580 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7581 ; RV32ID-NEXT: addi sp, sp, 16
7584 ; RV64ID-LABEL: fcvt_w_s_sat_i8:
7585 ; RV64ID: # %bb.0: # %start
7586 ; RV64ID-NEXT: addi sp, sp, -16
7587 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7588 ; RV64ID-NEXT: call __extendhfsf2
7589 ; RV64ID-NEXT: feq.s a0, fa0, fa0
7590 ; RV64ID-NEXT: neg a0, a0
7591 ; RV64ID-NEXT: lui a1, 798720
7592 ; RV64ID-NEXT: fmv.w.x fa5, a1
7593 ; RV64ID-NEXT: fmax.s fa5, fa0, fa5
7594 ; RV64ID-NEXT: lui a1, 274400
7595 ; RV64ID-NEXT: fmv.w.x fa4, a1
7596 ; RV64ID-NEXT: fmin.s fa5, fa5, fa4
7597 ; RV64ID-NEXT: fcvt.l.s a1, fa5, rtz
7598 ; RV64ID-NEXT: and a0, a0, a1
7599 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7600 ; RV64ID-NEXT: addi sp, sp, 16
7603 ; CHECK32-IZFHMIN-LABEL: fcvt_w_s_sat_i8:
7604 ; CHECK32-IZFHMIN: # %bb.0: # %start
7605 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
7606 ; CHECK32-IZFHMIN-NEXT: feq.s a0, fa5, fa5
7607 ; CHECK32-IZFHMIN-NEXT: neg a0, a0
7608 ; CHECK32-IZFHMIN-NEXT: lui a1, 798720
7609 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa4, a1
7610 ; CHECK32-IZFHMIN-NEXT: fmax.s fa5, fa5, fa4
7611 ; CHECK32-IZFHMIN-NEXT: lui a1, 274400
7612 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa4, a1
7613 ; CHECK32-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
7614 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a1, fa5, rtz
7615 ; CHECK32-IZFHMIN-NEXT: and a0, a0, a1
7616 ; CHECK32-IZFHMIN-NEXT: ret
7618 ; CHECK64-IZFHMIN-LABEL: fcvt_w_s_sat_i8:
7619 ; CHECK64-IZFHMIN: # %bb.0: # %start
7620 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
7621 ; CHECK64-IZFHMIN-NEXT: feq.s a0, fa5, fa5
7622 ; CHECK64-IZFHMIN-NEXT: neg a0, a0
7623 ; CHECK64-IZFHMIN-NEXT: lui a1, 798720
7624 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa4, a1
7625 ; CHECK64-IZFHMIN-NEXT: fmax.s fa5, fa5, fa4
7626 ; CHECK64-IZFHMIN-NEXT: lui a1, 274400
7627 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa4, a1
7628 ; CHECK64-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
7629 ; CHECK64-IZFHMIN-NEXT: fcvt.l.s a1, fa5, rtz
7630 ; CHECK64-IZFHMIN-NEXT: and a0, a0, a1
7631 ; CHECK64-IZFHMIN-NEXT: ret
7633 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_s_sat_i8:
7634 ; CHECK32-IZHINXMIN: # %bb.0: # %start
7635 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7636 ; CHECK32-IZHINXMIN-NEXT: feq.s a1, a0, a0
7637 ; CHECK32-IZHINXMIN-NEXT: neg a1, a1
7638 ; CHECK32-IZHINXMIN-NEXT: lui a2, 798720
7639 ; CHECK32-IZHINXMIN-NEXT: fmax.s a0, a0, a2
7640 ; CHECK32-IZHINXMIN-NEXT: lui a2, 274400
7641 ; CHECK32-IZHINXMIN-NEXT: fmin.s a0, a0, a2
7642 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
7643 ; CHECK32-IZHINXMIN-NEXT: and a0, a1, a0
7644 ; CHECK32-IZHINXMIN-NEXT: ret
7646 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_s_sat_i8:
7647 ; CHECK64-IZHINXMIN: # %bb.0: # %start
7648 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7649 ; CHECK64-IZHINXMIN-NEXT: feq.s a1, a0, a0
7650 ; CHECK64-IZHINXMIN-NEXT: neg a1, a1
7651 ; CHECK64-IZHINXMIN-NEXT: lui a2, 798720
7652 ; CHECK64-IZHINXMIN-NEXT: fmax.s a0, a0, a2
7653 ; CHECK64-IZHINXMIN-NEXT: lui a2, 274400
7654 ; CHECK64-IZHINXMIN-NEXT: fmin.s a0, a0, a2
7655 ; CHECK64-IZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
7656 ; CHECK64-IZHINXMIN-NEXT: and a0, a1, a0
7657 ; CHECK64-IZHINXMIN-NEXT: ret
7659 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_s_sat_i8:
7660 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
7661 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7662 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a1, a0, a0
7663 ; CHECK32-IZDINXZHINXMIN-NEXT: neg a1, a1
7664 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a2, 798720
7665 ; CHECK32-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, a2
7666 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a2, 274400
7667 ; CHECK32-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a2
7668 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
7669 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a1, a0
7670 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
7672 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_s_sat_i8:
7673 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
7674 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7675 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a1, a0, a0
7676 ; CHECK64-IZDINXZHINXMIN-NEXT: neg a1, a1
7677 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a2, 798720
7678 ; CHECK64-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, a2
7679 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a2, 274400
7680 ; CHECK64-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a2
7681 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.l.s a0, a0, rtz
7682 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a1, a0
7683 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
7685 %0 = tail call i8 @llvm.fptosi.sat.i8.f16(half %a)
7688 declare i8 @llvm.fptosi.sat.i8.f16(half)
7690 define zeroext i8 @fcvt_wu_s_i8(half %a) nounwind {
7691 ; RV32IZFH-LABEL: fcvt_wu_s_i8:
7692 ; RV32IZFH: # %bb.0:
7693 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
7694 ; RV32IZFH-NEXT: ret
7696 ; RV64IZFH-LABEL: fcvt_wu_s_i8:
7697 ; RV64IZFH: # %bb.0:
7698 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
7699 ; RV64IZFH-NEXT: ret
7701 ; RV32IDZFH-LABEL: fcvt_wu_s_i8:
7702 ; RV32IDZFH: # %bb.0:
7703 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
7704 ; RV32IDZFH-NEXT: ret
7706 ; RV64IDZFH-LABEL: fcvt_wu_s_i8:
7707 ; RV64IDZFH: # %bb.0:
7708 ; RV64IDZFH-NEXT: fcvt.lu.h a0, fa0, rtz
7709 ; RV64IDZFH-NEXT: ret
7711 ; RV32IZHINX-LABEL: fcvt_wu_s_i8:
7712 ; RV32IZHINX: # %bb.0:
7713 ; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz
7714 ; RV32IZHINX-NEXT: ret
7716 ; RV64IZHINX-LABEL: fcvt_wu_s_i8:
7717 ; RV64IZHINX: # %bb.0:
7718 ; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz
7719 ; RV64IZHINX-NEXT: ret
7721 ; RV32IZDINXZHINX-LABEL: fcvt_wu_s_i8:
7722 ; RV32IZDINXZHINX: # %bb.0:
7723 ; RV32IZDINXZHINX-NEXT: fcvt.wu.h a0, a0, rtz
7724 ; RV32IZDINXZHINX-NEXT: ret
7726 ; RV64IZDINXZHINX-LABEL: fcvt_wu_s_i8:
7727 ; RV64IZDINXZHINX: # %bb.0:
7728 ; RV64IZDINXZHINX-NEXT: fcvt.lu.h a0, a0, rtz
7729 ; RV64IZDINXZHINX-NEXT: ret
7731 ; RV32I-LABEL: fcvt_wu_s_i8:
7733 ; RV32I-NEXT: addi sp, sp, -16
7734 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7735 ; RV32I-NEXT: slli a0, a0, 16
7736 ; RV32I-NEXT: srli a0, a0, 16
7737 ; RV32I-NEXT: call __extendhfsf2
7738 ; RV32I-NEXT: call __fixunssfsi
7739 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7740 ; RV32I-NEXT: addi sp, sp, 16
7743 ; RV64I-LABEL: fcvt_wu_s_i8:
7745 ; RV64I-NEXT: addi sp, sp, -16
7746 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7747 ; RV64I-NEXT: slli a0, a0, 48
7748 ; RV64I-NEXT: srli a0, a0, 48
7749 ; RV64I-NEXT: call __extendhfsf2
7750 ; RV64I-NEXT: call __fixunssfdi
7751 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7752 ; RV64I-NEXT: addi sp, sp, 16
7755 ; RV32ID-ILP32-LABEL: fcvt_wu_s_i8:
7756 ; RV32ID-ILP32: # %bb.0:
7757 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
7758 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7759 ; RV32ID-ILP32-NEXT: call __extendhfsf2
7760 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
7761 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
7762 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7763 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
7764 ; RV32ID-ILP32-NEXT: ret
7766 ; RV64ID-LP64-LABEL: fcvt_wu_s_i8:
7767 ; RV64ID-LP64: # %bb.0:
7768 ; RV64ID-LP64-NEXT: addi sp, sp, -16
7769 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7770 ; RV64ID-LP64-NEXT: call __extendhfsf2
7771 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
7772 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
7773 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7774 ; RV64ID-LP64-NEXT: addi sp, sp, 16
7775 ; RV64ID-LP64-NEXT: ret
7777 ; RV32ID-LABEL: fcvt_wu_s_i8:
7779 ; RV32ID-NEXT: addi sp, sp, -16
7780 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7781 ; RV32ID-NEXT: call __extendhfsf2
7782 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
7783 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7784 ; RV32ID-NEXT: addi sp, sp, 16
7787 ; RV64ID-LABEL: fcvt_wu_s_i8:
7789 ; RV64ID-NEXT: addi sp, sp, -16
7790 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
7791 ; RV64ID-NEXT: call __extendhfsf2
7792 ; RV64ID-NEXT: fcvt.lu.s a0, fa0, rtz
7793 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
7794 ; RV64ID-NEXT: addi sp, sp, 16
7797 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_s_i8:
7798 ; CHECK32-IZFHMIN: # %bb.0:
7799 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
7800 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
7801 ; CHECK32-IZFHMIN-NEXT: ret
7803 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_s_i8:
7804 ; CHECK64-IZFHMIN: # %bb.0:
7805 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
7806 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
7807 ; CHECK64-IZFHMIN-NEXT: ret
7809 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_s_i8:
7810 ; CHECK32-IZHINXMIN: # %bb.0:
7811 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7812 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
7813 ; CHECK32-IZHINXMIN-NEXT: ret
7815 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_s_i8:
7816 ; CHECK64-IZHINXMIN: # %bb.0:
7817 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
7818 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
7819 ; CHECK64-IZHINXMIN-NEXT: ret
7821 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_s_i8:
7822 ; CHECK32-IZDINXZHINXMIN: # %bb.0:
7823 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7824 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
7825 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
7827 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_s_i8:
7828 ; CHECK64-IZDINXZHINXMIN: # %bb.0:
7829 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
7830 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
7831 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
7832 %1 = fptoui half %a to i8
7836 define zeroext i8 @fcvt_wu_s_sat_i8(half %a) nounwind {
7837 ; RV32IZFH-LABEL: fcvt_wu_s_sat_i8:
7838 ; RV32IZFH: # %bb.0: # %start
7839 ; RV32IZFH-NEXT: fcvt.s.h fa5, fa0
7840 ; RV32IZFH-NEXT: fmv.w.x fa4, zero
7841 ; RV32IZFH-NEXT: fmax.s fa5, fa5, fa4
7842 ; RV32IZFH-NEXT: lui a0, 276464
7843 ; RV32IZFH-NEXT: fmv.w.x fa4, a0
7844 ; RV32IZFH-NEXT: fmin.s fa5, fa5, fa4
7845 ; RV32IZFH-NEXT: fcvt.wu.s a0, fa5, rtz
7846 ; RV32IZFH-NEXT: ret
7848 ; RV64IZFH-LABEL: fcvt_wu_s_sat_i8:
7849 ; RV64IZFH: # %bb.0: # %start
7850 ; RV64IZFH-NEXT: fcvt.s.h fa5, fa0
7851 ; RV64IZFH-NEXT: fmv.w.x fa4, zero
7852 ; RV64IZFH-NEXT: fmax.s fa5, fa5, fa4
7853 ; RV64IZFH-NEXT: lui a0, 276464
7854 ; RV64IZFH-NEXT: fmv.w.x fa4, a0
7855 ; RV64IZFH-NEXT: fmin.s fa5, fa5, fa4
7856 ; RV64IZFH-NEXT: fcvt.lu.s a0, fa5, rtz
7857 ; RV64IZFH-NEXT: ret
7859 ; RV32IDZFH-LABEL: fcvt_wu_s_sat_i8:
7860 ; RV32IDZFH: # %bb.0: # %start
7861 ; RV32IDZFH-NEXT: fcvt.s.h fa5, fa0
7862 ; RV32IDZFH-NEXT: fmv.w.x fa4, zero
7863 ; RV32IDZFH-NEXT: fmax.s fa5, fa5, fa4
7864 ; RV32IDZFH-NEXT: lui a0, 276464
7865 ; RV32IDZFH-NEXT: fmv.w.x fa4, a0
7866 ; RV32IDZFH-NEXT: fmin.s fa5, fa5, fa4
7867 ; RV32IDZFH-NEXT: fcvt.wu.s a0, fa5, rtz
7868 ; RV32IDZFH-NEXT: ret
7870 ; RV64IDZFH-LABEL: fcvt_wu_s_sat_i8:
7871 ; RV64IDZFH: # %bb.0: # %start
7872 ; RV64IDZFH-NEXT: fcvt.s.h fa5, fa0
7873 ; RV64IDZFH-NEXT: fmv.w.x fa4, zero
7874 ; RV64IDZFH-NEXT: fmax.s fa5, fa5, fa4
7875 ; RV64IDZFH-NEXT: lui a0, 276464
7876 ; RV64IDZFH-NEXT: fmv.w.x fa4, a0
7877 ; RV64IDZFH-NEXT: fmin.s fa5, fa5, fa4
7878 ; RV64IDZFH-NEXT: fcvt.lu.s a0, fa5, rtz
7879 ; RV64IDZFH-NEXT: ret
7881 ; RV32IZHINX-LABEL: fcvt_wu_s_sat_i8:
7882 ; RV32IZHINX: # %bb.0: # %start
7883 ; RV32IZHINX-NEXT: fcvt.s.h a0, a0
7884 ; RV32IZHINX-NEXT: fmax.s a0, a0, zero
7885 ; RV32IZHINX-NEXT: lui a1, 276464
7886 ; RV32IZHINX-NEXT: fmin.s a0, a0, a1
7887 ; RV32IZHINX-NEXT: fcvt.wu.s a0, a0, rtz
7888 ; RV32IZHINX-NEXT: ret
7890 ; RV64IZHINX-LABEL: fcvt_wu_s_sat_i8:
7891 ; RV64IZHINX: # %bb.0: # %start
7892 ; RV64IZHINX-NEXT: fcvt.s.h a0, a0
7893 ; RV64IZHINX-NEXT: fmax.s a0, a0, zero
7894 ; RV64IZHINX-NEXT: lui a1, 276464
7895 ; RV64IZHINX-NEXT: fmin.s a0, a0, a1
7896 ; RV64IZHINX-NEXT: fcvt.lu.s a0, a0, rtz
7897 ; RV64IZHINX-NEXT: ret
7899 ; RV32IZDINXZHINX-LABEL: fcvt_wu_s_sat_i8:
7900 ; RV32IZDINXZHINX: # %bb.0: # %start
7901 ; RV32IZDINXZHINX-NEXT: fcvt.s.h a0, a0
7902 ; RV32IZDINXZHINX-NEXT: fmax.s a0, a0, zero
7903 ; RV32IZDINXZHINX-NEXT: lui a1, 276464
7904 ; RV32IZDINXZHINX-NEXT: fmin.s a0, a0, a1
7905 ; RV32IZDINXZHINX-NEXT: fcvt.wu.s a0, a0, rtz
7906 ; RV32IZDINXZHINX-NEXT: ret
7908 ; RV64IZDINXZHINX-LABEL: fcvt_wu_s_sat_i8:
7909 ; RV64IZDINXZHINX: # %bb.0: # %start
7910 ; RV64IZDINXZHINX-NEXT: fcvt.s.h a0, a0
7911 ; RV64IZDINXZHINX-NEXT: fmax.s a0, a0, zero
7912 ; RV64IZDINXZHINX-NEXT: lui a1, 276464
7913 ; RV64IZDINXZHINX-NEXT: fmin.s a0, a0, a1
7914 ; RV64IZDINXZHINX-NEXT: fcvt.lu.s a0, a0, rtz
7915 ; RV64IZDINXZHINX-NEXT: ret
7917 ; RV32I-LABEL: fcvt_wu_s_sat_i8:
7918 ; RV32I: # %bb.0: # %start
7919 ; RV32I-NEXT: addi sp, sp, -16
7920 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7921 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
7922 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
7923 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
7924 ; RV32I-NEXT: slli a0, a0, 16
7925 ; RV32I-NEXT: srli a0, a0, 16
7926 ; RV32I-NEXT: call __extendhfsf2
7927 ; RV32I-NEXT: mv s2, a0
7928 ; RV32I-NEXT: li a1, 0
7929 ; RV32I-NEXT: call __gesf2
7930 ; RV32I-NEXT: mv s0, a0
7931 ; RV32I-NEXT: mv a0, s2
7932 ; RV32I-NEXT: call __fixunssfsi
7933 ; RV32I-NEXT: mv s1, a0
7934 ; RV32I-NEXT: lui a1, 276464
7935 ; RV32I-NEXT: mv a0, s2
7936 ; RV32I-NEXT: call __gtsf2
7937 ; RV32I-NEXT: blez a0, .LBB38_2
7938 ; RV32I-NEXT: # %bb.1: # %start
7939 ; RV32I-NEXT: li a0, 255
7940 ; RV32I-NEXT: j .LBB38_3
7941 ; RV32I-NEXT: .LBB38_2:
7942 ; RV32I-NEXT: slti a0, s0, 0
7943 ; RV32I-NEXT: addi a0, a0, -1
7944 ; RV32I-NEXT: and a0, a0, s1
7945 ; RV32I-NEXT: .LBB38_3: # %start
7946 ; RV32I-NEXT: andi a0, a0, 255
7947 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
7948 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
7949 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
7950 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
7951 ; RV32I-NEXT: addi sp, sp, 16
7954 ; RV64I-LABEL: fcvt_wu_s_sat_i8:
7955 ; RV64I: # %bb.0: # %start
7956 ; RV64I-NEXT: addi sp, sp, -32
7957 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
7958 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
7959 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
7960 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
7961 ; RV64I-NEXT: slli a0, a0, 48
7962 ; RV64I-NEXT: srli a0, a0, 48
7963 ; RV64I-NEXT: call __extendhfsf2
7964 ; RV64I-NEXT: mv s2, a0
7965 ; RV64I-NEXT: li a1, 0
7966 ; RV64I-NEXT: call __gesf2
7967 ; RV64I-NEXT: mv s0, a0
7968 ; RV64I-NEXT: mv a0, s2
7969 ; RV64I-NEXT: call __fixunssfdi
7970 ; RV64I-NEXT: mv s1, a0
7971 ; RV64I-NEXT: lui a1, 276464
7972 ; RV64I-NEXT: mv a0, s2
7973 ; RV64I-NEXT: call __gtsf2
7974 ; RV64I-NEXT: blez a0, .LBB38_2
7975 ; RV64I-NEXT: # %bb.1: # %start
7976 ; RV64I-NEXT: li a0, 255
7977 ; RV64I-NEXT: j .LBB38_3
7978 ; RV64I-NEXT: .LBB38_2:
7979 ; RV64I-NEXT: slti a0, s0, 0
7980 ; RV64I-NEXT: addi a0, a0, -1
7981 ; RV64I-NEXT: and a0, a0, s1
7982 ; RV64I-NEXT: .LBB38_3: # %start
7983 ; RV64I-NEXT: andi a0, a0, 255
7984 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
7985 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
7986 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
7987 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
7988 ; RV64I-NEXT: addi sp, sp, 32
7991 ; RV32ID-ILP32-LABEL: fcvt_wu_s_sat_i8:
7992 ; RV32ID-ILP32: # %bb.0: # %start
7993 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
7994 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
7995 ; RV32ID-ILP32-NEXT: call __extendhfsf2
7996 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
7997 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, zero
7998 ; RV32ID-ILP32-NEXT: fmax.s fa5, fa5, fa4
7999 ; RV32ID-ILP32-NEXT: lui a0, 276464
8000 ; RV32ID-ILP32-NEXT: fmv.w.x fa4, a0
8001 ; RV32ID-ILP32-NEXT: fmin.s fa5, fa5, fa4
8002 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
8003 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8004 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
8005 ; RV32ID-ILP32-NEXT: ret
8007 ; RV64ID-LP64-LABEL: fcvt_wu_s_sat_i8:
8008 ; RV64ID-LP64: # %bb.0: # %start
8009 ; RV64ID-LP64-NEXT: addi sp, sp, -16
8010 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
8011 ; RV64ID-LP64-NEXT: call __extendhfsf2
8012 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
8013 ; RV64ID-LP64-NEXT: fmv.w.x fa4, zero
8014 ; RV64ID-LP64-NEXT: fmax.s fa5, fa5, fa4
8015 ; RV64ID-LP64-NEXT: lui a0, 276464
8016 ; RV64ID-LP64-NEXT: fmv.w.x fa4, a0
8017 ; RV64ID-LP64-NEXT: fmin.s fa5, fa5, fa4
8018 ; RV64ID-LP64-NEXT: fcvt.lu.s a0, fa5, rtz
8019 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
8020 ; RV64ID-LP64-NEXT: addi sp, sp, 16
8021 ; RV64ID-LP64-NEXT: ret
8023 ; RV32ID-LABEL: fcvt_wu_s_sat_i8:
8024 ; RV32ID: # %bb.0: # %start
8025 ; RV32ID-NEXT: addi sp, sp, -16
8026 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
8027 ; RV32ID-NEXT: call __extendhfsf2
8028 ; RV32ID-NEXT: fmv.w.x fa5, zero
8029 ; RV32ID-NEXT: fmax.s fa5, fa0, fa5
8030 ; RV32ID-NEXT: lui a0, 276464
8031 ; RV32ID-NEXT: fmv.w.x fa4, a0
8032 ; RV32ID-NEXT: fmin.s fa5, fa5, fa4
8033 ; RV32ID-NEXT: fcvt.wu.s a0, fa5, rtz
8034 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8035 ; RV32ID-NEXT: addi sp, sp, 16
8038 ; RV64ID-LABEL: fcvt_wu_s_sat_i8:
8039 ; RV64ID: # %bb.0: # %start
8040 ; RV64ID-NEXT: addi sp, sp, -16
8041 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
8042 ; RV64ID-NEXT: call __extendhfsf2
8043 ; RV64ID-NEXT: fmv.w.x fa5, zero
8044 ; RV64ID-NEXT: fmax.s fa5, fa0, fa5
8045 ; RV64ID-NEXT: lui a0, 276464
8046 ; RV64ID-NEXT: fmv.w.x fa4, a0
8047 ; RV64ID-NEXT: fmin.s fa5, fa5, fa4
8048 ; RV64ID-NEXT: fcvt.lu.s a0, fa5, rtz
8049 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
8050 ; RV64ID-NEXT: addi sp, sp, 16
8053 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_s_sat_i8:
8054 ; CHECK32-IZFHMIN: # %bb.0: # %start
8055 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
8056 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa4, zero
8057 ; CHECK32-IZFHMIN-NEXT: fmax.s fa5, fa5, fa4
8058 ; CHECK32-IZFHMIN-NEXT: lui a0, 276464
8059 ; CHECK32-IZFHMIN-NEXT: fmv.w.x fa4, a0
8060 ; CHECK32-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
8061 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
8062 ; CHECK32-IZFHMIN-NEXT: ret
8064 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_s_sat_i8:
8065 ; CHECK64-IZFHMIN: # %bb.0: # %start
8066 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
8067 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa4, zero
8068 ; CHECK64-IZFHMIN-NEXT: fmax.s fa5, fa5, fa4
8069 ; CHECK64-IZFHMIN-NEXT: lui a0, 276464
8070 ; CHECK64-IZFHMIN-NEXT: fmv.w.x fa4, a0
8071 ; CHECK64-IZFHMIN-NEXT: fmin.s fa5, fa5, fa4
8072 ; CHECK64-IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
8073 ; CHECK64-IZFHMIN-NEXT: ret
8075 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_s_sat_i8:
8076 ; CHECK32-IZHINXMIN: # %bb.0: # %start
8077 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
8078 ; CHECK32-IZHINXMIN-NEXT: fmax.s a0, a0, zero
8079 ; CHECK32-IZHINXMIN-NEXT: lui a1, 276464
8080 ; CHECK32-IZHINXMIN-NEXT: fmin.s a0, a0, a1
8081 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
8082 ; CHECK32-IZHINXMIN-NEXT: ret
8084 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_s_sat_i8:
8085 ; CHECK64-IZHINXMIN: # %bb.0: # %start
8086 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
8087 ; CHECK64-IZHINXMIN-NEXT: fmax.s a0, a0, zero
8088 ; CHECK64-IZHINXMIN-NEXT: lui a1, 276464
8089 ; CHECK64-IZHINXMIN-NEXT: fmin.s a0, a0, a1
8090 ; CHECK64-IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
8091 ; CHECK64-IZHINXMIN-NEXT: ret
8093 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_s_sat_i8:
8094 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
8095 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
8096 ; CHECK32-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, zero
8097 ; CHECK32-IZDINXZHINXMIN-NEXT: lui a1, 276464
8098 ; CHECK32-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a1
8099 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
8100 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
8102 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_s_sat_i8:
8103 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
8104 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
8105 ; CHECK64-IZDINXZHINXMIN-NEXT: fmax.s a0, a0, zero
8106 ; CHECK64-IZDINXZHINXMIN-NEXT: lui a1, 276464
8107 ; CHECK64-IZDINXZHINXMIN-NEXT: fmin.s a0, a0, a1
8108 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
8109 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
8111 %0 = tail call i8 @llvm.fptoui.sat.i8.f16(half %a)
8114 declare i8 @llvm.fptoui.sat.i8.f16(half)
8116 define zeroext i32 @fcvt_wu_h_sat_zext(half %a) nounwind {
8117 ; RV32IZFH-LABEL: fcvt_wu_h_sat_zext:
8118 ; RV32IZFH: # %bb.0: # %start
8119 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
8120 ; RV32IZFH-NEXT: feq.h a1, fa0, fa0
8121 ; RV32IZFH-NEXT: seqz a1, a1
8122 ; RV32IZFH-NEXT: addi a1, a1, -1
8123 ; RV32IZFH-NEXT: and a0, a1, a0
8124 ; RV32IZFH-NEXT: ret
8126 ; RV64IZFH-LABEL: fcvt_wu_h_sat_zext:
8127 ; RV64IZFH: # %bb.0: # %start
8128 ; RV64IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
8129 ; RV64IZFH-NEXT: feq.h a1, fa0, fa0
8130 ; RV64IZFH-NEXT: seqz a1, a1
8131 ; RV64IZFH-NEXT: addi a1, a1, -1
8132 ; RV64IZFH-NEXT: and a0, a0, a1
8133 ; RV64IZFH-NEXT: slli a0, a0, 32
8134 ; RV64IZFH-NEXT: srli a0, a0, 32
8135 ; RV64IZFH-NEXT: ret
8137 ; RV32IDZFH-LABEL: fcvt_wu_h_sat_zext:
8138 ; RV32IDZFH: # %bb.0: # %start
8139 ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
8140 ; RV32IDZFH-NEXT: feq.h a1, fa0, fa0
8141 ; RV32IDZFH-NEXT: seqz a1, a1
8142 ; RV32IDZFH-NEXT: addi a1, a1, -1
8143 ; RV32IDZFH-NEXT: and a0, a1, a0
8144 ; RV32IDZFH-NEXT: ret
8146 ; RV64IDZFH-LABEL: fcvt_wu_h_sat_zext:
8147 ; RV64IDZFH: # %bb.0: # %start
8148 ; RV64IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz
8149 ; RV64IDZFH-NEXT: feq.h a1, fa0, fa0
8150 ; RV64IDZFH-NEXT: seqz a1, a1
8151 ; RV64IDZFH-NEXT: addi a1, a1, -1
8152 ; RV64IDZFH-NEXT: and a0, a0, a1
8153 ; RV64IDZFH-NEXT: slli a0, a0, 32
8154 ; RV64IDZFH-NEXT: srli a0, a0, 32
8155 ; RV64IDZFH-NEXT: ret
8157 ; RV32IZHINX-LABEL: fcvt_wu_h_sat_zext:
8158 ; RV32IZHINX: # %bb.0: # %start
8159 ; RV32IZHINX-NEXT: fcvt.wu.h a1, a0, rtz
8160 ; RV32IZHINX-NEXT: feq.h a0, a0, a0
8161 ; RV32IZHINX-NEXT: seqz a0, a0
8162 ; RV32IZHINX-NEXT: addi a0, a0, -1
8163 ; RV32IZHINX-NEXT: and a0, a0, a1
8164 ; RV32IZHINX-NEXT: ret
8166 ; RV64IZHINX-LABEL: fcvt_wu_h_sat_zext:
8167 ; RV64IZHINX: # %bb.0: # %start
8168 ; RV64IZHINX-NEXT: fcvt.wu.h a1, a0, rtz
8169 ; RV64IZHINX-NEXT: feq.h a0, a0, a0
8170 ; RV64IZHINX-NEXT: seqz a0, a0
8171 ; RV64IZHINX-NEXT: addi a0, a0, -1
8172 ; RV64IZHINX-NEXT: and a0, a1, a0
8173 ; RV64IZHINX-NEXT: slli a0, a0, 32
8174 ; RV64IZHINX-NEXT: srli a0, a0, 32
8175 ; RV64IZHINX-NEXT: ret
8177 ; RV32IZDINXZHINX-LABEL: fcvt_wu_h_sat_zext:
8178 ; RV32IZDINXZHINX: # %bb.0: # %start
8179 ; RV32IZDINXZHINX-NEXT: fcvt.wu.h a1, a0, rtz
8180 ; RV32IZDINXZHINX-NEXT: feq.h a0, a0, a0
8181 ; RV32IZDINXZHINX-NEXT: seqz a0, a0
8182 ; RV32IZDINXZHINX-NEXT: addi a0, a0, -1
8183 ; RV32IZDINXZHINX-NEXT: and a0, a0, a1
8184 ; RV32IZDINXZHINX-NEXT: ret
8186 ; RV64IZDINXZHINX-LABEL: fcvt_wu_h_sat_zext:
8187 ; RV64IZDINXZHINX: # %bb.0: # %start
8188 ; RV64IZDINXZHINX-NEXT: fcvt.wu.h a1, a0, rtz
8189 ; RV64IZDINXZHINX-NEXT: feq.h a0, a0, a0
8190 ; RV64IZDINXZHINX-NEXT: seqz a0, a0
8191 ; RV64IZDINXZHINX-NEXT: addi a0, a0, -1
8192 ; RV64IZDINXZHINX-NEXT: and a0, a1, a0
8193 ; RV64IZDINXZHINX-NEXT: slli a0, a0, 32
8194 ; RV64IZDINXZHINX-NEXT: srli a0, a0, 32
8195 ; RV64IZDINXZHINX-NEXT: ret
8197 ; RV32I-LABEL: fcvt_wu_h_sat_zext:
8198 ; RV32I: # %bb.0: # %start
8199 ; RV32I-NEXT: addi sp, sp, -16
8200 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
8201 ; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
8202 ; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
8203 ; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill
8204 ; RV32I-NEXT: slli a0, a0, 16
8205 ; RV32I-NEXT: srli a0, a0, 16
8206 ; RV32I-NEXT: call __extendhfsf2
8207 ; RV32I-NEXT: mv s0, a0
8208 ; RV32I-NEXT: lui a1, 325632
8209 ; RV32I-NEXT: addi a1, a1, -1
8210 ; RV32I-NEXT: call __gtsf2
8211 ; RV32I-NEXT: sgtz a0, a0
8212 ; RV32I-NEXT: neg s1, a0
8213 ; RV32I-NEXT: mv a0, s0
8214 ; RV32I-NEXT: li a1, 0
8215 ; RV32I-NEXT: call __gesf2
8216 ; RV32I-NEXT: slti a0, a0, 0
8217 ; RV32I-NEXT: addi s2, a0, -1
8218 ; RV32I-NEXT: mv a0, s0
8219 ; RV32I-NEXT: call __fixunssfsi
8220 ; RV32I-NEXT: and a0, s2, a0
8221 ; RV32I-NEXT: or a0, s1, a0
8222 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8223 ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
8224 ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
8225 ; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload
8226 ; RV32I-NEXT: addi sp, sp, 16
8229 ; RV64I-LABEL: fcvt_wu_h_sat_zext:
8230 ; RV64I: # %bb.0: # %start
8231 ; RV64I-NEXT: addi sp, sp, -32
8232 ; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
8233 ; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
8234 ; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
8235 ; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
8236 ; RV64I-NEXT: slli a0, a0, 48
8237 ; RV64I-NEXT: srli a0, a0, 48
8238 ; RV64I-NEXT: call __extendhfsf2
8239 ; RV64I-NEXT: mv s2, a0
8240 ; RV64I-NEXT: li a1, 0
8241 ; RV64I-NEXT: call __gesf2
8242 ; RV64I-NEXT: mv s0, a0
8243 ; RV64I-NEXT: mv a0, s2
8244 ; RV64I-NEXT: call __fixunssfdi
8245 ; RV64I-NEXT: mv s1, a0
8246 ; RV64I-NEXT: lui a1, 325632
8247 ; RV64I-NEXT: addiw a1, a1, -1
8248 ; RV64I-NEXT: mv a0, s2
8249 ; RV64I-NEXT: call __gtsf2
8250 ; RV64I-NEXT: blez a0, .LBB39_2
8251 ; RV64I-NEXT: # %bb.1: # %start
8252 ; RV64I-NEXT: li a0, -1
8253 ; RV64I-NEXT: srli a0, a0, 32
8254 ; RV64I-NEXT: j .LBB39_3
8255 ; RV64I-NEXT: .LBB39_2:
8256 ; RV64I-NEXT: slti a0, s0, 0
8257 ; RV64I-NEXT: addi a0, a0, -1
8258 ; RV64I-NEXT: and a0, a0, s1
8259 ; RV64I-NEXT: .LBB39_3: # %start
8260 ; RV64I-NEXT: slli a0, a0, 32
8261 ; RV64I-NEXT: srli a0, a0, 32
8262 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
8263 ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
8264 ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
8265 ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
8266 ; RV64I-NEXT: addi sp, sp, 32
8269 ; RV32ID-ILP32-LABEL: fcvt_wu_h_sat_zext:
8270 ; RV32ID-ILP32: # %bb.0: # %start
8271 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
8272 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
8273 ; RV32ID-ILP32-NEXT: call __extendhfsf2
8274 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
8275 ; RV32ID-ILP32-NEXT: fcvt.wu.s a0, fa5, rtz
8276 ; RV32ID-ILP32-NEXT: feq.s a1, fa5, fa5
8277 ; RV32ID-ILP32-NEXT: seqz a1, a1
8278 ; RV32ID-ILP32-NEXT: addi a1, a1, -1
8279 ; RV32ID-ILP32-NEXT: and a0, a1, a0
8280 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8281 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
8282 ; RV32ID-ILP32-NEXT: ret
8284 ; RV64ID-LP64-LABEL: fcvt_wu_h_sat_zext:
8285 ; RV64ID-LP64: # %bb.0: # %start
8286 ; RV64ID-LP64-NEXT: addi sp, sp, -16
8287 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
8288 ; RV64ID-LP64-NEXT: call __extendhfsf2
8289 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
8290 ; RV64ID-LP64-NEXT: fcvt.wu.s a0, fa5, rtz
8291 ; RV64ID-LP64-NEXT: feq.s a1, fa5, fa5
8292 ; RV64ID-LP64-NEXT: seqz a1, a1
8293 ; RV64ID-LP64-NEXT: addi a1, a1, -1
8294 ; RV64ID-LP64-NEXT: and a0, a0, a1
8295 ; RV64ID-LP64-NEXT: slli a0, a0, 32
8296 ; RV64ID-LP64-NEXT: srli a0, a0, 32
8297 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
8298 ; RV64ID-LP64-NEXT: addi sp, sp, 16
8299 ; RV64ID-LP64-NEXT: ret
8301 ; RV32ID-LABEL: fcvt_wu_h_sat_zext:
8302 ; RV32ID: # %bb.0: # %start
8303 ; RV32ID-NEXT: addi sp, sp, -16
8304 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
8305 ; RV32ID-NEXT: call __extendhfsf2
8306 ; RV32ID-NEXT: fcvt.wu.s a0, fa0, rtz
8307 ; RV32ID-NEXT: feq.s a1, fa0, fa0
8308 ; RV32ID-NEXT: seqz a1, a1
8309 ; RV32ID-NEXT: addi a1, a1, -1
8310 ; RV32ID-NEXT: and a0, a1, a0
8311 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8312 ; RV32ID-NEXT: addi sp, sp, 16
8315 ; RV64ID-LABEL: fcvt_wu_h_sat_zext:
8316 ; RV64ID: # %bb.0: # %start
8317 ; RV64ID-NEXT: addi sp, sp, -16
8318 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
8319 ; RV64ID-NEXT: call __extendhfsf2
8320 ; RV64ID-NEXT: fcvt.wu.s a0, fa0, rtz
8321 ; RV64ID-NEXT: feq.s a1, fa0, fa0
8322 ; RV64ID-NEXT: seqz a1, a1
8323 ; RV64ID-NEXT: addi a1, a1, -1
8324 ; RV64ID-NEXT: and a0, a0, a1
8325 ; RV64ID-NEXT: slli a0, a0, 32
8326 ; RV64ID-NEXT: srli a0, a0, 32
8327 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
8328 ; RV64ID-NEXT: addi sp, sp, 16
8331 ; CHECK32-IZFHMIN-LABEL: fcvt_wu_h_sat_zext:
8332 ; CHECK32-IZFHMIN: # %bb.0: # %start
8333 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
8334 ; CHECK32-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
8335 ; CHECK32-IZFHMIN-NEXT: feq.s a1, fa5, fa5
8336 ; CHECK32-IZFHMIN-NEXT: seqz a1, a1
8337 ; CHECK32-IZFHMIN-NEXT: addi a1, a1, -1
8338 ; CHECK32-IZFHMIN-NEXT: and a0, a1, a0
8339 ; CHECK32-IZFHMIN-NEXT: ret
8341 ; CHECK64-IZFHMIN-LABEL: fcvt_wu_h_sat_zext:
8342 ; CHECK64-IZFHMIN: # %bb.0: # %start
8343 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
8344 ; CHECK64-IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
8345 ; CHECK64-IZFHMIN-NEXT: feq.s a1, fa5, fa5
8346 ; CHECK64-IZFHMIN-NEXT: seqz a1, a1
8347 ; CHECK64-IZFHMIN-NEXT: addi a1, a1, -1
8348 ; CHECK64-IZFHMIN-NEXT: and a0, a0, a1
8349 ; CHECK64-IZFHMIN-NEXT: slli a0, a0, 32
8350 ; CHECK64-IZFHMIN-NEXT: srli a0, a0, 32
8351 ; CHECK64-IZFHMIN-NEXT: ret
8353 ; CHECK32-IZHINXMIN-LABEL: fcvt_wu_h_sat_zext:
8354 ; CHECK32-IZHINXMIN: # %bb.0: # %start
8355 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
8356 ; CHECK32-IZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
8357 ; CHECK32-IZHINXMIN-NEXT: feq.s a0, a0, a0
8358 ; CHECK32-IZHINXMIN-NEXT: seqz a0, a0
8359 ; CHECK32-IZHINXMIN-NEXT: addi a0, a0, -1
8360 ; CHECK32-IZHINXMIN-NEXT: and a0, a0, a1
8361 ; CHECK32-IZHINXMIN-NEXT: ret
8363 ; CHECK64-IZHINXMIN-LABEL: fcvt_wu_h_sat_zext:
8364 ; CHECK64-IZHINXMIN: # %bb.0: # %start
8365 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
8366 ; CHECK64-IZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
8367 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
8368 ; CHECK64-IZHINXMIN-NEXT: seqz a0, a0
8369 ; CHECK64-IZHINXMIN-NEXT: addi a0, a0, -1
8370 ; CHECK64-IZHINXMIN-NEXT: and a0, a1, a0
8371 ; CHECK64-IZHINXMIN-NEXT: slli a0, a0, 32
8372 ; CHECK64-IZHINXMIN-NEXT: srli a0, a0, 32
8373 ; CHECK64-IZHINXMIN-NEXT: ret
8375 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_wu_h_sat_zext:
8376 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
8377 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
8378 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
8379 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
8380 ; CHECK32-IZDINXZHINXMIN-NEXT: seqz a0, a0
8381 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
8382 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a0, a1
8383 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
8385 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_wu_h_sat_zext:
8386 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
8387 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
8388 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.wu.s a1, a0, rtz
8389 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
8390 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a0, a0
8391 ; CHECK64-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
8392 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a1, a0
8393 ; CHECK64-IZDINXZHINXMIN-NEXT: slli a0, a0, 32
8394 ; CHECK64-IZDINXZHINXMIN-NEXT: srli a0, a0, 32
8395 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
8397 %0 = tail call i32 @llvm.fptoui.sat.i32.f16(half %a)
8401 define signext i32 @fcvt_w_h_sat_sext(half %a) nounwind {
8402 ; CHECKIZFH-LABEL: fcvt_w_h_sat_sext:
8403 ; CHECKIZFH: # %bb.0: # %start
8404 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz
8405 ; CHECKIZFH-NEXT: feq.h a1, fa0, fa0
8406 ; CHECKIZFH-NEXT: seqz a1, a1
8407 ; CHECKIZFH-NEXT: addi a1, a1, -1
8408 ; CHECKIZFH-NEXT: and a0, a1, a0
8409 ; CHECKIZFH-NEXT: ret
8411 ; RV32IDZFH-LABEL: fcvt_w_h_sat_sext:
8412 ; RV32IDZFH: # %bb.0: # %start
8413 ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
8414 ; RV32IDZFH-NEXT: feq.h a1, fa0, fa0
8415 ; RV32IDZFH-NEXT: seqz a1, a1
8416 ; RV32IDZFH-NEXT: addi a1, a1, -1
8417 ; RV32IDZFH-NEXT: and a0, a1, a0
8418 ; RV32IDZFH-NEXT: ret
8420 ; RV64IDZFH-LABEL: fcvt_w_h_sat_sext:
8421 ; RV64IDZFH: # %bb.0: # %start
8422 ; RV64IDZFH-NEXT: fcvt.w.h a0, fa0, rtz
8423 ; RV64IDZFH-NEXT: feq.h a1, fa0, fa0
8424 ; RV64IDZFH-NEXT: seqz a1, a1
8425 ; RV64IDZFH-NEXT: addi a1, a1, -1
8426 ; RV64IDZFH-NEXT: and a0, a1, a0
8427 ; RV64IDZFH-NEXT: ret
8429 ; CHECKIZHINX-LABEL: fcvt_w_h_sat_sext:
8430 ; CHECKIZHINX: # %bb.0: # %start
8431 ; CHECKIZHINX-NEXT: fcvt.w.h a1, a0, rtz
8432 ; CHECKIZHINX-NEXT: feq.h a0, a0, a0
8433 ; CHECKIZHINX-NEXT: seqz a0, a0
8434 ; CHECKIZHINX-NEXT: addi a0, a0, -1
8435 ; CHECKIZHINX-NEXT: and a0, a0, a1
8436 ; CHECKIZHINX-NEXT: ret
8438 ; CHECKIZDINXZHINX-LABEL: fcvt_w_h_sat_sext:
8439 ; CHECKIZDINXZHINX: # %bb.0: # %start
8440 ; CHECKIZDINXZHINX-NEXT: fcvt.w.h a1, a0, rtz
8441 ; CHECKIZDINXZHINX-NEXT: feq.h a0, a0, a0
8442 ; CHECKIZDINXZHINX-NEXT: seqz a0, a0
8443 ; CHECKIZDINXZHINX-NEXT: addi a0, a0, -1
8444 ; CHECKIZDINXZHINX-NEXT: and a0, a0, a1
8445 ; CHECKIZDINXZHINX-NEXT: ret
8447 ; RV32I-LABEL: fcvt_w_h_sat_sext:
8448 ; RV32I: # %bb.0: # %start
8449 ; RV32I-NEXT: addi sp, sp, -32
8450 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
8451 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
8452 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
8453 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
8454 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
8455 ; RV32I-NEXT: slli a0, a0, 16
8456 ; RV32I-NEXT: srli a0, a0, 16
8457 ; RV32I-NEXT: call __extendhfsf2
8458 ; RV32I-NEXT: mv s0, a0
8459 ; RV32I-NEXT: lui a1, 847872
8460 ; RV32I-NEXT: call __gesf2
8461 ; RV32I-NEXT: mv s2, a0
8462 ; RV32I-NEXT: mv a0, s0
8463 ; RV32I-NEXT: call __fixsfsi
8464 ; RV32I-NEXT: mv s1, a0
8465 ; RV32I-NEXT: lui s3, 524288
8466 ; RV32I-NEXT: bgez s2, .LBB40_2
8467 ; RV32I-NEXT: # %bb.1: # %start
8468 ; RV32I-NEXT: lui s1, 524288
8469 ; RV32I-NEXT: .LBB40_2: # %start
8470 ; RV32I-NEXT: lui a1, 323584
8471 ; RV32I-NEXT: addi a1, a1, -1
8472 ; RV32I-NEXT: mv a0, s0
8473 ; RV32I-NEXT: call __gtsf2
8474 ; RV32I-NEXT: blez a0, .LBB40_4
8475 ; RV32I-NEXT: # %bb.3: # %start
8476 ; RV32I-NEXT: addi s1, s3, -1
8477 ; RV32I-NEXT: .LBB40_4: # %start
8478 ; RV32I-NEXT: mv a0, s0
8479 ; RV32I-NEXT: mv a1, s0
8480 ; RV32I-NEXT: call __unordsf2
8481 ; RV32I-NEXT: snez a0, a0
8482 ; RV32I-NEXT: addi a0, a0, -1
8483 ; RV32I-NEXT: and a0, a0, s1
8484 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
8485 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
8486 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
8487 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
8488 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
8489 ; RV32I-NEXT: addi sp, sp, 32
8492 ; RV64I-LABEL: fcvt_w_h_sat_sext:
8493 ; RV64I: # %bb.0: # %start
8494 ; RV64I-NEXT: addi sp, sp, -48
8495 ; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
8496 ; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
8497 ; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
8498 ; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill
8499 ; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill
8500 ; RV64I-NEXT: slli a0, a0, 48
8501 ; RV64I-NEXT: srli a0, a0, 48
8502 ; RV64I-NEXT: call __extendhfsf2
8503 ; RV64I-NEXT: mv s0, a0
8504 ; RV64I-NEXT: lui a1, 847872
8505 ; RV64I-NEXT: call __gesf2
8506 ; RV64I-NEXT: mv s2, a0
8507 ; RV64I-NEXT: mv a0, s0
8508 ; RV64I-NEXT: call __fixsfdi
8509 ; RV64I-NEXT: mv s1, a0
8510 ; RV64I-NEXT: lui s3, 524288
8511 ; RV64I-NEXT: bgez s2, .LBB40_2
8512 ; RV64I-NEXT: # %bb.1: # %start
8513 ; RV64I-NEXT: lui s1, 524288
8514 ; RV64I-NEXT: .LBB40_2: # %start
8515 ; RV64I-NEXT: lui a1, 323584
8516 ; RV64I-NEXT: addiw a1, a1, -1
8517 ; RV64I-NEXT: mv a0, s0
8518 ; RV64I-NEXT: call __gtsf2
8519 ; RV64I-NEXT: blez a0, .LBB40_4
8520 ; RV64I-NEXT: # %bb.3: # %start
8521 ; RV64I-NEXT: addi s1, s3, -1
8522 ; RV64I-NEXT: .LBB40_4: # %start
8523 ; RV64I-NEXT: mv a0, s0
8524 ; RV64I-NEXT: mv a1, s0
8525 ; RV64I-NEXT: call __unordsf2
8526 ; RV64I-NEXT: snez a0, a0
8527 ; RV64I-NEXT: addi a0, a0, -1
8528 ; RV64I-NEXT: and a0, a0, s1
8529 ; RV64I-NEXT: sext.w a0, a0
8530 ; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
8531 ; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
8532 ; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
8533 ; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload
8534 ; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload
8535 ; RV64I-NEXT: addi sp, sp, 48
8538 ; RV32ID-ILP32-LABEL: fcvt_w_h_sat_sext:
8539 ; RV32ID-ILP32: # %bb.0: # %start
8540 ; RV32ID-ILP32-NEXT: addi sp, sp, -16
8541 ; RV32ID-ILP32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
8542 ; RV32ID-ILP32-NEXT: call __extendhfsf2
8543 ; RV32ID-ILP32-NEXT: fmv.w.x fa5, a0
8544 ; RV32ID-ILP32-NEXT: fcvt.w.s a0, fa5, rtz
8545 ; RV32ID-ILP32-NEXT: feq.s a1, fa5, fa5
8546 ; RV32ID-ILP32-NEXT: seqz a1, a1
8547 ; RV32ID-ILP32-NEXT: addi a1, a1, -1
8548 ; RV32ID-ILP32-NEXT: and a0, a1, a0
8549 ; RV32ID-ILP32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8550 ; RV32ID-ILP32-NEXT: addi sp, sp, 16
8551 ; RV32ID-ILP32-NEXT: ret
8553 ; RV64ID-LP64-LABEL: fcvt_w_h_sat_sext:
8554 ; RV64ID-LP64: # %bb.0: # %start
8555 ; RV64ID-LP64-NEXT: addi sp, sp, -16
8556 ; RV64ID-LP64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
8557 ; RV64ID-LP64-NEXT: call __extendhfsf2
8558 ; RV64ID-LP64-NEXT: fmv.w.x fa5, a0
8559 ; RV64ID-LP64-NEXT: fcvt.w.s a0, fa5, rtz
8560 ; RV64ID-LP64-NEXT: feq.s a1, fa5, fa5
8561 ; RV64ID-LP64-NEXT: seqz a1, a1
8562 ; RV64ID-LP64-NEXT: addi a1, a1, -1
8563 ; RV64ID-LP64-NEXT: and a0, a1, a0
8564 ; RV64ID-LP64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
8565 ; RV64ID-LP64-NEXT: addi sp, sp, 16
8566 ; RV64ID-LP64-NEXT: ret
8568 ; RV32ID-LABEL: fcvt_w_h_sat_sext:
8569 ; RV32ID: # %bb.0: # %start
8570 ; RV32ID-NEXT: addi sp, sp, -16
8571 ; RV32ID-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
8572 ; RV32ID-NEXT: call __extendhfsf2
8573 ; RV32ID-NEXT: fcvt.w.s a0, fa0, rtz
8574 ; RV32ID-NEXT: feq.s a1, fa0, fa0
8575 ; RV32ID-NEXT: seqz a1, a1
8576 ; RV32ID-NEXT: addi a1, a1, -1
8577 ; RV32ID-NEXT: and a0, a1, a0
8578 ; RV32ID-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
8579 ; RV32ID-NEXT: addi sp, sp, 16
8582 ; RV64ID-LABEL: fcvt_w_h_sat_sext:
8583 ; RV64ID: # %bb.0: # %start
8584 ; RV64ID-NEXT: addi sp, sp, -16
8585 ; RV64ID-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
8586 ; RV64ID-NEXT: call __extendhfsf2
8587 ; RV64ID-NEXT: fcvt.w.s a0, fa0, rtz
8588 ; RV64ID-NEXT: feq.s a1, fa0, fa0
8589 ; RV64ID-NEXT: seqz a1, a1
8590 ; RV64ID-NEXT: addi a1, a1, -1
8591 ; RV64ID-NEXT: and a0, a1, a0
8592 ; RV64ID-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
8593 ; RV64ID-NEXT: addi sp, sp, 16
8596 ; CHECK32-IZFHMIN-LABEL: fcvt_w_h_sat_sext:
8597 ; CHECK32-IZFHMIN: # %bb.0: # %start
8598 ; CHECK32-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
8599 ; CHECK32-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
8600 ; CHECK32-IZFHMIN-NEXT: feq.s a1, fa5, fa5
8601 ; CHECK32-IZFHMIN-NEXT: seqz a1, a1
8602 ; CHECK32-IZFHMIN-NEXT: addi a1, a1, -1
8603 ; CHECK32-IZFHMIN-NEXT: and a0, a1, a0
8604 ; CHECK32-IZFHMIN-NEXT: ret
8606 ; CHECK64-IZFHMIN-LABEL: fcvt_w_h_sat_sext:
8607 ; CHECK64-IZFHMIN: # %bb.0: # %start
8608 ; CHECK64-IZFHMIN-NEXT: fcvt.s.h fa5, fa0
8609 ; CHECK64-IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
8610 ; CHECK64-IZFHMIN-NEXT: feq.s a1, fa5, fa5
8611 ; CHECK64-IZFHMIN-NEXT: seqz a1, a1
8612 ; CHECK64-IZFHMIN-NEXT: addi a1, a1, -1
8613 ; CHECK64-IZFHMIN-NEXT: and a0, a1, a0
8614 ; CHECK64-IZFHMIN-NEXT: ret
8616 ; CHECK32-IZHINXMIN-LABEL: fcvt_w_h_sat_sext:
8617 ; CHECK32-IZHINXMIN: # %bb.0: # %start
8618 ; CHECK32-IZHINXMIN-NEXT: fcvt.s.h a0, a0
8619 ; CHECK32-IZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
8620 ; CHECK32-IZHINXMIN-NEXT: feq.s a0, a0, a0
8621 ; CHECK32-IZHINXMIN-NEXT: seqz a0, a0
8622 ; CHECK32-IZHINXMIN-NEXT: addi a0, a0, -1
8623 ; CHECK32-IZHINXMIN-NEXT: and a0, a0, a1
8624 ; CHECK32-IZHINXMIN-NEXT: ret
8626 ; CHECK64-IZHINXMIN-LABEL: fcvt_w_h_sat_sext:
8627 ; CHECK64-IZHINXMIN: # %bb.0: # %start
8628 ; CHECK64-IZHINXMIN-NEXT: fcvt.s.h a0, a0
8629 ; CHECK64-IZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
8630 ; CHECK64-IZHINXMIN-NEXT: feq.s a0, a0, a0
8631 ; CHECK64-IZHINXMIN-NEXT: seqz a0, a0
8632 ; CHECK64-IZHINXMIN-NEXT: addi a0, a0, -1
8633 ; CHECK64-IZHINXMIN-NEXT: and a0, a0, a1
8634 ; CHECK64-IZHINXMIN-NEXT: ret
8636 ; CHECK32-IZDINXZHINXMIN-LABEL: fcvt_w_h_sat_sext:
8637 ; CHECK32-IZDINXZHINXMIN: # %bb.0: # %start
8638 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
8639 ; CHECK32-IZDINXZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
8640 ; CHECK32-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
8641 ; CHECK32-IZDINXZHINXMIN-NEXT: seqz a0, a0
8642 ; CHECK32-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
8643 ; CHECK32-IZDINXZHINXMIN-NEXT: and a0, a0, a1
8644 ; CHECK32-IZDINXZHINXMIN-NEXT: ret
8646 ; CHECK64-IZDINXZHINXMIN-LABEL: fcvt_w_h_sat_sext:
8647 ; CHECK64-IZDINXZHINXMIN: # %bb.0: # %start
8648 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.s.h a0, a0
8649 ; CHECK64-IZDINXZHINXMIN-NEXT: fcvt.w.s a1, a0, rtz
8650 ; CHECK64-IZDINXZHINXMIN-NEXT: feq.s a0, a0, a0
8651 ; CHECK64-IZDINXZHINXMIN-NEXT: seqz a0, a0
8652 ; CHECK64-IZDINXZHINXMIN-NEXT: addi a0, a0, -1
8653 ; CHECK64-IZDINXZHINXMIN-NEXT: and a0, a0, a1
8654 ; CHECK64-IZDINXZHINXMIN-NEXT: ret
8656 %0 = tail call i32 @llvm.fptosi.sat.i32.f16(half %a)