1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -relocation-model=pic -mtriple=mipsel-- -mcpu=mips32r5 -mattr=+abs2008 \
3 ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -mips-jalr-reloc=false < %s | FileCheck %s \
4 ; RUN: --check-prefixes=MIPS32,MIPS32-O32
5 ; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r5 -mattr=+abs2008 \
6 ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n32 -mips-jalr-reloc=false < %s | FileCheck %s \
7 ; RUN: --check-prefixes=MIPS64-N32,MIPS64R5-N32
8 ; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r5 -mattr=+abs2008 \
9 ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n64 -mips-jalr-reloc=false < %s | FileCheck %s \
10 ; RUN: --check-prefixes=MIPS64-N64,MIPS64R5-N64
12 ; RUN: llc -relocation-model=pic -mtriple=mipsel-- -mcpu=mips32r6 \
13 ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -mips-jalr-reloc=false < %s | FileCheck %s \
14 ; RUN: --check-prefixes=MIPS32,MIPSR6-O32
15 ; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r6 \
16 ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n32 -mips-jalr-reloc=false < %s | FileCheck %s \
17 ; RUN: --check-prefixes=MIPS64-N32,MIPSR6-N32
18 ; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r6 \
19 ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n64 -mips-jalr-reloc=false < %s | FileCheck %s \
20 ; RUN: --check-prefixes=MIPS64-N64,MIPSR6-N64
23 ; Check the use of frame indexes in the msa pseudo f16 instructions.
25 @k = external global float
27 declare float @k2(ptr)
29 define void @f3(i16 %b) {
31 ; MIPS32: # %bb.0: # %entry
32 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
33 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
34 ; MIPS32-NEXT: addiu $sp, $sp, -32
35 ; MIPS32-NEXT: .cfi_def_cfa_offset 32
36 ; MIPS32-NEXT: sw $ra, 28($sp) # 4-byte Folded Spill
37 ; MIPS32-NEXT: sw $16, 24($sp) # 4-byte Folded Spill
38 ; MIPS32-NEXT: .cfi_offset 31, -4
39 ; MIPS32-NEXT: .cfi_offset 16, -8
40 ; MIPS32-NEXT: addu $16, $2, $25
41 ; MIPS32-NEXT: sh $4, 22($sp)
42 ; MIPS32-NEXT: addiu $4, $sp, 22
43 ; MIPS32-NEXT: lw $25, %call16(k2)($16)
44 ; MIPS32-NEXT: jalr $25
45 ; MIPS32-NEXT: move $gp, $16
46 ; MIPS32-NEXT: lw $1, %got(k)($16)
47 ; MIPS32-NEXT: swc1 $f0, 0($1)
48 ; MIPS32-NEXT: lw $16, 24($sp) # 4-byte Folded Reload
49 ; MIPS32-NEXT: lw $ra, 28($sp) # 4-byte Folded Reload
51 ; MIPS32-NEXT: addiu $sp, $sp, 32
53 ; MIPS64-N32-LABEL: f3:
54 ; MIPS64-N32: # %bb.0: # %entry
55 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
56 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
57 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
58 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
59 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
60 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
61 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(f3)))
62 ; MIPS64-N32-NEXT: addu $1, $1, $25
63 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(f3)))
64 ; MIPS64-N32-NEXT: sh $4, 14($sp)
65 ; MIPS64-N32-NEXT: lw $25, %call16(k2)($gp)
66 ; MIPS64-N32-NEXT: jalr $25
67 ; MIPS64-N32-NEXT: addiu $4, $sp, 14
68 ; MIPS64-N32-NEXT: lw $1, %got_disp(k)($gp)
69 ; MIPS64-N32-NEXT: swc1 $f0, 0($1)
70 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
71 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
72 ; MIPS64-N32-NEXT: jr $ra
73 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
75 ; MIPS64-N64-LABEL: f3:
76 ; MIPS64-N64: # %bb.0: # %entry
77 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
78 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
79 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
80 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
81 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
82 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
83 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(f3)))
84 ; MIPS64-N64-NEXT: daddu $1, $1, $25
85 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(f3)))
86 ; MIPS64-N64-NEXT: sh $4, 14($sp)
87 ; MIPS64-N64-NEXT: ld $25, %call16(k2)($gp)
88 ; MIPS64-N64-NEXT: jalr $25
89 ; MIPS64-N64-NEXT: daddiu $4, $sp, 14
90 ; MIPS64-N64-NEXT: ld $1, %got_disp(k)($gp)
91 ; MIPS64-N64-NEXT: swc1 $f0, 0($1)
92 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
93 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
94 ; MIPS64-N64-NEXT: jr $ra
95 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
98 %1 = bitcast i16 %b to half
100 %2 = call float @k2(ptr %0)
101 store float %2, ptr @k
105 define void @f(i16 %b) {
108 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
109 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
110 ; MIPS32-NEXT: addiu $sp, $sp, -8
111 ; MIPS32-NEXT: .cfi_def_cfa_offset 8
112 ; MIPS32-NEXT: addu $1, $2, $25
113 ; MIPS32-NEXT: sh $4, 4($sp)
114 ; MIPS32-NEXT: lh $2, 4($sp)
115 ; MIPS32-NEXT: fill.h $w0, $2
116 ; MIPS32-NEXT: fexupr.w $w0, $w0
117 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
118 ; MIPS32-NEXT: mtc1 $2, $f0
119 ; MIPS32-NEXT: lw $1, %got(k)($1)
120 ; MIPS32-NEXT: swc1 $f0, 0($1)
121 ; MIPS32-NEXT: jr $ra
122 ; MIPS32-NEXT: addiu $sp, $sp, 8
124 ; MIPS64-N32-LABEL: f:
125 ; MIPS64-N32: # %bb.0:
126 ; MIPS64-N32-NEXT: addiu $sp, $sp, -16
127 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 16
128 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(f)))
129 ; MIPS64-N32-NEXT: addu $1, $1, $25
130 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(f)))
131 ; MIPS64-N32-NEXT: sh $4, 12($sp)
132 ; MIPS64-N32-NEXT: lh $2, 12($sp)
133 ; MIPS64-N32-NEXT: fill.h $w0, $2
134 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
135 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
136 ; MIPS64-N32-NEXT: mtc1 $2, $f0
137 ; MIPS64-N32-NEXT: lw $1, %got_disp(k)($1)
138 ; MIPS64-N32-NEXT: swc1 $f0, 0($1)
139 ; MIPS64-N32-NEXT: jr $ra
140 ; MIPS64-N32-NEXT: addiu $sp, $sp, 16
142 ; MIPS64-N64-LABEL: f:
143 ; MIPS64-N64: # %bb.0:
144 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -16
145 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 16
146 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(f)))
147 ; MIPS64-N64-NEXT: daddu $1, $1, $25
148 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(f)))
149 ; MIPS64-N64-NEXT: sh $4, 12($sp)
150 ; MIPS64-N64-NEXT: lh $2, 12($sp)
151 ; MIPS64-N64-NEXT: fill.h $w0, $2
152 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
153 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
154 ; MIPS64-N64-NEXT: mtc1 $2, $f0
155 ; MIPS64-N64-NEXT: ld $1, %got_disp(k)($1)
156 ; MIPS64-N64-NEXT: swc1 $f0, 0($1)
157 ; MIPS64-N64-NEXT: jr $ra
158 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 16
159 %1 = bitcast i16 %b to half
160 %2 = fpext half %1 to float
161 store float %2, ptr @k
165 @g = external global i16, align 2
166 @h = external global half, align 2
168 ; Check that fext f16 to double has a fexupr.w, fexupr.d sequence.
169 ; Check that ftrunc double to f16 has fexdo.w, fexdo.h sequence.
170 ; Check that MIPS64R5+ uses 64-bit floating point <-> 64-bit GPR transfers.
172 ; We don't need to check if pre-MIPSR5 expansions occur, the MSA ASE requires
173 ; MIPSR5. Additionally, fp64 mode / FR=1 is required to use MSA.
175 define void @fadd_f64() {
176 ; MIPS32-LABEL: fadd_f64:
177 ; MIPS32: # %bb.0: # %entry
178 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
179 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
180 ; MIPS32-NEXT: addu $1, $2, $25
181 ; MIPS32-NEXT: lw $1, %got(h)($1)
182 ; MIPS32-NEXT: lh $2, 0($1)
183 ; MIPS32-NEXT: fill.h $w0, $2
184 ; MIPS32-NEXT: fexupr.w $w0, $w0
185 ; MIPS32-NEXT: fexupr.d $w0, $w0
186 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
187 ; MIPS32-NEXT: mtc1 $2, $f1
188 ; MIPS32-NEXT: copy_s.w $2, $w0[1]
189 ; MIPS32-NEXT: mthc1 $2, $f1
190 ; MIPS32-NEXT: add.d $f0, $f1, $f1
191 ; MIPS32-NEXT: mfc1 $2, $f0
192 ; MIPS32-NEXT: fill.w $w1, $2
193 ; MIPS32-NEXT: mfhc1 $2, $f0
194 ; MIPS32-NEXT: insert.w $w1[1], $2
195 ; MIPS32-NEXT: insert.w $w1[3], $2
196 ; MIPS32-NEXT: fexdo.w $w0, $w1, $w1
197 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
198 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
199 ; MIPS32-NEXT: jr $ra
200 ; MIPS32-NEXT: sh $2, 0($1)
202 ; MIPS64-N32-LABEL: fadd_f64:
203 ; MIPS64-N32: # %bb.0: # %entry
204 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fadd_f64)))
205 ; MIPS64-N32-NEXT: addu $1, $1, $25
206 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fadd_f64)))
207 ; MIPS64-N32-NEXT: lw $1, %got_disp(h)($1)
208 ; MIPS64-N32-NEXT: lh $2, 0($1)
209 ; MIPS64-N32-NEXT: fill.h $w0, $2
210 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
211 ; MIPS64-N32-NEXT: fexupr.d $w0, $w0
212 ; MIPS64-N32-NEXT: copy_s.d $2, $w0[0]
213 ; MIPS64-N32-NEXT: dmtc1 $2, $f0
214 ; MIPS64-N32-NEXT: add.d $f0, $f0, $f0
215 ; MIPS64-N32-NEXT: dmfc1 $2, $f0
216 ; MIPS64-N32-NEXT: fill.d $w0, $2
217 ; MIPS64-N32-NEXT: fexdo.w $w0, $w0, $w0
218 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
219 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
220 ; MIPS64-N32-NEXT: jr $ra
221 ; MIPS64-N32-NEXT: sh $2, 0($1)
223 ; MIPS64-N64-LABEL: fadd_f64:
224 ; MIPS64-N64: # %bb.0: # %entry
225 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fadd_f64)))
226 ; MIPS64-N64-NEXT: daddu $1, $1, $25
227 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fadd_f64)))
228 ; MIPS64-N64-NEXT: ld $1, %got_disp(h)($1)
229 ; MIPS64-N64-NEXT: lh $2, 0($1)
230 ; MIPS64-N64-NEXT: fill.h $w0, $2
231 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
232 ; MIPS64-N64-NEXT: fexupr.d $w0, $w0
233 ; MIPS64-N64-NEXT: copy_s.d $2, $w0[0]
234 ; MIPS64-N64-NEXT: dmtc1 $2, $f0
235 ; MIPS64-N64-NEXT: add.d $f0, $f0, $f0
236 ; MIPS64-N64-NEXT: dmfc1 $2, $f0
237 ; MIPS64-N64-NEXT: fill.d $w0, $2
238 ; MIPS64-N64-NEXT: fexdo.w $w0, $w0, $w0
239 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
240 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
241 ; MIPS64-N64-NEXT: jr $ra
242 ; MIPS64-N64-NEXT: sh $2, 0($1)
244 %0 = load half, ptr @h, align 2
245 %1 = fpext half %0 to double
246 %2 = load half, ptr @h, align 2
247 %3 = fpext half %2 to double
248 %add = fadd double %1, %3
249 %4 = fptrunc double %add to half
250 store half %4, ptr @h, align 2
254 ; Entire fp16 (unsigned) range fits into (signed) i32.
255 define i32 @ffptoui() {
256 ; MIPS32-LABEL: ffptoui:
257 ; MIPS32: # %bb.0: # %entry
258 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
259 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
260 ; MIPS32-NEXT: addu $1, $2, $25
261 ; MIPS32-NEXT: lw $1, %got(h)($1)
262 ; MIPS32-NEXT: lh $1, 0($1)
263 ; MIPS32-NEXT: fill.h $w0, $1
264 ; MIPS32-NEXT: fexupr.w $w0, $w0
265 ; MIPS32-NEXT: fexupr.d $w0, $w0
266 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
267 ; MIPS32-NEXT: mtc1 $1, $f1
268 ; MIPS32-NEXT: copy_s.w $1, $w0[1]
269 ; MIPS32-NEXT: mthc1 $1, $f1
270 ; MIPS32-NEXT: trunc.w.d $f0, $f1
271 ; MIPS32-NEXT: jr $ra
272 ; MIPS32-NEXT: mfc1 $2, $f0
274 ; MIPS64-N32-LABEL: ffptoui:
275 ; MIPS64-N32: # %bb.0: # %entry
276 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffptoui)))
277 ; MIPS64-N32-NEXT: addu $1, $1, $25
278 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(ffptoui)))
279 ; MIPS64-N32-NEXT: lw $1, %got_disp(h)($1)
280 ; MIPS64-N32-NEXT: lh $1, 0($1)
281 ; MIPS64-N32-NEXT: fill.h $w0, $1
282 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
283 ; MIPS64-N32-NEXT: fexupr.d $w0, $w0
284 ; MIPS64-N32-NEXT: copy_s.d $1, $w0[0]
285 ; MIPS64-N32-NEXT: dmtc1 $1, $f0
286 ; MIPS64-N32-NEXT: trunc.w.d $f0, $f0
287 ; MIPS64-N32-NEXT: jr $ra
288 ; MIPS64-N32-NEXT: mfc1 $2, $f0
290 ; MIPS64-N64-LABEL: ffptoui:
291 ; MIPS64-N64: # %bb.0: # %entry
292 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffptoui)))
293 ; MIPS64-N64-NEXT: daddu $1, $1, $25
294 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(ffptoui)))
295 ; MIPS64-N64-NEXT: ld $1, %got_disp(h)($1)
296 ; MIPS64-N64-NEXT: lh $1, 0($1)
297 ; MIPS64-N64-NEXT: fill.h $w0, $1
298 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
299 ; MIPS64-N64-NEXT: fexupr.d $w0, $w0
300 ; MIPS64-N64-NEXT: copy_s.d $1, $w0[0]
301 ; MIPS64-N64-NEXT: dmtc1 $1, $f0
302 ; MIPS64-N64-NEXT: trunc.w.d $f0, $f0
303 ; MIPS64-N64-NEXT: jr $ra
304 ; MIPS64-N64-NEXT: mfc1 $2, $f0
306 %0 = load half, ptr @h, align 2
307 %1 = fptoui half %0 to i32
311 define i32 @ffptosi() {
312 ; MIPS32-LABEL: ffptosi:
313 ; MIPS32: # %bb.0: # %entry
314 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
315 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
316 ; MIPS32-NEXT: addu $1, $2, $25
317 ; MIPS32-NEXT: lw $1, %got(h)($1)
318 ; MIPS32-NEXT: lh $1, 0($1)
319 ; MIPS32-NEXT: fill.h $w0, $1
320 ; MIPS32-NEXT: fexupr.w $w0, $w0
321 ; MIPS32-NEXT: fexupr.d $w0, $w0
322 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
323 ; MIPS32-NEXT: mtc1 $1, $f1
324 ; MIPS32-NEXT: copy_s.w $1, $w0[1]
325 ; MIPS32-NEXT: mthc1 $1, $f1
326 ; MIPS32-NEXT: trunc.w.d $f0, $f1
327 ; MIPS32-NEXT: jr $ra
328 ; MIPS32-NEXT: mfc1 $2, $f0
330 ; MIPS64-N32-LABEL: ffptosi:
331 ; MIPS64-N32: # %bb.0: # %entry
332 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffptosi)))
333 ; MIPS64-N32-NEXT: addu $1, $1, $25
334 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(ffptosi)))
335 ; MIPS64-N32-NEXT: lw $1, %got_disp(h)($1)
336 ; MIPS64-N32-NEXT: lh $1, 0($1)
337 ; MIPS64-N32-NEXT: fill.h $w0, $1
338 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
339 ; MIPS64-N32-NEXT: fexupr.d $w0, $w0
340 ; MIPS64-N32-NEXT: copy_s.d $1, $w0[0]
341 ; MIPS64-N32-NEXT: dmtc1 $1, $f0
342 ; MIPS64-N32-NEXT: trunc.w.d $f0, $f0
343 ; MIPS64-N32-NEXT: jr $ra
344 ; MIPS64-N32-NEXT: mfc1 $2, $f0
346 ; MIPS64-N64-LABEL: ffptosi:
347 ; MIPS64-N64: # %bb.0: # %entry
348 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffptosi)))
349 ; MIPS64-N64-NEXT: daddu $1, $1, $25
350 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(ffptosi)))
351 ; MIPS64-N64-NEXT: ld $1, %got_disp(h)($1)
352 ; MIPS64-N64-NEXT: lh $1, 0($1)
353 ; MIPS64-N64-NEXT: fill.h $w0, $1
354 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
355 ; MIPS64-N64-NEXT: fexupr.d $w0, $w0
356 ; MIPS64-N64-NEXT: copy_s.d $1, $w0[0]
357 ; MIPS64-N64-NEXT: dmtc1 $1, $f0
358 ; MIPS64-N64-NEXT: trunc.w.d $f0, $f0
359 ; MIPS64-N64-NEXT: jr $ra
360 ; MIPS64-N64-NEXT: mfc1 $2, $f0
362 %0 = load half, ptr @h, align 2
363 %1 = fptosi half %0 to i32
371 define void @uitofp(i32 %a) {
372 ; MIPS32-LABEL: uitofp:
373 ; MIPS32: # %bb.0: # %entry
374 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
375 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
376 ; MIPS32-NEXT: addiu $sp, $sp, -8
377 ; MIPS32-NEXT: .cfi_def_cfa_offset 8
378 ; MIPS32-NEXT: addu $1, $2, $25
379 ; MIPS32-NEXT: lui $2, 17200
380 ; MIPS32-NEXT: sw $2, 4($sp)
381 ; MIPS32-NEXT: sw $4, 0($sp)
382 ; MIPS32-NEXT: lw $2, %got($CPI5_0)($1)
383 ; MIPS32-NEXT: ldc1 $f0, %lo($CPI5_0)($2)
384 ; MIPS32-NEXT: ldc1 $f1, 0($sp)
385 ; MIPS32-NEXT: sub.d $f0, $f1, $f0
386 ; MIPS32-NEXT: mfc1 $2, $f0
387 ; MIPS32-NEXT: fill.w $w1, $2
388 ; MIPS32-NEXT: mfhc1 $2, $f0
389 ; MIPS32-NEXT: insert.w $w1[1], $2
390 ; MIPS32-NEXT: insert.w $w1[3], $2
391 ; MIPS32-NEXT: fexdo.w $w0, $w1, $w1
392 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
393 ; MIPS32-NEXT: lw $1, %got(h)($1)
394 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
395 ; MIPS32-NEXT: sh $2, 0($1)
396 ; MIPS32-NEXT: jr $ra
397 ; MIPS32-NEXT: addiu $sp, $sp, 8
399 ; MIPS64-N32-LABEL: uitofp:
400 ; MIPS64-N32: # %bb.0: # %entry
401 ; MIPS64-N32-NEXT: addiu $sp, $sp, -16
402 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 16
403 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(uitofp)))
404 ; MIPS64-N32-NEXT: addu $1, $1, $25
405 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(uitofp)))
406 ; MIPS64-N32-NEXT: lui $2, 17200
407 ; MIPS64-N32-NEXT: sw $2, 12($sp)
408 ; MIPS64R5-N32-NEXT: sll $2, $4, 0
409 ; MIPS64R5-N32-NEXT: sw $2, 8($sp)
410 ; MIPSR6-N32-NEXT: sw $4, 8($sp)
411 ; MIPS64-N32-NEXT: lw $2, %got_page(.LCPI5_0)($1)
412 ; MIPS64-N32-NEXT: ldc1 $f0, %got_ofst(.LCPI5_0)($2)
413 ; MIPS64-N32-NEXT: ldc1 $f1, 8($sp)
414 ; MIPS64-N32-NEXT: sub.d $f0, $f1, $f0
415 ; MIPS64-N32-NEXT: dmfc1 $2, $f0
416 ; MIPS64-N32-NEXT: fill.d $w0, $2
417 ; MIPS64-N32-NEXT: fexdo.w $w0, $w0, $w0
418 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
419 ; MIPS64-N32-NEXT: lw $1, %got_disp(h)($1)
420 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
421 ; MIPS64-N32-NEXT: sh $2, 0($1)
422 ; MIPS64-N32-NEXT: jr $ra
423 ; MIPS64-N32-NEXT: addiu $sp, $sp, 16
425 ; MIPS64-N64-LABEL: uitofp:
426 ; MIPS64-N64: # %bb.0: # %entry
427 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -16
428 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 16
429 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(uitofp)))
430 ; MIPS64-N64-NEXT: daddu $1, $1, $25
431 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(uitofp)))
432 ; MIPS64-N64-NEXT: lui $2, 17200
433 ; MIPS64-N64-NEXT: sw $2, 12($sp)
434 ; MIPS64R5-N64-NEXT: sll $2, $4, 0
435 ; MIPS64R5-N64-NEXT: sw $2, 8($sp)
436 ; MIPSR6-N64-NEXT: sw $4, 8($sp)
437 ; MIPS64-N64-NEXT: ld $2, %got_page(.LCPI5_0)($1)
438 ; MIPS64-N64-NEXT: ldc1 $f0, %got_ofst(.LCPI5_0)($2)
439 ; MIPS64-N64-NEXT: ldc1 $f1, 8($sp)
440 ; MIPS64-N64-NEXT: sub.d $f0, $f1, $f0
441 ; MIPS64-N64-NEXT: dmfc1 $2, $f0
442 ; MIPS64-N64-NEXT: fill.d $w0, $2
443 ; MIPS64-N64-NEXT: fexdo.w $w0, $w0, $w0
444 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
445 ; MIPS64-N64-NEXT: ld $1, %got_disp(h)($1)
446 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
447 ; MIPS64-N64-NEXT: sh $2, 0($1)
448 ; MIPS64-N64-NEXT: jr $ra
449 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 16
460 %0 = uitofp i32 %a to half
461 store half %0, ptr @h, align 2
466 ; Check that f16 is expanded to f32 and relevant transfer ops occur.
467 ; We don't check f16 -> f64 expansion occurs, as we expand f16 to f32.
469 define void @fadd() {
470 ; MIPS32-LABEL: fadd:
471 ; MIPS32: # %bb.0: # %entry
472 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
473 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
474 ; MIPS32-NEXT: addu $1, $2, $25
475 ; MIPS32-NEXT: lw $1, %got(g)($1)
476 ; MIPS32-NEXT: lh $2, 0($1)
477 ; MIPS32-NEXT: fill.h $w0, $2
478 ; MIPS32-NEXT: fexupr.w $w0, $w0
479 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
480 ; MIPS32-NEXT: mtc1 $2, $f0
481 ; MIPS32-NEXT: add.s $f0, $f0, $f0
482 ; MIPS32-NEXT: mfc1 $2, $f0
483 ; MIPS32-NEXT: fill.w $w0, $2
484 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
485 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
486 ; MIPS32-NEXT: jr $ra
487 ; MIPS32-NEXT: sh $2, 0($1)
489 ; MIPS64-N32-LABEL: fadd:
490 ; MIPS64-N32: # %bb.0: # %entry
491 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fadd)))
492 ; MIPS64-N32-NEXT: addu $1, $1, $25
493 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fadd)))
494 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
495 ; MIPS64-N32-NEXT: lh $2, 0($1)
496 ; MIPS64-N32-NEXT: fill.h $w0, $2
497 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
498 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
499 ; MIPS64-N32-NEXT: mtc1 $2, $f0
500 ; MIPS64-N32-NEXT: add.s $f0, $f0, $f0
501 ; MIPS64-N32-NEXT: mfc1 $2, $f0
502 ; MIPS64-N32-NEXT: fill.w $w0, $2
503 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
504 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
505 ; MIPS64-N32-NEXT: jr $ra
506 ; MIPS64-N32-NEXT: sh $2, 0($1)
508 ; MIPS64-N64-LABEL: fadd:
509 ; MIPS64-N64: # %bb.0: # %entry
510 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fadd)))
511 ; MIPS64-N64-NEXT: daddu $1, $1, $25
512 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fadd)))
513 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
514 ; MIPS64-N64-NEXT: lh $2, 0($1)
515 ; MIPS64-N64-NEXT: fill.h $w0, $2
516 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
517 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
518 ; MIPS64-N64-NEXT: mtc1 $2, $f0
519 ; MIPS64-N64-NEXT: add.s $f0, $f0, $f0
520 ; MIPS64-N64-NEXT: mfc1 $2, $f0
521 ; MIPS64-N64-NEXT: fill.w $w0, $2
522 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
523 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
524 ; MIPS64-N64-NEXT: jr $ra
525 ; MIPS64-N64-NEXT: sh $2, 0($1)
527 %0 = load i16, ptr @g, align 2
528 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
531 %2 = load i16, ptr @g, align 2
532 %3 = call float @llvm.convert.from.fp16.f32(i16 %2)
533 %add = fadd float %1, %3
536 %4 = call i16 @llvm.convert.to.fp16.f32(float %add)
538 store i16 %4, ptr @g, align 2
542 ; Function Attrs: nounwind readnone
543 declare float @llvm.convert.from.fp16.f32(i16)
545 ; Function Attrs: nounwind readnone
546 declare i16 @llvm.convert.to.fp16.f32(float)
548 ; Function Attrs: nounwind
549 define void @fsub() {
550 ; MIPS32-LABEL: fsub:
551 ; MIPS32: # %bb.0: # %entry
552 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
553 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
554 ; MIPS32-NEXT: addu $1, $2, $25
555 ; MIPS32-NEXT: lw $1, %got(g)($1)
556 ; MIPS32-NEXT: lh $2, 0($1)
557 ; MIPS32-NEXT: fill.h $w0, $2
558 ; MIPS32-NEXT: fexupr.w $w0, $w0
559 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
560 ; MIPS32-NEXT: mtc1 $2, $f0
561 ; MIPS32-NEXT: sub.s $f0, $f0, $f0
562 ; MIPS32-NEXT: mfc1 $2, $f0
563 ; MIPS32-NEXT: fill.w $w0, $2
564 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
565 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
566 ; MIPS32-NEXT: jr $ra
567 ; MIPS32-NEXT: sh $2, 0($1)
569 ; MIPS64-N32-LABEL: fsub:
570 ; MIPS64-N32: # %bb.0: # %entry
571 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fsub)))
572 ; MIPS64-N32-NEXT: addu $1, $1, $25
573 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fsub)))
574 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
575 ; MIPS64-N32-NEXT: lh $2, 0($1)
576 ; MIPS64-N32-NEXT: fill.h $w0, $2
577 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
578 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
579 ; MIPS64-N32-NEXT: mtc1 $2, $f0
580 ; MIPS64-N32-NEXT: sub.s $f0, $f0, $f0
581 ; MIPS64-N32-NEXT: mfc1 $2, $f0
582 ; MIPS64-N32-NEXT: fill.w $w0, $2
583 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
584 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
585 ; MIPS64-N32-NEXT: jr $ra
586 ; MIPS64-N32-NEXT: sh $2, 0($1)
588 ; MIPS64-N64-LABEL: fsub:
589 ; MIPS64-N64: # %bb.0: # %entry
590 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fsub)))
591 ; MIPS64-N64-NEXT: daddu $1, $1, $25
592 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fsub)))
593 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
594 ; MIPS64-N64-NEXT: lh $2, 0($1)
595 ; MIPS64-N64-NEXT: fill.h $w0, $2
596 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
597 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
598 ; MIPS64-N64-NEXT: mtc1 $2, $f0
599 ; MIPS64-N64-NEXT: sub.s $f0, $f0, $f0
600 ; MIPS64-N64-NEXT: mfc1 $2, $f0
601 ; MIPS64-N64-NEXT: fill.w $w0, $2
602 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
603 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
604 ; MIPS64-N64-NEXT: jr $ra
605 ; MIPS64-N64-NEXT: sh $2, 0($1)
607 %0 = load i16, ptr @g, align 2
608 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
611 %2 = load i16, ptr @g, align 2
612 %3 = call float @llvm.convert.from.fp16.f32(i16 %2)
613 %sub = fsub float %1, %3
616 %4 = call i16 @llvm.convert.to.fp16.f32(float %sub)
619 store i16 %4, ptr @g, align 2
623 define void @fmult() {
624 ; MIPS32-LABEL: fmult:
625 ; MIPS32: # %bb.0: # %entry
626 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
627 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
628 ; MIPS32-NEXT: addu $1, $2, $25
629 ; MIPS32-NEXT: lw $1, %got(g)($1)
630 ; MIPS32-NEXT: lh $2, 0($1)
631 ; MIPS32-NEXT: fill.h $w0, $2
632 ; MIPS32-NEXT: fexupr.w $w0, $w0
633 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
634 ; MIPS32-NEXT: mtc1 $2, $f0
635 ; MIPS32-NEXT: mul.s $f0, $f0, $f0
636 ; MIPS32-NEXT: mfc1 $2, $f0
637 ; MIPS32-NEXT: fill.w $w0, $2
638 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
639 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
640 ; MIPS32-NEXT: jr $ra
641 ; MIPS32-NEXT: sh $2, 0($1)
643 ; MIPS64-N32-LABEL: fmult:
644 ; MIPS64-N32: # %bb.0: # %entry
645 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fmult)))
646 ; MIPS64-N32-NEXT: addu $1, $1, $25
647 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fmult)))
648 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
649 ; MIPS64-N32-NEXT: lh $2, 0($1)
650 ; MIPS64-N32-NEXT: fill.h $w0, $2
651 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
652 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
653 ; MIPS64-N32-NEXT: mtc1 $2, $f0
654 ; MIPS64-N32-NEXT: mul.s $f0, $f0, $f0
655 ; MIPS64-N32-NEXT: mfc1 $2, $f0
656 ; MIPS64-N32-NEXT: fill.w $w0, $2
657 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
658 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
659 ; MIPS64-N32-NEXT: jr $ra
660 ; MIPS64-N32-NEXT: sh $2, 0($1)
662 ; MIPS64-N64-LABEL: fmult:
663 ; MIPS64-N64: # %bb.0: # %entry
664 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fmult)))
665 ; MIPS64-N64-NEXT: daddu $1, $1, $25
666 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fmult)))
667 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
668 ; MIPS64-N64-NEXT: lh $2, 0($1)
669 ; MIPS64-N64-NEXT: fill.h $w0, $2
670 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
671 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
672 ; MIPS64-N64-NEXT: mtc1 $2, $f0
673 ; MIPS64-N64-NEXT: mul.s $f0, $f0, $f0
674 ; MIPS64-N64-NEXT: mfc1 $2, $f0
675 ; MIPS64-N64-NEXT: fill.w $w0, $2
676 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
677 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
678 ; MIPS64-N64-NEXT: jr $ra
679 ; MIPS64-N64-NEXT: sh $2, 0($1)
681 %0 = load i16, ptr @g, align 2
682 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
685 %2 = load i16, ptr @g, align 2
686 %3 = call float @llvm.convert.from.fp16.f32(i16 %2)
687 %mul = fmul float %1, %3
690 %4 = call i16 @llvm.convert.to.fp16.f32(float %mul)
693 store i16 %4, ptr @g, align 2
698 define void @fdiv() {
699 ; MIPS32-LABEL: fdiv:
700 ; MIPS32: # %bb.0: # %entry
701 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
702 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
703 ; MIPS32-NEXT: addu $1, $2, $25
704 ; MIPS32-NEXT: lw $1, %got(g)($1)
705 ; MIPS32-NEXT: lh $2, 0($1)
706 ; MIPS32-NEXT: fill.h $w0, $2
707 ; MIPS32-NEXT: fexupr.w $w0, $w0
708 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
709 ; MIPS32-NEXT: mtc1 $2, $f0
710 ; MIPS32-NEXT: div.s $f0, $f0, $f0
711 ; MIPS32-NEXT: mfc1 $2, $f0
712 ; MIPS32-NEXT: fill.w $w0, $2
713 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
714 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
715 ; MIPS32-NEXT: jr $ra
716 ; MIPS32-NEXT: sh $2, 0($1)
718 ; MIPS64-N32-LABEL: fdiv:
719 ; MIPS64-N32: # %bb.0: # %entry
720 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fdiv)))
721 ; MIPS64-N32-NEXT: addu $1, $1, $25
722 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fdiv)))
723 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
724 ; MIPS64-N32-NEXT: lh $2, 0($1)
725 ; MIPS64-N32-NEXT: fill.h $w0, $2
726 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
727 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
728 ; MIPS64-N32-NEXT: mtc1 $2, $f0
729 ; MIPS64-N32-NEXT: div.s $f0, $f0, $f0
730 ; MIPS64-N32-NEXT: mfc1 $2, $f0
731 ; MIPS64-N32-NEXT: fill.w $w0, $2
732 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
733 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
734 ; MIPS64-N32-NEXT: jr $ra
735 ; MIPS64-N32-NEXT: sh $2, 0($1)
737 ; MIPS64-N64-LABEL: fdiv:
738 ; MIPS64-N64: # %bb.0: # %entry
739 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fdiv)))
740 ; MIPS64-N64-NEXT: daddu $1, $1, $25
741 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fdiv)))
742 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
743 ; MIPS64-N64-NEXT: lh $2, 0($1)
744 ; MIPS64-N64-NEXT: fill.h $w0, $2
745 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
746 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
747 ; MIPS64-N64-NEXT: mtc1 $2, $f0
748 ; MIPS64-N64-NEXT: div.s $f0, $f0, $f0
749 ; MIPS64-N64-NEXT: mfc1 $2, $f0
750 ; MIPS64-N64-NEXT: fill.w $w0, $2
751 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
752 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
753 ; MIPS64-N64-NEXT: jr $ra
754 ; MIPS64-N64-NEXT: sh $2, 0($1)
757 %0 = load i16, ptr @g, align 2
758 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
761 %2 = load i16, ptr @g, align 2
762 %3 = call float @llvm.convert.from.fp16.f32(i16 %2)
763 %div = fdiv float %1, %3
766 %4 = call i16 @llvm.convert.to.fp16.f32(float %div)
768 store i16 %4, ptr @g, align 2
772 define void @frem() {
773 ; MIPS32-LABEL: frem:
774 ; MIPS32: # %bb.0: # %entry
775 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
776 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
777 ; MIPS32-NEXT: addiu $sp, $sp, -24
778 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
779 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
780 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
781 ; MIPS32-NEXT: .cfi_offset 31, -4
782 ; MIPS32-NEXT: .cfi_offset 16, -8
783 ; MIPS32-NEXT: addu $gp, $2, $25
784 ; MIPS32-NEXT: lw $16, %got(g)($gp)
785 ; MIPS32-NEXT: lh $1, 0($16)
786 ; MIPS32-NEXT: fill.h $w0, $1
787 ; MIPS32-NEXT: fexupr.w $w0, $w0
788 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
789 ; MIPS32-NEXT: mtc1 $1, $f12
790 ; MIPS32-NEXT: lw $25, %call16(fmodf)($gp)
791 ; MIPS32-NEXT: jalr $25
792 ; MIPS32-NEXT: mov.s $f14, $f12
793 ; MIPS32-NEXT: mfc1 $1, $f0
794 ; MIPS32-NEXT: fill.w $w0, $1
795 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
796 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
797 ; MIPS32-NEXT: sh $1, 0($16)
798 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
799 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
800 ; MIPS32-NEXT: jr $ra
801 ; MIPS32-NEXT: addiu $sp, $sp, 24
803 ; MIPS64-N32-LABEL: frem:
804 ; MIPS64-N32: # %bb.0: # %entry
805 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
806 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
807 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
808 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
809 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
810 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
811 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
812 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
813 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(frem)))
814 ; MIPS64-N32-NEXT: addu $1, $1, $25
815 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(frem)))
816 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
817 ; MIPS64-N32-NEXT: lh $1, 0($16)
818 ; MIPS64-N32-NEXT: fill.h $w0, $1
819 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
820 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
821 ; MIPS64-N32-NEXT: mtc1 $1, $f12
822 ; MIPS64-N32-NEXT: lw $25, %call16(fmodf)($gp)
823 ; MIPS64-N32-NEXT: jalr $25
824 ; MIPS64-N32-NEXT: mov.s $f13, $f12
825 ; MIPS64-N32-NEXT: mfc1 $1, $f0
826 ; MIPS64-N32-NEXT: fill.w $w0, $1
827 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
828 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
829 ; MIPS64-N32-NEXT: sh $1, 0($16)
830 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
831 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
832 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
833 ; MIPS64-N32-NEXT: jr $ra
834 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
836 ; MIPS64-N64-LABEL: frem:
837 ; MIPS64-N64: # %bb.0: # %entry
838 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
839 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
840 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
841 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
842 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
843 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
844 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
845 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
846 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(frem)))
847 ; MIPS64-N64-NEXT: daddu $1, $1, $25
848 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(frem)))
849 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
850 ; MIPS64-N64-NEXT: lh $1, 0($16)
851 ; MIPS64-N64-NEXT: fill.h $w0, $1
852 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
853 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
854 ; MIPS64-N64-NEXT: mtc1 $1, $f12
855 ; MIPS64-N64-NEXT: ld $25, %call16(fmodf)($gp)
856 ; MIPS64-N64-NEXT: jalr $25
857 ; MIPS64-N64-NEXT: mov.s $f13, $f12
858 ; MIPS64-N64-NEXT: mfc1 $1, $f0
859 ; MIPS64-N64-NEXT: fill.w $w0, $1
860 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
861 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
862 ; MIPS64-N64-NEXT: sh $1, 0($16)
863 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
864 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
865 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
866 ; MIPS64-N64-NEXT: jr $ra
867 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
869 %0 = load i16, ptr @g, align 2
870 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
873 %2 = load i16, ptr @g, align 2
874 %3 = call float @llvm.convert.from.fp16.f32(i16 %2)
875 %rem = frem float %1, %3
878 %4 = call i16 @llvm.convert.to.fp16.f32(float %rem)
881 store i16 %4, ptr @g, align 2
886 @i1 = external global i16, align 1
888 define void @fcmp() {
889 ; MIPS32-O32-LABEL: fcmp:
890 ; MIPS32-O32: # %bb.0: # %entry
891 ; MIPS32-O32-NEXT: lui $2, %hi(_gp_disp)
892 ; MIPS32-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
893 ; MIPS32-O32-NEXT: addu $1, $2, $25
894 ; MIPS32-O32-NEXT: lw $2, %got(g)($1)
895 ; MIPS32-O32-NEXT: lh $2, 0($2)
896 ; MIPS32-O32-NEXT: fill.h $w0, $2
897 ; MIPS32-O32-NEXT: fexupr.w $w0, $w0
898 ; MIPS32-O32-NEXT: copy_s.w $2, $w0[0]
899 ; MIPS32-O32-NEXT: mtc1 $2, $f0
900 ; MIPS32-O32-NEXT: addiu $2, $zero, 1
901 ; MIPS32-O32-NEXT: c.un.s $f0, $f0
902 ; MIPS32-O32-NEXT: movt $2, $zero, $fcc0
903 ; MIPS32-O32-NEXT: lw $1, %got(i1)($1)
904 ; MIPS32-O32-NEXT: jr $ra
905 ; MIPS32-O32-NEXT: sh $2, 0($1)
907 ; MIPS64R5-N32-LABEL: fcmp:
908 ; MIPS64R5-N32: # %bb.0: # %entry
909 ; MIPS64R5-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fcmp)))
910 ; MIPS64R5-N32-NEXT: addu $1, $1, $25
911 ; MIPS64R5-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fcmp)))
912 ; MIPS64R5-N32-NEXT: lw $2, %got_disp(g)($1)
913 ; MIPS64R5-N32-NEXT: lh $2, 0($2)
914 ; MIPS64R5-N32-NEXT: fill.h $w0, $2
915 ; MIPS64R5-N32-NEXT: fexupr.w $w0, $w0
916 ; MIPS64R5-N32-NEXT: copy_s.w $2, $w0[0]
917 ; MIPS64R5-N32-NEXT: mtc1 $2, $f0
918 ; MIPS64R5-N32-NEXT: addiu $2, $zero, 1
919 ; MIPS64R5-N32-NEXT: c.un.s $f0, $f0
920 ; MIPS64R5-N32-NEXT: movt $2, $zero, $fcc0
921 ; MIPS64R5-N32-NEXT: lw $1, %got_disp(i1)($1)
922 ; MIPS64R5-N32-NEXT: jr $ra
923 ; MIPS64R5-N32-NEXT: sh $2, 0($1)
925 ; MIPS64R5-N64-LABEL: fcmp:
926 ; MIPS64R5-N64: # %bb.0: # %entry
927 ; MIPS64R5-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fcmp)))
928 ; MIPS64R5-N64-NEXT: daddu $1, $1, $25
929 ; MIPS64R5-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fcmp)))
930 ; MIPS64R5-N64-NEXT: ld $2, %got_disp(g)($1)
931 ; MIPS64R5-N64-NEXT: lh $2, 0($2)
932 ; MIPS64R5-N64-NEXT: fill.h $w0, $2
933 ; MIPS64R5-N64-NEXT: fexupr.w $w0, $w0
934 ; MIPS64R5-N64-NEXT: copy_s.w $2, $w0[0]
935 ; MIPS64R5-N64-NEXT: mtc1 $2, $f0
936 ; MIPS64R5-N64-NEXT: addiu $2, $zero, 1
937 ; MIPS64R5-N64-NEXT: c.un.s $f0, $f0
938 ; MIPS64R5-N64-NEXT: movt $2, $zero, $fcc0
939 ; MIPS64R5-N64-NEXT: ld $1, %got_disp(i1)($1)
940 ; MIPS64R5-N64-NEXT: jr $ra
941 ; MIPS64R5-N64-NEXT: sh $2, 0($1)
943 ; MIPSR6-O32-LABEL: fcmp:
944 ; MIPSR6-O32: # %bb.0: # %entry
945 ; MIPSR6-O32-NEXT: lui $2, %hi(_gp_disp)
946 ; MIPSR6-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
947 ; MIPSR6-O32-NEXT: addu $1, $2, $25
948 ; MIPSR6-O32-NEXT: lw $2, %got(g)($1)
949 ; MIPSR6-O32-NEXT: lh $2, 0($2)
950 ; MIPSR6-O32-NEXT: fill.h $w0, $2
951 ; MIPSR6-O32-NEXT: fexupr.w $w0, $w0
952 ; MIPSR6-O32-NEXT: copy_s.w $2, $w0[0]
953 ; MIPSR6-O32-NEXT: mtc1 $2, $f0
954 ; MIPSR6-O32-NEXT: cmp.un.s $f0, $f0, $f0
955 ; MIPSR6-O32-NEXT: mfc1 $2, $f0
956 ; MIPSR6-O32-NEXT: not $2, $2
957 ; MIPSR6-O32-NEXT: andi $2, $2, 1
958 ; MIPSR6-O32-NEXT: lw $1, %got(i1)($1)
959 ; MIPSR6-O32-NEXT: jr $ra
960 ; MIPSR6-O32-NEXT: sh $2, 0($1)
962 ; MIPSR6-N32-LABEL: fcmp:
963 ; MIPSR6-N32: # %bb.0: # %entry
964 ; MIPSR6-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fcmp)))
965 ; MIPSR6-N32-NEXT: addu $1, $1, $25
966 ; MIPSR6-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fcmp)))
967 ; MIPSR6-N32-NEXT: lw $2, %got_disp(g)($1)
968 ; MIPSR6-N32-NEXT: lh $2, 0($2)
969 ; MIPSR6-N32-NEXT: fill.h $w0, $2
970 ; MIPSR6-N32-NEXT: fexupr.w $w0, $w0
971 ; MIPSR6-N32-NEXT: copy_s.w $2, $w0[0]
972 ; MIPSR6-N32-NEXT: mtc1 $2, $f0
973 ; MIPSR6-N32-NEXT: cmp.un.s $f0, $f0, $f0
974 ; MIPSR6-N32-NEXT: mfc1 $2, $f0
975 ; MIPSR6-N32-NEXT: not $2, $2
976 ; MIPSR6-N32-NEXT: andi $2, $2, 1
977 ; MIPSR6-N32-NEXT: lw $1, %got_disp(i1)($1)
978 ; MIPSR6-N32-NEXT: jr $ra
979 ; MIPSR6-N32-NEXT: sh $2, 0($1)
981 ; MIPSR6-N64-LABEL: fcmp:
982 ; MIPSR6-N64: # %bb.0: # %entry
983 ; MIPSR6-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fcmp)))
984 ; MIPSR6-N64-NEXT: daddu $1, $1, $25
985 ; MIPSR6-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fcmp)))
986 ; MIPSR6-N64-NEXT: ld $2, %got_disp(g)($1)
987 ; MIPSR6-N64-NEXT: lh $2, 0($2)
988 ; MIPSR6-N64-NEXT: fill.h $w0, $2
989 ; MIPSR6-N64-NEXT: fexupr.w $w0, $w0
990 ; MIPSR6-N64-NEXT: copy_s.w $2, $w0[0]
991 ; MIPSR6-N64-NEXT: mtc1 $2, $f0
992 ; MIPSR6-N64-NEXT: cmp.un.s $f0, $f0, $f0
993 ; MIPSR6-N64-NEXT: mfc1 $2, $f0
994 ; MIPSR6-N64-NEXT: not $2, $2
995 ; MIPSR6-N64-NEXT: andi $2, $2, 1
996 ; MIPSR6-N64-NEXT: ld $1, %got_disp(i1)($1)
997 ; MIPSR6-N64-NEXT: jr $ra
998 ; MIPSR6-N64-NEXT: sh $2, 0($1)
1000 %0 = load i16, ptr @g, align 2
1001 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1003 %2 = load i16, ptr @g, align 2
1004 %3 = call float @llvm.convert.from.fp16.f32(i16 %2)
1005 %fcmp = fcmp oeq float %1, %3
1008 %4 = zext i1 %fcmp to i16
1009 store i16 %4, ptr @i1, align 2
1014 declare float @llvm.powi.f32.i32(float, i32)
1016 define void @fpowi() {
1017 ; MIPS32-LABEL: fpowi:
1018 ; MIPS32: # %bb.0: # %entry
1019 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1020 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1021 ; MIPS32-NEXT: addu $1, $2, $25
1022 ; MIPS32-NEXT: lw $1, %got(g)($1)
1023 ; MIPS32-NEXT: lh $2, 0($1)
1024 ; MIPS32-NEXT: fill.h $w0, $2
1025 ; MIPS32-NEXT: fexupr.w $w0, $w0
1026 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
1027 ; MIPS32-NEXT: mtc1 $2, $f0
1028 ; MIPS32-NEXT: mul.s $f0, $f0, $f0
1029 ; MIPS32-NEXT: mfc1 $2, $f0
1030 ; MIPS32-NEXT: fill.w $w0, $2
1031 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1032 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
1033 ; MIPS32-NEXT: jr $ra
1034 ; MIPS32-NEXT: sh $2, 0($1)
1036 ; MIPS64-N32-LABEL: fpowi:
1037 ; MIPS64-N32: # %bb.0: # %entry
1038 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fpowi)))
1039 ; MIPS64-N32-NEXT: addu $1, $1, $25
1040 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fpowi)))
1041 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
1042 ; MIPS64-N32-NEXT: lh $2, 0($1)
1043 ; MIPS64-N32-NEXT: fill.h $w0, $2
1044 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1045 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
1046 ; MIPS64-N32-NEXT: mtc1 $2, $f0
1047 ; MIPS64-N32-NEXT: mul.s $f0, $f0, $f0
1048 ; MIPS64-N32-NEXT: mfc1 $2, $f0
1049 ; MIPS64-N32-NEXT: fill.w $w0, $2
1050 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1051 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
1052 ; MIPS64-N32-NEXT: jr $ra
1053 ; MIPS64-N32-NEXT: sh $2, 0($1)
1055 ; MIPS64-N64-LABEL: fpowi:
1056 ; MIPS64-N64: # %bb.0: # %entry
1057 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fpowi)))
1058 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1059 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fpowi)))
1060 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
1061 ; MIPS64-N64-NEXT: lh $2, 0($1)
1062 ; MIPS64-N64-NEXT: fill.h $w0, $2
1063 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1064 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
1065 ; MIPS64-N64-NEXT: mtc1 $2, $f0
1066 ; MIPS64-N64-NEXT: mul.s $f0, $f0, $f0
1067 ; MIPS64-N64-NEXT: mfc1 $2, $f0
1068 ; MIPS64-N64-NEXT: fill.w $w0, $2
1069 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1070 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
1071 ; MIPS64-N64-NEXT: jr $ra
1072 ; MIPS64-N64-NEXT: sh $2, 0($1)
1074 %0 = load i16, ptr @g, align 2
1075 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1078 %powi = call float @llvm.powi.f32.i32(float %1, i32 2)
1081 %2 = call i16 @llvm.convert.to.fp16.f32(float %powi)
1084 store i16 %2, ptr @g, align 2
1088 define void @fpowi_var(i32 %var) {
1089 ; MIPS32-LABEL: fpowi_var:
1090 ; MIPS32: # %bb.0: # %entry
1091 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1092 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1093 ; MIPS32-NEXT: addiu $sp, $sp, -24
1094 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1095 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1096 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1097 ; MIPS32-NEXT: .cfi_offset 31, -4
1098 ; MIPS32-NEXT: .cfi_offset 16, -8
1099 ; MIPS32-NEXT: addu $gp, $2, $25
1100 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1101 ; MIPS32-NEXT: lh $1, 0($16)
1102 ; MIPS32-NEXT: fill.h $w0, $1
1103 ; MIPS32-NEXT: fexupr.w $w0, $w0
1104 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1105 ; MIPS32-NEXT: mtc1 $1, $f12
1106 ; MIPS32-NEXT: lw $25, %call16(__powisf2)($gp)
1107 ; MIPS32-NEXT: jalr $25
1108 ; MIPS32-NEXT: move $5, $4
1109 ; MIPS32-NEXT: mfc1 $1, $f0
1110 ; MIPS32-NEXT: fill.w $w0, $1
1111 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1112 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1113 ; MIPS32-NEXT: sh $1, 0($16)
1114 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1115 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1116 ; MIPS32-NEXT: jr $ra
1117 ; MIPS32-NEXT: addiu $sp, $sp, 24
1119 ; MIPS64-N32-LABEL: fpowi_var:
1120 ; MIPS64-N32: # %bb.0: # %entry
1121 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1122 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1123 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1124 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1125 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1126 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1127 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1128 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1129 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fpowi_var)))
1130 ; MIPS64-N32-NEXT: addu $1, $1, $25
1131 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fpowi_var)))
1132 ; MIPS64-N32-NEXT: sll $5, $4, 0
1133 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1134 ; MIPS64-N32-NEXT: lh $1, 0($16)
1135 ; MIPS64-N32-NEXT: fill.h $w0, $1
1136 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1137 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1138 ; MIPS64-N32-NEXT: lw $25, %call16(__powisf2)($gp)
1139 ; MIPS64-N32-NEXT: jalr $25
1140 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1141 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1142 ; MIPS64-N32-NEXT: fill.w $w0, $1
1143 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1144 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1145 ; MIPS64-N32-NEXT: sh $1, 0($16)
1146 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1147 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1148 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1149 ; MIPS64-N32-NEXT: jr $ra
1150 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1152 ; MIPS64-N64-LABEL: fpowi_var:
1153 ; MIPS64-N64: # %bb.0: # %entry
1154 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1155 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1156 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1157 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1158 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1159 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1160 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1161 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1162 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fpowi_var)))
1163 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1164 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fpowi_var)))
1165 ; MIPS64-N64-NEXT: sll $5, $4, 0
1166 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1167 ; MIPS64-N64-NEXT: lh $1, 0($16)
1168 ; MIPS64-N64-NEXT: fill.h $w0, $1
1169 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1170 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1171 ; MIPS64-N64-NEXT: ld $25, %call16(__powisf2)($gp)
1172 ; MIPS64-N64-NEXT: jalr $25
1173 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1174 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1175 ; MIPS64-N64-NEXT: fill.w $w0, $1
1176 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1177 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1178 ; MIPS64-N64-NEXT: sh $1, 0($16)
1179 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1180 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1181 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1182 ; MIPS64-N64-NEXT: jr $ra
1183 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1185 %0 = load i16, ptr @g, align 2
1186 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1189 %powi = call float @llvm.powi.f32.i32(float %1, i32 %var)
1192 %2 = call i16 @llvm.convert.to.fp16.f32(float %powi)
1195 store i16 %2, ptr @g, align 2
1199 declare float @llvm.pow.f32(float %Val, float %power)
1201 define void @fpow(float %var) {
1202 ; MIPS32-LABEL: fpow:
1203 ; MIPS32: # %bb.0: # %entry
1204 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1205 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1206 ; MIPS32-NEXT: addiu $sp, $sp, -24
1207 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1208 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1209 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1210 ; MIPS32-NEXT: .cfi_offset 31, -4
1211 ; MIPS32-NEXT: .cfi_offset 16, -8
1212 ; MIPS32-NEXT: addu $gp, $2, $25
1213 ; MIPS32-NEXT: mov.s $f14, $f12
1214 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1215 ; MIPS32-NEXT: lh $1, 0($16)
1216 ; MIPS32-NEXT: fill.h $w0, $1
1217 ; MIPS32-NEXT: fexupr.w $w0, $w0
1218 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1219 ; MIPS32-NEXT: lw $25, %call16(powf)($gp)
1220 ; MIPS32-NEXT: jalr $25
1221 ; MIPS32-NEXT: mtc1 $1, $f12
1222 ; MIPS32-NEXT: mfc1 $1, $f0
1223 ; MIPS32-NEXT: fill.w $w0, $1
1224 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1225 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1226 ; MIPS32-NEXT: sh $1, 0($16)
1227 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1228 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1229 ; MIPS32-NEXT: jr $ra
1230 ; MIPS32-NEXT: addiu $sp, $sp, 24
1232 ; MIPS64-N32-LABEL: fpow:
1233 ; MIPS64-N32: # %bb.0: # %entry
1234 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1235 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1236 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1237 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1238 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1239 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1240 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1241 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1242 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fpow)))
1243 ; MIPS64-N32-NEXT: addu $1, $1, $25
1244 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fpow)))
1245 ; MIPS64-N32-NEXT: mov.s $f13, $f12
1246 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1247 ; MIPS64-N32-NEXT: lh $1, 0($16)
1248 ; MIPS64-N32-NEXT: fill.h $w0, $1
1249 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1250 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1251 ; MIPS64-N32-NEXT: lw $25, %call16(powf)($gp)
1252 ; MIPS64-N32-NEXT: jalr $25
1253 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1254 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1255 ; MIPS64-N32-NEXT: fill.w $w0, $1
1256 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1257 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1258 ; MIPS64-N32-NEXT: sh $1, 0($16)
1259 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1260 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1261 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1262 ; MIPS64-N32-NEXT: jr $ra
1263 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1265 ; MIPS64-N64-LABEL: fpow:
1266 ; MIPS64-N64: # %bb.0: # %entry
1267 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1268 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1269 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1270 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1271 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1272 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1273 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1274 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1275 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fpow)))
1276 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1277 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fpow)))
1278 ; MIPS64-N64-NEXT: mov.s $f13, $f12
1279 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1280 ; MIPS64-N64-NEXT: lh $1, 0($16)
1281 ; MIPS64-N64-NEXT: fill.h $w0, $1
1282 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1283 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1284 ; MIPS64-N64-NEXT: ld $25, %call16(powf)($gp)
1285 ; MIPS64-N64-NEXT: jalr $25
1286 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1287 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1288 ; MIPS64-N64-NEXT: fill.w $w0, $1
1289 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1290 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1291 ; MIPS64-N64-NEXT: sh $1, 0($16)
1292 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1293 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1294 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1295 ; MIPS64-N64-NEXT: jr $ra
1296 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1298 %0 = load i16, ptr @g, align 2
1299 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1302 %powi = call float @llvm.pow.f32(float %1, float %var)
1305 %2 = call i16 @llvm.convert.to.fp16.f32(float %powi)
1308 store i16 %2, ptr @g, align 2
1312 declare float @llvm.log2.f32(float %Val)
1314 define void @flog2() {
1315 ; MIPS32-LABEL: flog2:
1316 ; MIPS32: # %bb.0: # %entry
1317 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1318 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1319 ; MIPS32-NEXT: addiu $sp, $sp, -24
1320 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1321 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1322 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1323 ; MIPS32-NEXT: .cfi_offset 31, -4
1324 ; MIPS32-NEXT: .cfi_offset 16, -8
1325 ; MIPS32-NEXT: addu $gp, $2, $25
1326 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1327 ; MIPS32-NEXT: lh $1, 0($16)
1328 ; MIPS32-NEXT: fill.h $w0, $1
1329 ; MIPS32-NEXT: fexupr.w $w0, $w0
1330 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1331 ; MIPS32-NEXT: lw $25, %call16(log2f)($gp)
1332 ; MIPS32-NEXT: jalr $25
1333 ; MIPS32-NEXT: mtc1 $1, $f12
1334 ; MIPS32-NEXT: mfc1 $1, $f0
1335 ; MIPS32-NEXT: fill.w $w0, $1
1336 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1337 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1338 ; MIPS32-NEXT: sh $1, 0($16)
1339 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1340 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1341 ; MIPS32-NEXT: jr $ra
1342 ; MIPS32-NEXT: addiu $sp, $sp, 24
1344 ; MIPS64-N32-LABEL: flog2:
1345 ; MIPS64-N32: # %bb.0: # %entry
1346 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1347 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1348 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1349 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1350 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1351 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1352 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1353 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1354 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(flog2)))
1355 ; MIPS64-N32-NEXT: addu $1, $1, $25
1356 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(flog2)))
1357 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1358 ; MIPS64-N32-NEXT: lh $1, 0($16)
1359 ; MIPS64-N32-NEXT: fill.h $w0, $1
1360 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1361 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1362 ; MIPS64-N32-NEXT: lw $25, %call16(log2f)($gp)
1363 ; MIPS64-N32-NEXT: jalr $25
1364 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1365 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1366 ; MIPS64-N32-NEXT: fill.w $w0, $1
1367 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1368 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1369 ; MIPS64-N32-NEXT: sh $1, 0($16)
1370 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1371 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1372 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1373 ; MIPS64-N32-NEXT: jr $ra
1374 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1376 ; MIPS64-N64-LABEL: flog2:
1377 ; MIPS64-N64: # %bb.0: # %entry
1378 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1379 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1380 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1381 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1382 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1383 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1384 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1385 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1386 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(flog2)))
1387 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1388 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(flog2)))
1389 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1390 ; MIPS64-N64-NEXT: lh $1, 0($16)
1391 ; MIPS64-N64-NEXT: fill.h $w0, $1
1392 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1393 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1394 ; MIPS64-N64-NEXT: ld $25, %call16(log2f)($gp)
1395 ; MIPS64-N64-NEXT: jalr $25
1396 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1397 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1398 ; MIPS64-N64-NEXT: fill.w $w0, $1
1399 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1400 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1401 ; MIPS64-N64-NEXT: sh $1, 0($16)
1402 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1403 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1404 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1405 ; MIPS64-N64-NEXT: jr $ra
1406 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1408 %0 = load i16, ptr @g, align 2
1409 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1412 %log2 = call float @llvm.log2.f32(float %1)
1413 %2 = call i16 @llvm.convert.to.fp16.f32(float %log2)
1416 store i16 %2, ptr @g, align 2
1421 declare float @llvm.log10.f32(float %Val)
1423 define void @flog10() {
1424 ; MIPS32-LABEL: flog10:
1425 ; MIPS32: # %bb.0: # %entry
1426 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1427 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1428 ; MIPS32-NEXT: addiu $sp, $sp, -24
1429 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1430 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1431 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1432 ; MIPS32-NEXT: .cfi_offset 31, -4
1433 ; MIPS32-NEXT: .cfi_offset 16, -8
1434 ; MIPS32-NEXT: addu $gp, $2, $25
1435 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1436 ; MIPS32-NEXT: lh $1, 0($16)
1437 ; MIPS32-NEXT: fill.h $w0, $1
1438 ; MIPS32-NEXT: fexupr.w $w0, $w0
1439 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1440 ; MIPS32-NEXT: lw $25, %call16(log10f)($gp)
1441 ; MIPS32-NEXT: jalr $25
1442 ; MIPS32-NEXT: mtc1 $1, $f12
1443 ; MIPS32-NEXT: mfc1 $1, $f0
1444 ; MIPS32-NEXT: fill.w $w0, $1
1445 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1446 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1447 ; MIPS32-NEXT: sh $1, 0($16)
1448 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1449 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1450 ; MIPS32-NEXT: jr $ra
1451 ; MIPS32-NEXT: addiu $sp, $sp, 24
1453 ; MIPS64-N32-LABEL: flog10:
1454 ; MIPS64-N32: # %bb.0: # %entry
1455 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1456 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1457 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1458 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1459 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1460 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1461 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1462 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1463 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(flog10)))
1464 ; MIPS64-N32-NEXT: addu $1, $1, $25
1465 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(flog10)))
1466 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1467 ; MIPS64-N32-NEXT: lh $1, 0($16)
1468 ; MIPS64-N32-NEXT: fill.h $w0, $1
1469 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1470 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1471 ; MIPS64-N32-NEXT: lw $25, %call16(log10f)($gp)
1472 ; MIPS64-N32-NEXT: jalr $25
1473 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1474 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1475 ; MIPS64-N32-NEXT: fill.w $w0, $1
1476 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1477 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1478 ; MIPS64-N32-NEXT: sh $1, 0($16)
1479 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1480 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1481 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1482 ; MIPS64-N32-NEXT: jr $ra
1483 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1485 ; MIPS64-N64-LABEL: flog10:
1486 ; MIPS64-N64: # %bb.0: # %entry
1487 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1488 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1489 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1490 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1491 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1492 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1493 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1494 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1495 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(flog10)))
1496 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1497 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(flog10)))
1498 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1499 ; MIPS64-N64-NEXT: lh $1, 0($16)
1500 ; MIPS64-N64-NEXT: fill.h $w0, $1
1501 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1502 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1503 ; MIPS64-N64-NEXT: ld $25, %call16(log10f)($gp)
1504 ; MIPS64-N64-NEXT: jalr $25
1505 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1506 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1507 ; MIPS64-N64-NEXT: fill.w $w0, $1
1508 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1509 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1510 ; MIPS64-N64-NEXT: sh $1, 0($16)
1511 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1512 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1513 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1514 ; MIPS64-N64-NEXT: jr $ra
1515 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1517 %0 = load i16, ptr @g, align 2
1518 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1521 %log10 = call float @llvm.log10.f32(float %1)
1522 %2 = call i16 @llvm.convert.to.fp16.f32(float %log10)
1525 store i16 %2, ptr @g, align 2
1530 declare float @llvm.sqrt.f32(float %Val)
1532 define void @fsqrt() {
1533 ; MIPS32-LABEL: fsqrt:
1534 ; MIPS32: # %bb.0: # %entry
1535 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1536 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1537 ; MIPS32-NEXT: addu $1, $2, $25
1538 ; MIPS32-NEXT: lw $1, %got(g)($1)
1539 ; MIPS32-NEXT: lh $2, 0($1)
1540 ; MIPS32-NEXT: fill.h $w0, $2
1541 ; MIPS32-NEXT: fexupr.w $w0, $w0
1542 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
1543 ; MIPS32-NEXT: mtc1 $2, $f0
1544 ; MIPS32-NEXT: sqrt.s $f0, $f0
1545 ; MIPS32-NEXT: mfc1 $2, $f0
1546 ; MIPS32-NEXT: fill.w $w0, $2
1547 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1548 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
1549 ; MIPS32-NEXT: jr $ra
1550 ; MIPS32-NEXT: sh $2, 0($1)
1552 ; MIPS64-N32-LABEL: fsqrt:
1553 ; MIPS64-N32: # %bb.0: # %entry
1554 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fsqrt)))
1555 ; MIPS64-N32-NEXT: addu $1, $1, $25
1556 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fsqrt)))
1557 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
1558 ; MIPS64-N32-NEXT: lh $2, 0($1)
1559 ; MIPS64-N32-NEXT: fill.h $w0, $2
1560 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1561 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
1562 ; MIPS64-N32-NEXT: mtc1 $2, $f0
1563 ; MIPS64-N32-NEXT: sqrt.s $f0, $f0
1564 ; MIPS64-N32-NEXT: mfc1 $2, $f0
1565 ; MIPS64-N32-NEXT: fill.w $w0, $2
1566 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1567 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
1568 ; MIPS64-N32-NEXT: jr $ra
1569 ; MIPS64-N32-NEXT: sh $2, 0($1)
1571 ; MIPS64-N64-LABEL: fsqrt:
1572 ; MIPS64-N64: # %bb.0: # %entry
1573 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fsqrt)))
1574 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1575 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fsqrt)))
1576 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
1577 ; MIPS64-N64-NEXT: lh $2, 0($1)
1578 ; MIPS64-N64-NEXT: fill.h $w0, $2
1579 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1580 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
1581 ; MIPS64-N64-NEXT: mtc1 $2, $f0
1582 ; MIPS64-N64-NEXT: sqrt.s $f0, $f0
1583 ; MIPS64-N64-NEXT: mfc1 $2, $f0
1584 ; MIPS64-N64-NEXT: fill.w $w0, $2
1585 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1586 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
1587 ; MIPS64-N64-NEXT: jr $ra
1588 ; MIPS64-N64-NEXT: sh $2, 0($1)
1590 %0 = load i16, ptr @g, align 2
1591 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1594 %sqrt = call float @llvm.sqrt.f32(float %1)
1595 %2 = call i16 @llvm.convert.to.fp16.f32(float %sqrt)
1598 store i16 %2, ptr @g, align 2
1603 declare float @llvm.sin.f32(float %Val)
1605 define void @fsin() {
1606 ; MIPS32-LABEL: fsin:
1607 ; MIPS32: # %bb.0: # %entry
1608 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1609 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1610 ; MIPS32-NEXT: addiu $sp, $sp, -24
1611 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1612 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1613 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1614 ; MIPS32-NEXT: .cfi_offset 31, -4
1615 ; MIPS32-NEXT: .cfi_offset 16, -8
1616 ; MIPS32-NEXT: addu $gp, $2, $25
1617 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1618 ; MIPS32-NEXT: lh $1, 0($16)
1619 ; MIPS32-NEXT: fill.h $w0, $1
1620 ; MIPS32-NEXT: fexupr.w $w0, $w0
1621 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1622 ; MIPS32-NEXT: lw $25, %call16(sinf)($gp)
1623 ; MIPS32-NEXT: jalr $25
1624 ; MIPS32-NEXT: mtc1 $1, $f12
1625 ; MIPS32-NEXT: mfc1 $1, $f0
1626 ; MIPS32-NEXT: fill.w $w0, $1
1627 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1628 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1629 ; MIPS32-NEXT: sh $1, 0($16)
1630 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1631 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1632 ; MIPS32-NEXT: jr $ra
1633 ; MIPS32-NEXT: addiu $sp, $sp, 24
1635 ; MIPS64-N32-LABEL: fsin:
1636 ; MIPS64-N32: # %bb.0: # %entry
1637 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1638 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1639 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1640 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1641 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1642 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1643 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1644 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1645 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fsin)))
1646 ; MIPS64-N32-NEXT: addu $1, $1, $25
1647 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fsin)))
1648 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1649 ; MIPS64-N32-NEXT: lh $1, 0($16)
1650 ; MIPS64-N32-NEXT: fill.h $w0, $1
1651 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1652 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1653 ; MIPS64-N32-NEXT: lw $25, %call16(sinf)($gp)
1654 ; MIPS64-N32-NEXT: jalr $25
1655 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1656 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1657 ; MIPS64-N32-NEXT: fill.w $w0, $1
1658 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1659 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1660 ; MIPS64-N32-NEXT: sh $1, 0($16)
1661 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1662 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1663 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1664 ; MIPS64-N32-NEXT: jr $ra
1665 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1667 ; MIPS64-N64-LABEL: fsin:
1668 ; MIPS64-N64: # %bb.0: # %entry
1669 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1670 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1671 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1672 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1673 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1674 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1675 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1676 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1677 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fsin)))
1678 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1679 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fsin)))
1680 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1681 ; MIPS64-N64-NEXT: lh $1, 0($16)
1682 ; MIPS64-N64-NEXT: fill.h $w0, $1
1683 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1684 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1685 ; MIPS64-N64-NEXT: ld $25, %call16(sinf)($gp)
1686 ; MIPS64-N64-NEXT: jalr $25
1687 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1688 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1689 ; MIPS64-N64-NEXT: fill.w $w0, $1
1690 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1691 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1692 ; MIPS64-N64-NEXT: sh $1, 0($16)
1693 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1694 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1695 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1696 ; MIPS64-N64-NEXT: jr $ra
1697 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1699 %0 = load i16, ptr @g, align 2
1700 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1703 %sin = call float @llvm.sin.f32(float %1)
1704 %2 = call i16 @llvm.convert.to.fp16.f32(float %sin)
1707 store i16 %2, ptr @g, align 2
1712 declare float @llvm.cos.f32(float %Val)
1714 define void @fcos() {
1715 ; MIPS32-LABEL: fcos:
1716 ; MIPS32: # %bb.0: # %entry
1717 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1718 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1719 ; MIPS32-NEXT: addiu $sp, $sp, -24
1720 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1721 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1722 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1723 ; MIPS32-NEXT: .cfi_offset 31, -4
1724 ; MIPS32-NEXT: .cfi_offset 16, -8
1725 ; MIPS32-NEXT: addu $gp, $2, $25
1726 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1727 ; MIPS32-NEXT: lh $1, 0($16)
1728 ; MIPS32-NEXT: fill.h $w0, $1
1729 ; MIPS32-NEXT: fexupr.w $w0, $w0
1730 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1731 ; MIPS32-NEXT: lw $25, %call16(cosf)($gp)
1732 ; MIPS32-NEXT: jalr $25
1733 ; MIPS32-NEXT: mtc1 $1, $f12
1734 ; MIPS32-NEXT: mfc1 $1, $f0
1735 ; MIPS32-NEXT: fill.w $w0, $1
1736 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1737 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1738 ; MIPS32-NEXT: sh $1, 0($16)
1739 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1740 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1741 ; MIPS32-NEXT: jr $ra
1742 ; MIPS32-NEXT: addiu $sp, $sp, 24
1744 ; MIPS64-N32-LABEL: fcos:
1745 ; MIPS64-N32: # %bb.0: # %entry
1746 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1747 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1748 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1749 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1750 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1751 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1752 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1753 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1754 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fcos)))
1755 ; MIPS64-N32-NEXT: addu $1, $1, $25
1756 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fcos)))
1757 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1758 ; MIPS64-N32-NEXT: lh $1, 0($16)
1759 ; MIPS64-N32-NEXT: fill.h $w0, $1
1760 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1761 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1762 ; MIPS64-N32-NEXT: lw $25, %call16(cosf)($gp)
1763 ; MIPS64-N32-NEXT: jalr $25
1764 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1765 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1766 ; MIPS64-N32-NEXT: fill.w $w0, $1
1767 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1768 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1769 ; MIPS64-N32-NEXT: sh $1, 0($16)
1770 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1771 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1772 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1773 ; MIPS64-N32-NEXT: jr $ra
1774 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1776 ; MIPS64-N64-LABEL: fcos:
1777 ; MIPS64-N64: # %bb.0: # %entry
1778 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1779 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1780 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1781 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1782 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1783 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1784 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1785 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1786 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fcos)))
1787 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1788 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fcos)))
1789 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1790 ; MIPS64-N64-NEXT: lh $1, 0($16)
1791 ; MIPS64-N64-NEXT: fill.h $w0, $1
1792 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1793 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1794 ; MIPS64-N64-NEXT: ld $25, %call16(cosf)($gp)
1795 ; MIPS64-N64-NEXT: jalr $25
1796 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1797 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1798 ; MIPS64-N64-NEXT: fill.w $w0, $1
1799 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1800 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1801 ; MIPS64-N64-NEXT: sh $1, 0($16)
1802 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1803 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1804 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1805 ; MIPS64-N64-NEXT: jr $ra
1806 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1808 %0 = load i16, ptr @g, align 2
1809 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1812 %cos = call float @llvm.cos.f32(float %1)
1813 %2 = call i16 @llvm.convert.to.fp16.f32(float %cos)
1816 store i16 %2, ptr @g, align 2
1821 declare float @llvm.exp.f32(float %Val)
1823 define void @fexp() {
1824 ; MIPS32-LABEL: fexp:
1825 ; MIPS32: # %bb.0: # %entry
1826 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1827 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1828 ; MIPS32-NEXT: addiu $sp, $sp, -24
1829 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1830 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1831 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1832 ; MIPS32-NEXT: .cfi_offset 31, -4
1833 ; MIPS32-NEXT: .cfi_offset 16, -8
1834 ; MIPS32-NEXT: addu $gp, $2, $25
1835 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1836 ; MIPS32-NEXT: lh $1, 0($16)
1837 ; MIPS32-NEXT: fill.h $w0, $1
1838 ; MIPS32-NEXT: fexupr.w $w0, $w0
1839 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1840 ; MIPS32-NEXT: lw $25, %call16(expf)($gp)
1841 ; MIPS32-NEXT: jalr $25
1842 ; MIPS32-NEXT: mtc1 $1, $f12
1843 ; MIPS32-NEXT: mfc1 $1, $f0
1844 ; MIPS32-NEXT: fill.w $w0, $1
1845 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1846 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1847 ; MIPS32-NEXT: sh $1, 0($16)
1848 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1849 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1850 ; MIPS32-NEXT: jr $ra
1851 ; MIPS32-NEXT: addiu $sp, $sp, 24
1853 ; MIPS64-N32-LABEL: fexp:
1854 ; MIPS64-N32: # %bb.0: # %entry
1855 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1856 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1857 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1858 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1859 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1860 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1861 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1862 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1863 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fexp)))
1864 ; MIPS64-N32-NEXT: addu $1, $1, $25
1865 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fexp)))
1866 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1867 ; MIPS64-N32-NEXT: lh $1, 0($16)
1868 ; MIPS64-N32-NEXT: fill.h $w0, $1
1869 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1870 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1871 ; MIPS64-N32-NEXT: lw $25, %call16(expf)($gp)
1872 ; MIPS64-N32-NEXT: jalr $25
1873 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1874 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1875 ; MIPS64-N32-NEXT: fill.w $w0, $1
1876 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1877 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1878 ; MIPS64-N32-NEXT: sh $1, 0($16)
1879 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1880 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1881 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1882 ; MIPS64-N32-NEXT: jr $ra
1883 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1885 ; MIPS64-N64-LABEL: fexp:
1886 ; MIPS64-N64: # %bb.0: # %entry
1887 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1888 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1889 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1890 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1891 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1892 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
1893 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
1894 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
1895 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fexp)))
1896 ; MIPS64-N64-NEXT: daddu $1, $1, $25
1897 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fexp)))
1898 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
1899 ; MIPS64-N64-NEXT: lh $1, 0($16)
1900 ; MIPS64-N64-NEXT: fill.h $w0, $1
1901 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
1902 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
1903 ; MIPS64-N64-NEXT: ld $25, %call16(expf)($gp)
1904 ; MIPS64-N64-NEXT: jalr $25
1905 ; MIPS64-N64-NEXT: mtc1 $1, $f12
1906 ; MIPS64-N64-NEXT: mfc1 $1, $f0
1907 ; MIPS64-N64-NEXT: fill.w $w0, $1
1908 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
1909 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
1910 ; MIPS64-N64-NEXT: sh $1, 0($16)
1911 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1912 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1913 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1914 ; MIPS64-N64-NEXT: jr $ra
1915 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
1917 %0 = load i16, ptr @g, align 2
1918 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
1920 %exp = call float @llvm.exp.f32(float %1)
1921 %2 = call i16 @llvm.convert.to.fp16.f32(float %exp)
1924 store i16 %2, ptr @g, align 2
1929 declare float @llvm.exp2.f32(float %Val)
1931 define void @fexp2() {
1932 ; MIPS32-LABEL: fexp2:
1933 ; MIPS32: # %bb.0: # %entry
1934 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
1935 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
1936 ; MIPS32-NEXT: addiu $sp, $sp, -24
1937 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
1938 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
1939 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
1940 ; MIPS32-NEXT: .cfi_offset 31, -4
1941 ; MIPS32-NEXT: .cfi_offset 16, -8
1942 ; MIPS32-NEXT: addu $gp, $2, $25
1943 ; MIPS32-NEXT: lw $16, %got(g)($gp)
1944 ; MIPS32-NEXT: lh $1, 0($16)
1945 ; MIPS32-NEXT: fill.h $w0, $1
1946 ; MIPS32-NEXT: fexupr.w $w0, $w0
1947 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
1948 ; MIPS32-NEXT: lw $25, %call16(exp2f)($gp)
1949 ; MIPS32-NEXT: jalr $25
1950 ; MIPS32-NEXT: mtc1 $1, $f12
1951 ; MIPS32-NEXT: mfc1 $1, $f0
1952 ; MIPS32-NEXT: fill.w $w0, $1
1953 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
1954 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
1955 ; MIPS32-NEXT: sh $1, 0($16)
1956 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
1957 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
1958 ; MIPS32-NEXT: jr $ra
1959 ; MIPS32-NEXT: addiu $sp, $sp, 24
1961 ; MIPS64-N32-LABEL: fexp2:
1962 ; MIPS64-N32: # %bb.0: # %entry
1963 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
1964 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
1965 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1966 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1967 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
1968 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
1969 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
1970 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
1971 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fexp2)))
1972 ; MIPS64-N32-NEXT: addu $1, $1, $25
1973 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fexp2)))
1974 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
1975 ; MIPS64-N32-NEXT: lh $1, 0($16)
1976 ; MIPS64-N32-NEXT: fill.h $w0, $1
1977 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
1978 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
1979 ; MIPS64-N32-NEXT: lw $25, %call16(exp2f)($gp)
1980 ; MIPS64-N32-NEXT: jalr $25
1981 ; MIPS64-N32-NEXT: mtc1 $1, $f12
1982 ; MIPS64-N32-NEXT: mfc1 $1, $f0
1983 ; MIPS64-N32-NEXT: fill.w $w0, $1
1984 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
1985 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
1986 ; MIPS64-N32-NEXT: sh $1, 0($16)
1987 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
1988 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
1989 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
1990 ; MIPS64-N32-NEXT: jr $ra
1991 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
1993 ; MIPS64-N64-LABEL: fexp2:
1994 ; MIPS64-N64: # %bb.0: # %entry
1995 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
1996 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
1997 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
1998 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
1999 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2000 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
2001 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
2002 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
2003 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fexp2)))
2004 ; MIPS64-N64-NEXT: daddu $1, $1, $25
2005 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fexp2)))
2006 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
2007 ; MIPS64-N64-NEXT: lh $1, 0($16)
2008 ; MIPS64-N64-NEXT: fill.h $w0, $1
2009 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
2010 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
2011 ; MIPS64-N64-NEXT: ld $25, %call16(exp2f)($gp)
2012 ; MIPS64-N64-NEXT: jalr $25
2013 ; MIPS64-N64-NEXT: mtc1 $1, $f12
2014 ; MIPS64-N64-NEXT: mfc1 $1, $f0
2015 ; MIPS64-N64-NEXT: fill.w $w0, $1
2016 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
2017 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
2018 ; MIPS64-N64-NEXT: sh $1, 0($16)
2019 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2020 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2021 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2022 ; MIPS64-N64-NEXT: jr $ra
2023 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
2025 %0 = load i16, ptr @g, align 2
2026 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2029 %exp2 = call float @llvm.exp2.f32(float %1)
2030 %2 = call i16 @llvm.convert.to.fp16.f32(float %exp2)
2033 store i16 %2, ptr @g, align 2
2038 declare float @llvm.fma.f32(float, float, float)
2040 define void @ffma(float %b, float %c) {
2041 ; MIPS32-LABEL: ffma:
2042 ; MIPS32: # %bb.0: # %entry
2043 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
2044 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
2045 ; MIPS32-NEXT: addiu $sp, $sp, -24
2046 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
2047 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
2048 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
2049 ; MIPS32-NEXT: .cfi_offset 31, -4
2050 ; MIPS32-NEXT: .cfi_offset 16, -8
2051 ; MIPS32-NEXT: addu $gp, $2, $25
2052 ; MIPS32-NEXT: mov.s $f0, $f12
2053 ; MIPS32-NEXT: mfc1 $6, $f14
2054 ; MIPS32-NEXT: lw $16, %got(g)($gp)
2055 ; MIPS32-NEXT: lh $1, 0($16)
2056 ; MIPS32-NEXT: fill.h $w1, $1
2057 ; MIPS32-NEXT: fexupr.w $w1, $w1
2058 ; MIPS32-NEXT: copy_s.w $1, $w1[0]
2059 ; MIPS32-NEXT: mtc1 $1, $f12
2060 ; MIPS32-NEXT: lw $25, %call16(fmaf)($gp)
2061 ; MIPS32-NEXT: jalr $25
2062 ; MIPS32-NEXT: mov.s $f14, $f0
2063 ; MIPS32-NEXT: mfc1 $1, $f0
2064 ; MIPS32-NEXT: fill.w $w0, $1
2065 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
2066 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
2067 ; MIPS32-NEXT: sh $1, 0($16)
2068 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
2069 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
2070 ; MIPS32-NEXT: jr $ra
2071 ; MIPS32-NEXT: addiu $sp, $sp, 24
2073 ; MIPS64-N32-LABEL: ffma:
2074 ; MIPS64-N32: # %bb.0: # %entry
2075 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
2076 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
2077 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2078 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2079 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2080 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
2081 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
2082 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
2083 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffma)))
2084 ; MIPS64-N32-NEXT: addu $1, $1, $25
2085 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(ffma)))
2086 ; MIPS64-N32-NEXT: mov.s $f14, $f13
2087 ; MIPS64-N32-NEXT: mov.s $f13, $f12
2088 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
2089 ; MIPS64-N32-NEXT: lh $1, 0($16)
2090 ; MIPS64-N32-NEXT: fill.h $w0, $1
2091 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
2092 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
2093 ; MIPS64-N32-NEXT: lw $25, %call16(fmaf)($gp)
2094 ; MIPS64-N32-NEXT: jalr $25
2095 ; MIPS64-N32-NEXT: mtc1 $1, $f12
2096 ; MIPS64-N32-NEXT: mfc1 $1, $f0
2097 ; MIPS64-N32-NEXT: fill.w $w0, $1
2098 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
2099 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
2100 ; MIPS64-N32-NEXT: sh $1, 0($16)
2101 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2102 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2103 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2104 ; MIPS64-N32-NEXT: jr $ra
2105 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
2107 ; MIPS64-N64-LABEL: ffma:
2108 ; MIPS64-N64: # %bb.0: # %entry
2109 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
2110 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
2111 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2112 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2113 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2114 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
2115 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
2116 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
2117 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffma)))
2118 ; MIPS64-N64-NEXT: daddu $1, $1, $25
2119 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(ffma)))
2120 ; MIPS64-N64-NEXT: mov.s $f14, $f13
2121 ; MIPS64-N64-NEXT: mov.s $f13, $f12
2122 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
2123 ; MIPS64-N64-NEXT: lh $1, 0($16)
2124 ; MIPS64-N64-NEXT: fill.h $w0, $1
2125 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
2126 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
2127 ; MIPS64-N64-NEXT: ld $25, %call16(fmaf)($gp)
2128 ; MIPS64-N64-NEXT: jalr $25
2129 ; MIPS64-N64-NEXT: mtc1 $1, $f12
2130 ; MIPS64-N64-NEXT: mfc1 $1, $f0
2131 ; MIPS64-N64-NEXT: fill.w $w0, $1
2132 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
2133 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
2134 ; MIPS64-N64-NEXT: sh $1, 0($16)
2135 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2136 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2137 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2138 ; MIPS64-N64-NEXT: jr $ra
2139 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
2141 %0 = load i16, ptr @g, align 2
2142 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2145 %fma = call float @llvm.fma.f32(float %1, float %b, float %c)
2146 %2 = call i16 @llvm.convert.to.fp16.f32(float %fma)
2149 store i16 %2, ptr @g, align 2
2154 ; FIXME: For MIPSR6, this should produced the maddf.s instruction. MIPSR5 cannot
2155 ; fuse the operation such that the intermediate result is not rounded.
2157 declare float @llvm.fmuladd.f32(float, float, float)
2159 define void @ffmuladd(float %b, float %c) {
2160 ; MIPS32-O32-LABEL: ffmuladd:
2161 ; MIPS32-O32: # %bb.0: # %entry
2162 ; MIPS32-O32-NEXT: lui $2, %hi(_gp_disp)
2163 ; MIPS32-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
2164 ; MIPS32-O32-NEXT: addu $1, $2, $25
2165 ; MIPS32-O32-NEXT: lw $1, %got(g)($1)
2166 ; MIPS32-O32-NEXT: lh $2, 0($1)
2167 ; MIPS32-O32-NEXT: fill.h $w0, $2
2168 ; MIPS32-O32-NEXT: fexupr.w $w0, $w0
2169 ; MIPS32-O32-NEXT: copy_s.w $2, $w0[0]
2170 ; MIPS32-O32-NEXT: mtc1 $2, $f0
2171 ; MIPS32-O32-NEXT: madd.s $f0, $f14, $f0, $f12
2172 ; MIPS32-O32-NEXT: mfc1 $2, $f0
2173 ; MIPS32-O32-NEXT: fill.w $w0, $2
2174 ; MIPS32-O32-NEXT: fexdo.h $w0, $w0, $w0
2175 ; MIPS32-O32-NEXT: copy_u.h $2, $w0[0]
2176 ; MIPS32-O32-NEXT: jr $ra
2177 ; MIPS32-O32-NEXT: sh $2, 0($1)
2179 ; MIPS64R5-N32-LABEL: ffmuladd:
2180 ; MIPS64R5-N32: # %bb.0: # %entry
2181 ; MIPS64R5-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffmuladd)))
2182 ; MIPS64R5-N32-NEXT: addu $1, $1, $25
2183 ; MIPS64R5-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(ffmuladd)))
2184 ; MIPS64R5-N32-NEXT: lw $1, %got_disp(g)($1)
2185 ; MIPS64R5-N32-NEXT: lh $2, 0($1)
2186 ; MIPS64R5-N32-NEXT: fill.h $w0, $2
2187 ; MIPS64R5-N32-NEXT: fexupr.w $w0, $w0
2188 ; MIPS64R5-N32-NEXT: copy_s.w $2, $w0[0]
2189 ; MIPS64R5-N32-NEXT: mtc1 $2, $f0
2190 ; MIPS64R5-N32-NEXT: madd.s $f0, $f13, $f0, $f12
2191 ; MIPS64R5-N32-NEXT: mfc1 $2, $f0
2192 ; MIPS64R5-N32-NEXT: fill.w $w0, $2
2193 ; MIPS64R5-N32-NEXT: fexdo.h $w0, $w0, $w0
2194 ; MIPS64R5-N32-NEXT: copy_u.h $2, $w0[0]
2195 ; MIPS64R5-N32-NEXT: jr $ra
2196 ; MIPS64R5-N32-NEXT: sh $2, 0($1)
2198 ; MIPS64R5-N64-LABEL: ffmuladd:
2199 ; MIPS64R5-N64: # %bb.0: # %entry
2200 ; MIPS64R5-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffmuladd)))
2201 ; MIPS64R5-N64-NEXT: daddu $1, $1, $25
2202 ; MIPS64R5-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(ffmuladd)))
2203 ; MIPS64R5-N64-NEXT: ld $1, %got_disp(g)($1)
2204 ; MIPS64R5-N64-NEXT: lh $2, 0($1)
2205 ; MIPS64R5-N64-NEXT: fill.h $w0, $2
2206 ; MIPS64R5-N64-NEXT: fexupr.w $w0, $w0
2207 ; MIPS64R5-N64-NEXT: copy_s.w $2, $w0[0]
2208 ; MIPS64R5-N64-NEXT: mtc1 $2, $f0
2209 ; MIPS64R5-N64-NEXT: madd.s $f0, $f13, $f0, $f12
2210 ; MIPS64R5-N64-NEXT: mfc1 $2, $f0
2211 ; MIPS64R5-N64-NEXT: fill.w $w0, $2
2212 ; MIPS64R5-N64-NEXT: fexdo.h $w0, $w0, $w0
2213 ; MIPS64R5-N64-NEXT: copy_u.h $2, $w0[0]
2214 ; MIPS64R5-N64-NEXT: jr $ra
2215 ; MIPS64R5-N64-NEXT: sh $2, 0($1)
2217 ; MIPSR6-O32-LABEL: ffmuladd:
2218 ; MIPSR6-O32: # %bb.0: # %entry
2219 ; MIPSR6-O32-NEXT: lui $2, %hi(_gp_disp)
2220 ; MIPSR6-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
2221 ; MIPSR6-O32-NEXT: addu $1, $2, $25
2222 ; MIPSR6-O32-NEXT: lw $1, %got(g)($1)
2223 ; MIPSR6-O32-NEXT: lh $2, 0($1)
2224 ; MIPSR6-O32-NEXT: fill.h $w0, $2
2225 ; MIPSR6-O32-NEXT: fexupr.w $w0, $w0
2226 ; MIPSR6-O32-NEXT: copy_s.w $2, $w0[0]
2227 ; MIPSR6-O32-NEXT: mtc1 $2, $f0
2228 ; MIPSR6-O32-NEXT: mul.s $f0, $f0, $f12
2229 ; MIPSR6-O32-NEXT: add.s $f0, $f0, $f14
2230 ; MIPSR6-O32-NEXT: mfc1 $2, $f0
2231 ; MIPSR6-O32-NEXT: fill.w $w0, $2
2232 ; MIPSR6-O32-NEXT: fexdo.h $w0, $w0, $w0
2233 ; MIPSR6-O32-NEXT: copy_u.h $2, $w0[0]
2234 ; MIPSR6-O32-NEXT: jr $ra
2235 ; MIPSR6-O32-NEXT: sh $2, 0($1)
2237 ; MIPSR6-N32-LABEL: ffmuladd:
2238 ; MIPSR6-N32: # %bb.0: # %entry
2239 ; MIPSR6-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffmuladd)))
2240 ; MIPSR6-N32-NEXT: addu $1, $1, $25
2241 ; MIPSR6-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(ffmuladd)))
2242 ; MIPSR6-N32-NEXT: lw $1, %got_disp(g)($1)
2243 ; MIPSR6-N32-NEXT: lh $2, 0($1)
2244 ; MIPSR6-N32-NEXT: fill.h $w0, $2
2245 ; MIPSR6-N32-NEXT: fexupr.w $w0, $w0
2246 ; MIPSR6-N32-NEXT: copy_s.w $2, $w0[0]
2247 ; MIPSR6-N32-NEXT: mtc1 $2, $f0
2248 ; MIPSR6-N32-NEXT: mul.s $f0, $f0, $f12
2249 ; MIPSR6-N32-NEXT: add.s $f0, $f0, $f13
2250 ; MIPSR6-N32-NEXT: mfc1 $2, $f0
2251 ; MIPSR6-N32-NEXT: fill.w $w0, $2
2252 ; MIPSR6-N32-NEXT: fexdo.h $w0, $w0, $w0
2253 ; MIPSR6-N32-NEXT: copy_u.h $2, $w0[0]
2254 ; MIPSR6-N32-NEXT: jr $ra
2255 ; MIPSR6-N32-NEXT: sh $2, 0($1)
2257 ; MIPSR6-N64-LABEL: ffmuladd:
2258 ; MIPSR6-N64: # %bb.0: # %entry
2259 ; MIPSR6-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffmuladd)))
2260 ; MIPSR6-N64-NEXT: daddu $1, $1, $25
2261 ; MIPSR6-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(ffmuladd)))
2262 ; MIPSR6-N64-NEXT: ld $1, %got_disp(g)($1)
2263 ; MIPSR6-N64-NEXT: lh $2, 0($1)
2264 ; MIPSR6-N64-NEXT: fill.h $w0, $2
2265 ; MIPSR6-N64-NEXT: fexupr.w $w0, $w0
2266 ; MIPSR6-N64-NEXT: copy_s.w $2, $w0[0]
2267 ; MIPSR6-N64-NEXT: mtc1 $2, $f0
2268 ; MIPSR6-N64-NEXT: mul.s $f0, $f0, $f12
2269 ; MIPSR6-N64-NEXT: add.s $f0, $f0, $f13
2270 ; MIPSR6-N64-NEXT: mfc1 $2, $f0
2271 ; MIPSR6-N64-NEXT: fill.w $w0, $2
2272 ; MIPSR6-N64-NEXT: fexdo.h $w0, $w0, $w0
2273 ; MIPSR6-N64-NEXT: copy_u.h $2, $w0[0]
2274 ; MIPSR6-N64-NEXT: jr $ra
2275 ; MIPSR6-N64-NEXT: sh $2, 0($1)
2277 %0 = load i16, ptr @g, align 2
2278 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2280 ; MIPS32-N32: madd.s $f[[F1:[0-9]]], $f13, $f[[F0]], $f12
2281 ; MIPS32-N64: madd.s $f[[F1:[0-9]]], $f13, $f[[F0]], $f12
2283 %fmuladd = call float @llvm.fmuladd.f32(float %1, float %b, float %c)
2284 %2 = call i16 @llvm.convert.to.fp16.f32(float %fmuladd)
2287 store i16 %2, ptr @g, align 2
2292 declare float @llvm.fabs.f32(float %Val)
2294 define void @ffabs() {
2295 ; MIPS32-LABEL: ffabs:
2296 ; MIPS32: # %bb.0: # %entry
2297 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
2298 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
2299 ; MIPS32-NEXT: addu $1, $2, $25
2300 ; MIPS32-NEXT: lw $1, %got(g)($1)
2301 ; MIPS32-NEXT: lh $2, 0($1)
2302 ; MIPS32-NEXT: fill.h $w0, $2
2303 ; MIPS32-NEXT: fexupr.w $w0, $w0
2304 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
2305 ; MIPS32-NEXT: mtc1 $2, $f0
2306 ; MIPS32-NEXT: abs.s $f0, $f0
2307 ; MIPS32-NEXT: mfc1 $2, $f0
2308 ; MIPS32-NEXT: fill.w $w0, $2
2309 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
2310 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
2311 ; MIPS32-NEXT: jr $ra
2312 ; MIPS32-NEXT: sh $2, 0($1)
2314 ; MIPS64-N32-LABEL: ffabs:
2315 ; MIPS64-N32: # %bb.0: # %entry
2316 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffabs)))
2317 ; MIPS64-N32-NEXT: addu $1, $1, $25
2318 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(ffabs)))
2319 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
2320 ; MIPS64-N32-NEXT: lh $2, 0($1)
2321 ; MIPS64-N32-NEXT: fill.h $w0, $2
2322 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
2323 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
2324 ; MIPS64-N32-NEXT: mtc1 $2, $f0
2325 ; MIPS64-N32-NEXT: abs.s $f0, $f0
2326 ; MIPS64-N32-NEXT: mfc1 $2, $f0
2327 ; MIPS64-N32-NEXT: fill.w $w0, $2
2328 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
2329 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
2330 ; MIPS64-N32-NEXT: jr $ra
2331 ; MIPS64-N32-NEXT: sh $2, 0($1)
2333 ; MIPS64-N64-LABEL: ffabs:
2334 ; MIPS64-N64: # %bb.0: # %entry
2335 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffabs)))
2336 ; MIPS64-N64-NEXT: daddu $1, $1, $25
2337 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(ffabs)))
2338 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
2339 ; MIPS64-N64-NEXT: lh $2, 0($1)
2340 ; MIPS64-N64-NEXT: fill.h $w0, $2
2341 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
2342 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
2343 ; MIPS64-N64-NEXT: mtc1 $2, $f0
2344 ; MIPS64-N64-NEXT: abs.s $f0, $f0
2345 ; MIPS64-N64-NEXT: mfc1 $2, $f0
2346 ; MIPS64-N64-NEXT: fill.w $w0, $2
2347 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
2348 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
2349 ; MIPS64-N64-NEXT: jr $ra
2350 ; MIPS64-N64-NEXT: sh $2, 0($1)
2352 %0 = load i16, ptr @g, align 2
2353 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2356 %fabs = call float @llvm.fabs.f32(float %1)
2357 %2 = call i16 @llvm.convert.to.fp16.f32(float %fabs)
2360 store i16 %2, ptr @g, align 2
2365 declare float @llvm.minnum.f32(float %Val, float %b)
2367 define void @fminnum(float %b) {
2368 ; MIPS32-O32-LABEL: fminnum:
2369 ; MIPS32-O32: # %bb.0: # %entry
2370 ; MIPS32-O32-NEXT: lui $2, %hi(_gp_disp)
2371 ; MIPS32-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
2372 ; MIPS32-O32-NEXT: addiu $sp, $sp, -24
2373 ; MIPS32-O32-NEXT: .cfi_def_cfa_offset 24
2374 ; MIPS32-O32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
2375 ; MIPS32-O32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
2376 ; MIPS32-O32-NEXT: .cfi_offset 31, -4
2377 ; MIPS32-O32-NEXT: .cfi_offset 16, -8
2378 ; MIPS32-O32-NEXT: addu $gp, $2, $25
2379 ; MIPS32-O32-NEXT: mov.s $f14, $f12
2380 ; MIPS32-O32-NEXT: lw $16, %got(g)($gp)
2381 ; MIPS32-O32-NEXT: lh $1, 0($16)
2382 ; MIPS32-O32-NEXT: fill.h $w0, $1
2383 ; MIPS32-O32-NEXT: fexupr.w $w0, $w0
2384 ; MIPS32-O32-NEXT: copy_s.w $1, $w0[0]
2385 ; MIPS32-O32-NEXT: lw $25, %call16(fminf)($gp)
2386 ; MIPS32-O32-NEXT: jalr $25
2387 ; MIPS32-O32-NEXT: mtc1 $1, $f12
2388 ; MIPS32-O32-NEXT: mfc1 $1, $f0
2389 ; MIPS32-O32-NEXT: fill.w $w0, $1
2390 ; MIPS32-O32-NEXT: fexdo.h $w0, $w0, $w0
2391 ; MIPS32-O32-NEXT: copy_u.h $1, $w0[0]
2392 ; MIPS32-O32-NEXT: sh $1, 0($16)
2393 ; MIPS32-O32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
2394 ; MIPS32-O32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
2395 ; MIPS32-O32-NEXT: jr $ra
2396 ; MIPS32-O32-NEXT: addiu $sp, $sp, 24
2398 ; MIPS64R5-N32-LABEL: fminnum:
2399 ; MIPS64R5-N32: # %bb.0: # %entry
2400 ; MIPS64R5-N32-NEXT: addiu $sp, $sp, -32
2401 ; MIPS64R5-N32-NEXT: .cfi_def_cfa_offset 32
2402 ; MIPS64R5-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2403 ; MIPS64R5-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2404 ; MIPS64R5-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2405 ; MIPS64R5-N32-NEXT: .cfi_offset 31, -8
2406 ; MIPS64R5-N32-NEXT: .cfi_offset 28, -16
2407 ; MIPS64R5-N32-NEXT: .cfi_offset 16, -24
2408 ; MIPS64R5-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fminnum)))
2409 ; MIPS64R5-N32-NEXT: addu $1, $1, $25
2410 ; MIPS64R5-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fminnum)))
2411 ; MIPS64R5-N32-NEXT: mov.s $f13, $f12
2412 ; MIPS64R5-N32-NEXT: lw $16, %got_disp(g)($gp)
2413 ; MIPS64R5-N32-NEXT: lh $1, 0($16)
2414 ; MIPS64R5-N32-NEXT: fill.h $w0, $1
2415 ; MIPS64R5-N32-NEXT: fexupr.w $w0, $w0
2416 ; MIPS64R5-N32-NEXT: copy_s.w $1, $w0[0]
2417 ; MIPS64R5-N32-NEXT: lw $25, %call16(fminf)($gp)
2418 ; MIPS64R5-N32-NEXT: jalr $25
2419 ; MIPS64R5-N32-NEXT: mtc1 $1, $f12
2420 ; MIPS64R5-N32-NEXT: mfc1 $1, $f0
2421 ; MIPS64R5-N32-NEXT: fill.w $w0, $1
2422 ; MIPS64R5-N32-NEXT: fexdo.h $w0, $w0, $w0
2423 ; MIPS64R5-N32-NEXT: copy_u.h $1, $w0[0]
2424 ; MIPS64R5-N32-NEXT: sh $1, 0($16)
2425 ; MIPS64R5-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2426 ; MIPS64R5-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2427 ; MIPS64R5-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2428 ; MIPS64R5-N32-NEXT: jr $ra
2429 ; MIPS64R5-N32-NEXT: addiu $sp, $sp, 32
2431 ; MIPS64R5-N64-LABEL: fminnum:
2432 ; MIPS64R5-N64: # %bb.0: # %entry
2433 ; MIPS64R5-N64-NEXT: daddiu $sp, $sp, -32
2434 ; MIPS64R5-N64-NEXT: .cfi_def_cfa_offset 32
2435 ; MIPS64R5-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2436 ; MIPS64R5-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2437 ; MIPS64R5-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2438 ; MIPS64R5-N64-NEXT: .cfi_offset 31, -8
2439 ; MIPS64R5-N64-NEXT: .cfi_offset 28, -16
2440 ; MIPS64R5-N64-NEXT: .cfi_offset 16, -24
2441 ; MIPS64R5-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fminnum)))
2442 ; MIPS64R5-N64-NEXT: daddu $1, $1, $25
2443 ; MIPS64R5-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fminnum)))
2444 ; MIPS64R5-N64-NEXT: mov.s $f13, $f12
2445 ; MIPS64R5-N64-NEXT: ld $16, %got_disp(g)($gp)
2446 ; MIPS64R5-N64-NEXT: lh $1, 0($16)
2447 ; MIPS64R5-N64-NEXT: fill.h $w0, $1
2448 ; MIPS64R5-N64-NEXT: fexupr.w $w0, $w0
2449 ; MIPS64R5-N64-NEXT: copy_s.w $1, $w0[0]
2450 ; MIPS64R5-N64-NEXT: ld $25, %call16(fminf)($gp)
2451 ; MIPS64R5-N64-NEXT: jalr $25
2452 ; MIPS64R5-N64-NEXT: mtc1 $1, $f12
2453 ; MIPS64R5-N64-NEXT: mfc1 $1, $f0
2454 ; MIPS64R5-N64-NEXT: fill.w $w0, $1
2455 ; MIPS64R5-N64-NEXT: fexdo.h $w0, $w0, $w0
2456 ; MIPS64R5-N64-NEXT: copy_u.h $1, $w0[0]
2457 ; MIPS64R5-N64-NEXT: sh $1, 0($16)
2458 ; MIPS64R5-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2459 ; MIPS64R5-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2460 ; MIPS64R5-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2461 ; MIPS64R5-N64-NEXT: jr $ra
2462 ; MIPS64R5-N64-NEXT: daddiu $sp, $sp, 32
2464 ; MIPSR6-O32-LABEL: fminnum:
2465 ; MIPSR6-O32: # %bb.0: # %entry
2466 ; MIPSR6-O32-NEXT: lui $2, %hi(_gp_disp)
2467 ; MIPSR6-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
2468 ; MIPSR6-O32-NEXT: addu $1, $2, $25
2469 ; MIPSR6-O32-NEXT: min.s $f0, $f12, $f12
2470 ; MIPSR6-O32-NEXT: lw $1, %got(g)($1)
2471 ; MIPSR6-O32-NEXT: lh $2, 0($1)
2472 ; MIPSR6-O32-NEXT: fill.h $w1, $2
2473 ; MIPSR6-O32-NEXT: fexupr.w $w1, $w1
2474 ; MIPSR6-O32-NEXT: copy_s.w $2, $w1[0]
2475 ; MIPSR6-O32-NEXT: mtc1 $2, $f1
2476 ; MIPSR6-O32-NEXT: min.s $f0, $f1, $f0
2477 ; MIPSR6-O32-NEXT: mfc1 $2, $f0
2478 ; MIPSR6-O32-NEXT: fill.w $w0, $2
2479 ; MIPSR6-O32-NEXT: fexdo.h $w0, $w0, $w0
2480 ; MIPSR6-O32-NEXT: copy_u.h $2, $w0[0]
2481 ; MIPSR6-O32-NEXT: jr $ra
2482 ; MIPSR6-O32-NEXT: sh $2, 0($1)
2484 ; MIPSR6-N32-LABEL: fminnum:
2485 ; MIPSR6-N32: # %bb.0: # %entry
2486 ; MIPSR6-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fminnum)))
2487 ; MIPSR6-N32-NEXT: addu $1, $1, $25
2488 ; MIPSR6-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fminnum)))
2489 ; MIPSR6-N32-NEXT: min.s $f0, $f12, $f12
2490 ; MIPSR6-N32-NEXT: lw $1, %got_disp(g)($1)
2491 ; MIPSR6-N32-NEXT: lh $2, 0($1)
2492 ; MIPSR6-N32-NEXT: fill.h $w1, $2
2493 ; MIPSR6-N32-NEXT: fexupr.w $w1, $w1
2494 ; MIPSR6-N32-NEXT: copy_s.w $2, $w1[0]
2495 ; MIPSR6-N32-NEXT: mtc1 $2, $f1
2496 ; MIPSR6-N32-NEXT: min.s $f0, $f1, $f0
2497 ; MIPSR6-N32-NEXT: mfc1 $2, $f0
2498 ; MIPSR6-N32-NEXT: fill.w $w0, $2
2499 ; MIPSR6-N32-NEXT: fexdo.h $w0, $w0, $w0
2500 ; MIPSR6-N32-NEXT: copy_u.h $2, $w0[0]
2501 ; MIPSR6-N32-NEXT: jr $ra
2502 ; MIPSR6-N32-NEXT: sh $2, 0($1)
2504 ; MIPSR6-N64-LABEL: fminnum:
2505 ; MIPSR6-N64: # %bb.0: # %entry
2506 ; MIPSR6-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fminnum)))
2507 ; MIPSR6-N64-NEXT: daddu $1, $1, $25
2508 ; MIPSR6-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fminnum)))
2509 ; MIPSR6-N64-NEXT: min.s $f0, $f12, $f12
2510 ; MIPSR6-N64-NEXT: ld $1, %got_disp(g)($1)
2511 ; MIPSR6-N64-NEXT: lh $2, 0($1)
2512 ; MIPSR6-N64-NEXT: fill.h $w1, $2
2513 ; MIPSR6-N64-NEXT: fexupr.w $w1, $w1
2514 ; MIPSR6-N64-NEXT: copy_s.w $2, $w1[0]
2515 ; MIPSR6-N64-NEXT: mtc1 $2, $f1
2516 ; MIPSR6-N64-NEXT: min.s $f0, $f1, $f0
2517 ; MIPSR6-N64-NEXT: mfc1 $2, $f0
2518 ; MIPSR6-N64-NEXT: fill.w $w0, $2
2519 ; MIPSR6-N64-NEXT: fexdo.h $w0, $w0, $w0
2520 ; MIPSR6-N64-NEXT: copy_u.h $2, $w0[0]
2521 ; MIPSR6-N64-NEXT: jr $ra
2522 ; MIPSR6-N64-NEXT: sh $2, 0($1)
2524 %0 = load i16, ptr @g, align 2
2525 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2528 %minnum = call float @llvm.minnum.f32(float %1, float %b)
2529 %2 = call i16 @llvm.convert.to.fp16.f32(float %minnum)
2532 store i16 %2, ptr @g, align 2
2537 declare float @llvm.maxnum.f32(float %Val, float %b)
2539 define void @fmaxnum(float %b) {
2540 ; MIPS32-O32-LABEL: fmaxnum:
2541 ; MIPS32-O32: # %bb.0: # %entry
2542 ; MIPS32-O32-NEXT: lui $2, %hi(_gp_disp)
2543 ; MIPS32-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
2544 ; MIPS32-O32-NEXT: addiu $sp, $sp, -24
2545 ; MIPS32-O32-NEXT: .cfi_def_cfa_offset 24
2546 ; MIPS32-O32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
2547 ; MIPS32-O32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
2548 ; MIPS32-O32-NEXT: .cfi_offset 31, -4
2549 ; MIPS32-O32-NEXT: .cfi_offset 16, -8
2550 ; MIPS32-O32-NEXT: addu $gp, $2, $25
2551 ; MIPS32-O32-NEXT: mov.s $f14, $f12
2552 ; MIPS32-O32-NEXT: lw $16, %got(g)($gp)
2553 ; MIPS32-O32-NEXT: lh $1, 0($16)
2554 ; MIPS32-O32-NEXT: fill.h $w0, $1
2555 ; MIPS32-O32-NEXT: fexupr.w $w0, $w0
2556 ; MIPS32-O32-NEXT: copy_s.w $1, $w0[0]
2557 ; MIPS32-O32-NEXT: lw $25, %call16(fmaxf)($gp)
2558 ; MIPS32-O32-NEXT: jalr $25
2559 ; MIPS32-O32-NEXT: mtc1 $1, $f12
2560 ; MIPS32-O32-NEXT: mfc1 $1, $f0
2561 ; MIPS32-O32-NEXT: fill.w $w0, $1
2562 ; MIPS32-O32-NEXT: fexdo.h $w0, $w0, $w0
2563 ; MIPS32-O32-NEXT: copy_u.h $1, $w0[0]
2564 ; MIPS32-O32-NEXT: sh $1, 0($16)
2565 ; MIPS32-O32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
2566 ; MIPS32-O32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
2567 ; MIPS32-O32-NEXT: jr $ra
2568 ; MIPS32-O32-NEXT: addiu $sp, $sp, 24
2570 ; MIPS64R5-N32-LABEL: fmaxnum:
2571 ; MIPS64R5-N32: # %bb.0: # %entry
2572 ; MIPS64R5-N32-NEXT: addiu $sp, $sp, -32
2573 ; MIPS64R5-N32-NEXT: .cfi_def_cfa_offset 32
2574 ; MIPS64R5-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2575 ; MIPS64R5-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2576 ; MIPS64R5-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2577 ; MIPS64R5-N32-NEXT: .cfi_offset 31, -8
2578 ; MIPS64R5-N32-NEXT: .cfi_offset 28, -16
2579 ; MIPS64R5-N32-NEXT: .cfi_offset 16, -24
2580 ; MIPS64R5-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fmaxnum)))
2581 ; MIPS64R5-N32-NEXT: addu $1, $1, $25
2582 ; MIPS64R5-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fmaxnum)))
2583 ; MIPS64R5-N32-NEXT: mov.s $f13, $f12
2584 ; MIPS64R5-N32-NEXT: lw $16, %got_disp(g)($gp)
2585 ; MIPS64R5-N32-NEXT: lh $1, 0($16)
2586 ; MIPS64R5-N32-NEXT: fill.h $w0, $1
2587 ; MIPS64R5-N32-NEXT: fexupr.w $w0, $w0
2588 ; MIPS64R5-N32-NEXT: copy_s.w $1, $w0[0]
2589 ; MIPS64R5-N32-NEXT: lw $25, %call16(fmaxf)($gp)
2590 ; MIPS64R5-N32-NEXT: jalr $25
2591 ; MIPS64R5-N32-NEXT: mtc1 $1, $f12
2592 ; MIPS64R5-N32-NEXT: mfc1 $1, $f0
2593 ; MIPS64R5-N32-NEXT: fill.w $w0, $1
2594 ; MIPS64R5-N32-NEXT: fexdo.h $w0, $w0, $w0
2595 ; MIPS64R5-N32-NEXT: copy_u.h $1, $w0[0]
2596 ; MIPS64R5-N32-NEXT: sh $1, 0($16)
2597 ; MIPS64R5-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2598 ; MIPS64R5-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2599 ; MIPS64R5-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2600 ; MIPS64R5-N32-NEXT: jr $ra
2601 ; MIPS64R5-N32-NEXT: addiu $sp, $sp, 32
2603 ; MIPS64R5-N64-LABEL: fmaxnum:
2604 ; MIPS64R5-N64: # %bb.0: # %entry
2605 ; MIPS64R5-N64-NEXT: daddiu $sp, $sp, -32
2606 ; MIPS64R5-N64-NEXT: .cfi_def_cfa_offset 32
2607 ; MIPS64R5-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2608 ; MIPS64R5-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2609 ; MIPS64R5-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2610 ; MIPS64R5-N64-NEXT: .cfi_offset 31, -8
2611 ; MIPS64R5-N64-NEXT: .cfi_offset 28, -16
2612 ; MIPS64R5-N64-NEXT: .cfi_offset 16, -24
2613 ; MIPS64R5-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fmaxnum)))
2614 ; MIPS64R5-N64-NEXT: daddu $1, $1, $25
2615 ; MIPS64R5-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fmaxnum)))
2616 ; MIPS64R5-N64-NEXT: mov.s $f13, $f12
2617 ; MIPS64R5-N64-NEXT: ld $16, %got_disp(g)($gp)
2618 ; MIPS64R5-N64-NEXT: lh $1, 0($16)
2619 ; MIPS64R5-N64-NEXT: fill.h $w0, $1
2620 ; MIPS64R5-N64-NEXT: fexupr.w $w0, $w0
2621 ; MIPS64R5-N64-NEXT: copy_s.w $1, $w0[0]
2622 ; MIPS64R5-N64-NEXT: ld $25, %call16(fmaxf)($gp)
2623 ; MIPS64R5-N64-NEXT: jalr $25
2624 ; MIPS64R5-N64-NEXT: mtc1 $1, $f12
2625 ; MIPS64R5-N64-NEXT: mfc1 $1, $f0
2626 ; MIPS64R5-N64-NEXT: fill.w $w0, $1
2627 ; MIPS64R5-N64-NEXT: fexdo.h $w0, $w0, $w0
2628 ; MIPS64R5-N64-NEXT: copy_u.h $1, $w0[0]
2629 ; MIPS64R5-N64-NEXT: sh $1, 0($16)
2630 ; MIPS64R5-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2631 ; MIPS64R5-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2632 ; MIPS64R5-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2633 ; MIPS64R5-N64-NEXT: jr $ra
2634 ; MIPS64R5-N64-NEXT: daddiu $sp, $sp, 32
2636 ; MIPSR6-O32-LABEL: fmaxnum:
2637 ; MIPSR6-O32: # %bb.0: # %entry
2638 ; MIPSR6-O32-NEXT: lui $2, %hi(_gp_disp)
2639 ; MIPSR6-O32-NEXT: addiu $2, $2, %lo(_gp_disp)
2640 ; MIPSR6-O32-NEXT: addu $1, $2, $25
2641 ; MIPSR6-O32-NEXT: min.s $f0, $f12, $f12
2642 ; MIPSR6-O32-NEXT: lw $1, %got(g)($1)
2643 ; MIPSR6-O32-NEXT: lh $2, 0($1)
2644 ; MIPSR6-O32-NEXT: fill.h $w1, $2
2645 ; MIPSR6-O32-NEXT: fexupr.w $w1, $w1
2646 ; MIPSR6-O32-NEXT: copy_s.w $2, $w1[0]
2647 ; MIPSR6-O32-NEXT: mtc1 $2, $f1
2648 ; MIPSR6-O32-NEXT: max.s $f0, $f1, $f0
2649 ; MIPSR6-O32-NEXT: mfc1 $2, $f0
2650 ; MIPSR6-O32-NEXT: fill.w $w0, $2
2651 ; MIPSR6-O32-NEXT: fexdo.h $w0, $w0, $w0
2652 ; MIPSR6-O32-NEXT: copy_u.h $2, $w0[0]
2653 ; MIPSR6-O32-NEXT: jr $ra
2654 ; MIPSR6-O32-NEXT: sh $2, 0($1)
2656 ; MIPSR6-N32-LABEL: fmaxnum:
2657 ; MIPSR6-N32: # %bb.0: # %entry
2658 ; MIPSR6-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fmaxnum)))
2659 ; MIPSR6-N32-NEXT: addu $1, $1, $25
2660 ; MIPSR6-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fmaxnum)))
2661 ; MIPSR6-N32-NEXT: min.s $f0, $f12, $f12
2662 ; MIPSR6-N32-NEXT: lw $1, %got_disp(g)($1)
2663 ; MIPSR6-N32-NEXT: lh $2, 0($1)
2664 ; MIPSR6-N32-NEXT: fill.h $w1, $2
2665 ; MIPSR6-N32-NEXT: fexupr.w $w1, $w1
2666 ; MIPSR6-N32-NEXT: copy_s.w $2, $w1[0]
2667 ; MIPSR6-N32-NEXT: mtc1 $2, $f1
2668 ; MIPSR6-N32-NEXT: max.s $f0, $f1, $f0
2669 ; MIPSR6-N32-NEXT: mfc1 $2, $f0
2670 ; MIPSR6-N32-NEXT: fill.w $w0, $2
2671 ; MIPSR6-N32-NEXT: fexdo.h $w0, $w0, $w0
2672 ; MIPSR6-N32-NEXT: copy_u.h $2, $w0[0]
2673 ; MIPSR6-N32-NEXT: jr $ra
2674 ; MIPSR6-N32-NEXT: sh $2, 0($1)
2676 ; MIPSR6-N64-LABEL: fmaxnum:
2677 ; MIPSR6-N64: # %bb.0: # %entry
2678 ; MIPSR6-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fmaxnum)))
2679 ; MIPSR6-N64-NEXT: daddu $1, $1, $25
2680 ; MIPSR6-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fmaxnum)))
2681 ; MIPSR6-N64-NEXT: min.s $f0, $f12, $f12
2682 ; MIPSR6-N64-NEXT: ld $1, %got_disp(g)($1)
2683 ; MIPSR6-N64-NEXT: lh $2, 0($1)
2684 ; MIPSR6-N64-NEXT: fill.h $w1, $2
2685 ; MIPSR6-N64-NEXT: fexupr.w $w1, $w1
2686 ; MIPSR6-N64-NEXT: copy_s.w $2, $w1[0]
2687 ; MIPSR6-N64-NEXT: mtc1 $2, $f1
2688 ; MIPSR6-N64-NEXT: max.s $f0, $f1, $f0
2689 ; MIPSR6-N64-NEXT: mfc1 $2, $f0
2690 ; MIPSR6-N64-NEXT: fill.w $w0, $2
2691 ; MIPSR6-N64-NEXT: fexdo.h $w0, $w0, $w0
2692 ; MIPSR6-N64-NEXT: copy_u.h $2, $w0[0]
2693 ; MIPSR6-N64-NEXT: jr $ra
2694 ; MIPSR6-N64-NEXT: sh $2, 0($1)
2696 %0 = load i16, ptr @g, align 2
2697 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2700 %maxnum = call float @llvm.maxnum.f32(float %1, float %b)
2701 %2 = call i16 @llvm.convert.to.fp16.f32(float %maxnum)
2704 store i16 %2, ptr @g, align 2
2709 ; This expansion of fcopysign could be done without converting f16 to float.
2711 declare float @llvm.copysign.f32(float %Val, float %b)
2713 define void @fcopysign(float %b) {
2714 ; MIPS32-LABEL: fcopysign:
2715 ; MIPS32: # %bb.0: # %entry
2716 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
2717 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
2718 ; MIPS32-NEXT: addu $1, $2, $25
2719 ; MIPS32-NEXT: lw $1, %got(g)($1)
2720 ; MIPS32-NEXT: lh $2, 0($1)
2721 ; MIPS32-NEXT: fill.h $w0, $2
2722 ; MIPS32-NEXT: fexupr.w $w0, $w0
2723 ; MIPS32-NEXT: copy_s.w $2, $w0[0]
2724 ; MIPS32-NEXT: mfc1 $3, $f12
2725 ; MIPS32-NEXT: ext $3, $3, 31, 1
2726 ; MIPS32-NEXT: ins $2, $3, 31, 1
2727 ; MIPS32-NEXT: fill.w $w0, $2
2728 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
2729 ; MIPS32-NEXT: copy_u.h $2, $w0[0]
2730 ; MIPS32-NEXT: jr $ra
2731 ; MIPS32-NEXT: sh $2, 0($1)
2733 ; MIPS64-N32-LABEL: fcopysign:
2734 ; MIPS64-N32: # %bb.0: # %entry
2735 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fcopysign)))
2736 ; MIPS64-N32-NEXT: addu $1, $1, $25
2737 ; MIPS64-N32-NEXT: addiu $1, $1, %lo(%neg(%gp_rel(fcopysign)))
2738 ; MIPS64-N32-NEXT: lw $1, %got_disp(g)($1)
2739 ; MIPS64-N32-NEXT: lh $2, 0($1)
2740 ; MIPS64-N32-NEXT: fill.h $w0, $2
2741 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
2742 ; MIPS64-N32-NEXT: copy_s.w $2, $w0[0]
2743 ; MIPS64-N32-NEXT: mfc1 $3, $f12
2744 ; MIPS64-N32-NEXT: ext $3, $3, 31, 1
2745 ; MIPS64-N32-NEXT: ins $2, $3, 31, 1
2746 ; MIPS64-N32-NEXT: fill.w $w0, $2
2747 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
2748 ; MIPS64-N32-NEXT: copy_u.h $2, $w0[0]
2749 ; MIPS64-N32-NEXT: jr $ra
2750 ; MIPS64-N32-NEXT: sh $2, 0($1)
2752 ; MIPS64-N64-LABEL: fcopysign:
2753 ; MIPS64-N64: # %bb.0: # %entry
2754 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fcopysign)))
2755 ; MIPS64-N64-NEXT: daddu $1, $1, $25
2756 ; MIPS64-N64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(fcopysign)))
2757 ; MIPS64-N64-NEXT: ld $1, %got_disp(g)($1)
2758 ; MIPS64-N64-NEXT: lh $2, 0($1)
2759 ; MIPS64-N64-NEXT: fill.h $w0, $2
2760 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
2761 ; MIPS64-N64-NEXT: copy_s.w $2, $w0[0]
2762 ; MIPS64-N64-NEXT: mfc1 $3, $f12
2763 ; MIPS64-N64-NEXT: ext $3, $3, 31, 1
2764 ; MIPS64-N64-NEXT: ins $2, $3, 31, 1
2765 ; MIPS64-N64-NEXT: fill.w $w0, $2
2766 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
2767 ; MIPS64-N64-NEXT: copy_u.h $2, $w0[0]
2768 ; MIPS64-N64-NEXT: jr $ra
2769 ; MIPS64-N64-NEXT: sh $2, 0($1)
2771 %0 = load i16, ptr @g, align 2
2772 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2775 %copysign = call float @llvm.copysign.f32(float %1, float %b)
2776 %2 = call i16 @llvm.convert.to.fp16.f32(float %copysign)
2779 store i16 %2, ptr @g, align 2
2784 declare float @llvm.floor.f32(float %Val)
2786 define void @ffloor() {
2787 ; MIPS32-LABEL: ffloor:
2788 ; MIPS32: # %bb.0: # %entry
2789 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
2790 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
2791 ; MIPS32-NEXT: addiu $sp, $sp, -24
2792 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
2793 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
2794 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
2795 ; MIPS32-NEXT: .cfi_offset 31, -4
2796 ; MIPS32-NEXT: .cfi_offset 16, -8
2797 ; MIPS32-NEXT: addu $gp, $2, $25
2798 ; MIPS32-NEXT: lw $16, %got(g)($gp)
2799 ; MIPS32-NEXT: lh $1, 0($16)
2800 ; MIPS32-NEXT: fill.h $w0, $1
2801 ; MIPS32-NEXT: fexupr.w $w0, $w0
2802 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
2803 ; MIPS32-NEXT: lw $25, %call16(floorf)($gp)
2804 ; MIPS32-NEXT: jalr $25
2805 ; MIPS32-NEXT: mtc1 $1, $f12
2806 ; MIPS32-NEXT: mfc1 $1, $f0
2807 ; MIPS32-NEXT: fill.w $w0, $1
2808 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
2809 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
2810 ; MIPS32-NEXT: sh $1, 0($16)
2811 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
2812 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
2813 ; MIPS32-NEXT: jr $ra
2814 ; MIPS32-NEXT: addiu $sp, $sp, 24
2816 ; MIPS64-N32-LABEL: ffloor:
2817 ; MIPS64-N32: # %bb.0: # %entry
2818 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
2819 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
2820 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2821 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2822 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2823 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
2824 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
2825 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
2826 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ffloor)))
2827 ; MIPS64-N32-NEXT: addu $1, $1, $25
2828 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(ffloor)))
2829 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
2830 ; MIPS64-N32-NEXT: lh $1, 0($16)
2831 ; MIPS64-N32-NEXT: fill.h $w0, $1
2832 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
2833 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
2834 ; MIPS64-N32-NEXT: lw $25, %call16(floorf)($gp)
2835 ; MIPS64-N32-NEXT: jalr $25
2836 ; MIPS64-N32-NEXT: mtc1 $1, $f12
2837 ; MIPS64-N32-NEXT: mfc1 $1, $f0
2838 ; MIPS64-N32-NEXT: fill.w $w0, $1
2839 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
2840 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
2841 ; MIPS64-N32-NEXT: sh $1, 0($16)
2842 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2843 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2844 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2845 ; MIPS64-N32-NEXT: jr $ra
2846 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
2848 ; MIPS64-N64-LABEL: ffloor:
2849 ; MIPS64-N64: # %bb.0: # %entry
2850 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
2851 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
2852 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2853 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2854 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2855 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
2856 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
2857 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
2858 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ffloor)))
2859 ; MIPS64-N64-NEXT: daddu $1, $1, $25
2860 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(ffloor)))
2861 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
2862 ; MIPS64-N64-NEXT: lh $1, 0($16)
2863 ; MIPS64-N64-NEXT: fill.h $w0, $1
2864 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
2865 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
2866 ; MIPS64-N64-NEXT: ld $25, %call16(floorf)($gp)
2867 ; MIPS64-N64-NEXT: jalr $25
2868 ; MIPS64-N64-NEXT: mtc1 $1, $f12
2869 ; MIPS64-N64-NEXT: mfc1 $1, $f0
2870 ; MIPS64-N64-NEXT: fill.w $w0, $1
2871 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
2872 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
2873 ; MIPS64-N64-NEXT: sh $1, 0($16)
2874 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2875 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2876 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2877 ; MIPS64-N64-NEXT: jr $ra
2878 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
2880 %0 = load i16, ptr @g, align 2
2881 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2884 %floor = call float @llvm.floor.f32(float %1)
2885 %2 = call i16 @llvm.convert.to.fp16.f32(float %floor)
2888 store i16 %2, ptr @g, align 2
2893 declare float @llvm.ceil.f32(float %Val)
2895 define void @fceil() {
2896 ; MIPS32-LABEL: fceil:
2897 ; MIPS32: # %bb.0: # %entry
2898 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
2899 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
2900 ; MIPS32-NEXT: addiu $sp, $sp, -24
2901 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
2902 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
2903 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
2904 ; MIPS32-NEXT: .cfi_offset 31, -4
2905 ; MIPS32-NEXT: .cfi_offset 16, -8
2906 ; MIPS32-NEXT: addu $gp, $2, $25
2907 ; MIPS32-NEXT: lw $16, %got(g)($gp)
2908 ; MIPS32-NEXT: lh $1, 0($16)
2909 ; MIPS32-NEXT: fill.h $w0, $1
2910 ; MIPS32-NEXT: fexupr.w $w0, $w0
2911 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
2912 ; MIPS32-NEXT: lw $25, %call16(ceilf)($gp)
2913 ; MIPS32-NEXT: jalr $25
2914 ; MIPS32-NEXT: mtc1 $1, $f12
2915 ; MIPS32-NEXT: mfc1 $1, $f0
2916 ; MIPS32-NEXT: fill.w $w0, $1
2917 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
2918 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
2919 ; MIPS32-NEXT: sh $1, 0($16)
2920 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
2921 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
2922 ; MIPS32-NEXT: jr $ra
2923 ; MIPS32-NEXT: addiu $sp, $sp, 24
2925 ; MIPS64-N32-LABEL: fceil:
2926 ; MIPS64-N32: # %bb.0: # %entry
2927 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
2928 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
2929 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2930 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2931 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2932 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
2933 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
2934 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
2935 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fceil)))
2936 ; MIPS64-N32-NEXT: addu $1, $1, $25
2937 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fceil)))
2938 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
2939 ; MIPS64-N32-NEXT: lh $1, 0($16)
2940 ; MIPS64-N32-NEXT: fill.h $w0, $1
2941 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
2942 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
2943 ; MIPS64-N32-NEXT: lw $25, %call16(ceilf)($gp)
2944 ; MIPS64-N32-NEXT: jalr $25
2945 ; MIPS64-N32-NEXT: mtc1 $1, $f12
2946 ; MIPS64-N32-NEXT: mfc1 $1, $f0
2947 ; MIPS64-N32-NEXT: fill.w $w0, $1
2948 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
2949 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
2950 ; MIPS64-N32-NEXT: sh $1, 0($16)
2951 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2952 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2953 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2954 ; MIPS64-N32-NEXT: jr $ra
2955 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
2957 ; MIPS64-N64-LABEL: fceil:
2958 ; MIPS64-N64: # %bb.0: # %entry
2959 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
2960 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
2961 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
2962 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
2963 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
2964 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
2965 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
2966 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
2967 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fceil)))
2968 ; MIPS64-N64-NEXT: daddu $1, $1, $25
2969 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fceil)))
2970 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
2971 ; MIPS64-N64-NEXT: lh $1, 0($16)
2972 ; MIPS64-N64-NEXT: fill.h $w0, $1
2973 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
2974 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
2975 ; MIPS64-N64-NEXT: ld $25, %call16(ceilf)($gp)
2976 ; MIPS64-N64-NEXT: jalr $25
2977 ; MIPS64-N64-NEXT: mtc1 $1, $f12
2978 ; MIPS64-N64-NEXT: mfc1 $1, $f0
2979 ; MIPS64-N64-NEXT: fill.w $w0, $1
2980 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
2981 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
2982 ; MIPS64-N64-NEXT: sh $1, 0($16)
2983 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
2984 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
2985 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
2986 ; MIPS64-N64-NEXT: jr $ra
2987 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
2989 %0 = load i16, ptr @g, align 2
2990 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
2993 %ceil = call float @llvm.ceil.f32(float %1)
2994 %2 = call i16 @llvm.convert.to.fp16.f32(float %ceil)
2997 store i16 %2, ptr @g, align 2
3002 declare float @llvm.trunc.f32(float %Val)
3004 define void @ftrunc() {
3005 ; MIPS32-LABEL: ftrunc:
3006 ; MIPS32: # %bb.0: # %entry
3007 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
3008 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
3009 ; MIPS32-NEXT: addiu $sp, $sp, -24
3010 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
3011 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
3012 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
3013 ; MIPS32-NEXT: .cfi_offset 31, -4
3014 ; MIPS32-NEXT: .cfi_offset 16, -8
3015 ; MIPS32-NEXT: addu $gp, $2, $25
3016 ; MIPS32-NEXT: lw $16, %got(g)($gp)
3017 ; MIPS32-NEXT: lh $1, 0($16)
3018 ; MIPS32-NEXT: fill.h $w0, $1
3019 ; MIPS32-NEXT: fexupr.w $w0, $w0
3020 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
3021 ; MIPS32-NEXT: lw $25, %call16(truncf)($gp)
3022 ; MIPS32-NEXT: jalr $25
3023 ; MIPS32-NEXT: mtc1 $1, $f12
3024 ; MIPS32-NEXT: mfc1 $1, $f0
3025 ; MIPS32-NEXT: fill.w $w0, $1
3026 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
3027 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
3028 ; MIPS32-NEXT: sh $1, 0($16)
3029 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
3030 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
3031 ; MIPS32-NEXT: jr $ra
3032 ; MIPS32-NEXT: addiu $sp, $sp, 24
3034 ; MIPS64-N32-LABEL: ftrunc:
3035 ; MIPS64-N32: # %bb.0: # %entry
3036 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
3037 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
3038 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3039 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3040 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3041 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
3042 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
3043 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
3044 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(ftrunc)))
3045 ; MIPS64-N32-NEXT: addu $1, $1, $25
3046 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(ftrunc)))
3047 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
3048 ; MIPS64-N32-NEXT: lh $1, 0($16)
3049 ; MIPS64-N32-NEXT: fill.h $w0, $1
3050 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
3051 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
3052 ; MIPS64-N32-NEXT: lw $25, %call16(truncf)($gp)
3053 ; MIPS64-N32-NEXT: jalr $25
3054 ; MIPS64-N32-NEXT: mtc1 $1, $f12
3055 ; MIPS64-N32-NEXT: mfc1 $1, $f0
3056 ; MIPS64-N32-NEXT: fill.w $w0, $1
3057 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
3058 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
3059 ; MIPS64-N32-NEXT: sh $1, 0($16)
3060 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3061 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3062 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3063 ; MIPS64-N32-NEXT: jr $ra
3064 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
3066 ; MIPS64-N64-LABEL: ftrunc:
3067 ; MIPS64-N64: # %bb.0: # %entry
3068 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
3069 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
3070 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3071 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3072 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3073 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
3074 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
3075 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
3076 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(ftrunc)))
3077 ; MIPS64-N64-NEXT: daddu $1, $1, $25
3078 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(ftrunc)))
3079 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
3080 ; MIPS64-N64-NEXT: lh $1, 0($16)
3081 ; MIPS64-N64-NEXT: fill.h $w0, $1
3082 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
3083 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
3084 ; MIPS64-N64-NEXT: ld $25, %call16(truncf)($gp)
3085 ; MIPS64-N64-NEXT: jalr $25
3086 ; MIPS64-N64-NEXT: mtc1 $1, $f12
3087 ; MIPS64-N64-NEXT: mfc1 $1, $f0
3088 ; MIPS64-N64-NEXT: fill.w $w0, $1
3089 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
3090 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
3091 ; MIPS64-N64-NEXT: sh $1, 0($16)
3092 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3093 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3094 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3095 ; MIPS64-N64-NEXT: jr $ra
3096 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
3098 %0 = load i16, ptr @g, align 2
3099 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
3102 %trunc = call float @llvm.trunc.f32(float %1)
3103 %2 = call i16 @llvm.convert.to.fp16.f32(float %trunc)
3106 store i16 %2, ptr @g, align 2
3111 declare float @llvm.rint.f32(float %Val)
3113 define void @frint() {
3114 ; MIPS32-LABEL: frint:
3115 ; MIPS32: # %bb.0: # %entry
3116 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
3117 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
3118 ; MIPS32-NEXT: addiu $sp, $sp, -24
3119 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
3120 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
3121 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
3122 ; MIPS32-NEXT: .cfi_offset 31, -4
3123 ; MIPS32-NEXT: .cfi_offset 16, -8
3124 ; MIPS32-NEXT: addu $gp, $2, $25
3125 ; MIPS32-NEXT: lw $16, %got(g)($gp)
3126 ; MIPS32-NEXT: lh $1, 0($16)
3127 ; MIPS32-NEXT: fill.h $w0, $1
3128 ; MIPS32-NEXT: fexupr.w $w0, $w0
3129 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
3130 ; MIPS32-NEXT: lw $25, %call16(rintf)($gp)
3131 ; MIPS32-NEXT: jalr $25
3132 ; MIPS32-NEXT: mtc1 $1, $f12
3133 ; MIPS32-NEXT: mfc1 $1, $f0
3134 ; MIPS32-NEXT: fill.w $w0, $1
3135 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
3136 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
3137 ; MIPS32-NEXT: sh $1, 0($16)
3138 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
3139 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
3140 ; MIPS32-NEXT: jr $ra
3141 ; MIPS32-NEXT: addiu $sp, $sp, 24
3143 ; MIPS64-N32-LABEL: frint:
3144 ; MIPS64-N32: # %bb.0: # %entry
3145 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
3146 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
3147 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3148 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3149 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3150 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
3151 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
3152 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
3153 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(frint)))
3154 ; MIPS64-N32-NEXT: addu $1, $1, $25
3155 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(frint)))
3156 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
3157 ; MIPS64-N32-NEXT: lh $1, 0($16)
3158 ; MIPS64-N32-NEXT: fill.h $w0, $1
3159 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
3160 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
3161 ; MIPS64-N32-NEXT: lw $25, %call16(rintf)($gp)
3162 ; MIPS64-N32-NEXT: jalr $25
3163 ; MIPS64-N32-NEXT: mtc1 $1, $f12
3164 ; MIPS64-N32-NEXT: mfc1 $1, $f0
3165 ; MIPS64-N32-NEXT: fill.w $w0, $1
3166 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
3167 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
3168 ; MIPS64-N32-NEXT: sh $1, 0($16)
3169 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3170 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3171 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3172 ; MIPS64-N32-NEXT: jr $ra
3173 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
3175 ; MIPS64-N64-LABEL: frint:
3176 ; MIPS64-N64: # %bb.0: # %entry
3177 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
3178 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
3179 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3180 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3181 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3182 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
3183 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
3184 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
3185 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(frint)))
3186 ; MIPS64-N64-NEXT: daddu $1, $1, $25
3187 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(frint)))
3188 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
3189 ; MIPS64-N64-NEXT: lh $1, 0($16)
3190 ; MIPS64-N64-NEXT: fill.h $w0, $1
3191 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
3192 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
3193 ; MIPS64-N64-NEXT: ld $25, %call16(rintf)($gp)
3194 ; MIPS64-N64-NEXT: jalr $25
3195 ; MIPS64-N64-NEXT: mtc1 $1, $f12
3196 ; MIPS64-N64-NEXT: mfc1 $1, $f0
3197 ; MIPS64-N64-NEXT: fill.w $w0, $1
3198 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
3199 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
3200 ; MIPS64-N64-NEXT: sh $1, 0($16)
3201 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3202 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3203 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3204 ; MIPS64-N64-NEXT: jr $ra
3205 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
3207 %0 = load i16, ptr @g, align 2
3208 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
3210 %rint = call float @llvm.rint.f32(float %1)
3211 %2 = call i16 @llvm.convert.to.fp16.f32(float %rint)
3213 store i16 %2, ptr @g, align 2
3218 declare float @llvm.nearbyint.f32(float %Val)
3220 define void @fnearbyint() {
3221 ; MIPS32-LABEL: fnearbyint:
3222 ; MIPS32: # %bb.0: # %entry
3223 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
3224 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
3225 ; MIPS32-NEXT: addiu $sp, $sp, -24
3226 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
3227 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
3228 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
3229 ; MIPS32-NEXT: .cfi_offset 31, -4
3230 ; MIPS32-NEXT: .cfi_offset 16, -8
3231 ; MIPS32-NEXT: addu $gp, $2, $25
3232 ; MIPS32-NEXT: lw $16, %got(g)($gp)
3233 ; MIPS32-NEXT: lh $1, 0($16)
3234 ; MIPS32-NEXT: fill.h $w0, $1
3235 ; MIPS32-NEXT: fexupr.w $w0, $w0
3236 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
3237 ; MIPS32-NEXT: lw $25, %call16(nearbyintf)($gp)
3238 ; MIPS32-NEXT: jalr $25
3239 ; MIPS32-NEXT: mtc1 $1, $f12
3240 ; MIPS32-NEXT: mfc1 $1, $f0
3241 ; MIPS32-NEXT: fill.w $w0, $1
3242 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
3243 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
3244 ; MIPS32-NEXT: sh $1, 0($16)
3245 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
3246 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
3247 ; MIPS32-NEXT: jr $ra
3248 ; MIPS32-NEXT: addiu $sp, $sp, 24
3250 ; MIPS64-N32-LABEL: fnearbyint:
3251 ; MIPS64-N32: # %bb.0: # %entry
3252 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
3253 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
3254 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3255 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3256 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3257 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
3258 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
3259 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
3260 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fnearbyint)))
3261 ; MIPS64-N32-NEXT: addu $1, $1, $25
3262 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fnearbyint)))
3263 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
3264 ; MIPS64-N32-NEXT: lh $1, 0($16)
3265 ; MIPS64-N32-NEXT: fill.h $w0, $1
3266 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
3267 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
3268 ; MIPS64-N32-NEXT: lw $25, %call16(nearbyintf)($gp)
3269 ; MIPS64-N32-NEXT: jalr $25
3270 ; MIPS64-N32-NEXT: mtc1 $1, $f12
3271 ; MIPS64-N32-NEXT: mfc1 $1, $f0
3272 ; MIPS64-N32-NEXT: fill.w $w0, $1
3273 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
3274 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
3275 ; MIPS64-N32-NEXT: sh $1, 0($16)
3276 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3277 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3278 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3279 ; MIPS64-N32-NEXT: jr $ra
3280 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
3282 ; MIPS64-N64-LABEL: fnearbyint:
3283 ; MIPS64-N64: # %bb.0: # %entry
3284 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
3285 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
3286 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3287 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3288 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3289 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
3290 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
3291 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
3292 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fnearbyint)))
3293 ; MIPS64-N64-NEXT: daddu $1, $1, $25
3294 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fnearbyint)))
3295 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
3296 ; MIPS64-N64-NEXT: lh $1, 0($16)
3297 ; MIPS64-N64-NEXT: fill.h $w0, $1
3298 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
3299 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
3300 ; MIPS64-N64-NEXT: ld $25, %call16(nearbyintf)($gp)
3301 ; MIPS64-N64-NEXT: jalr $25
3302 ; MIPS64-N64-NEXT: mtc1 $1, $f12
3303 ; MIPS64-N64-NEXT: mfc1 $1, $f0
3304 ; MIPS64-N64-NEXT: fill.w $w0, $1
3305 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
3306 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
3307 ; MIPS64-N64-NEXT: sh $1, 0($16)
3308 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3309 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3310 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3311 ; MIPS64-N64-NEXT: jr $ra
3312 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
3314 %0 = load i16, ptr @g, align 2
3315 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
3318 %nearbyint = call float @llvm.nearbyint.f32(float %1)
3319 %2 = call i16 @llvm.convert.to.fp16.f32(float %nearbyint)
3322 store i16 %2, ptr @g, align 2
3327 declare float @llvm.round.f32(float %Val)
3329 define void @fround() {
3330 ; MIPS32-LABEL: fround:
3331 ; MIPS32: # %bb.0: # %entry
3332 ; MIPS32-NEXT: lui $2, %hi(_gp_disp)
3333 ; MIPS32-NEXT: addiu $2, $2, %lo(_gp_disp)
3334 ; MIPS32-NEXT: addiu $sp, $sp, -24
3335 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
3336 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
3337 ; MIPS32-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
3338 ; MIPS32-NEXT: .cfi_offset 31, -4
3339 ; MIPS32-NEXT: .cfi_offset 16, -8
3340 ; MIPS32-NEXT: addu $gp, $2, $25
3341 ; MIPS32-NEXT: lw $16, %got(g)($gp)
3342 ; MIPS32-NEXT: lh $1, 0($16)
3343 ; MIPS32-NEXT: fill.h $w0, $1
3344 ; MIPS32-NEXT: fexupr.w $w0, $w0
3345 ; MIPS32-NEXT: copy_s.w $1, $w0[0]
3346 ; MIPS32-NEXT: lw $25, %call16(roundf)($gp)
3347 ; MIPS32-NEXT: jalr $25
3348 ; MIPS32-NEXT: mtc1 $1, $f12
3349 ; MIPS32-NEXT: mfc1 $1, $f0
3350 ; MIPS32-NEXT: fill.w $w0, $1
3351 ; MIPS32-NEXT: fexdo.h $w0, $w0, $w0
3352 ; MIPS32-NEXT: copy_u.h $1, $w0[0]
3353 ; MIPS32-NEXT: sh $1, 0($16)
3354 ; MIPS32-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
3355 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
3356 ; MIPS32-NEXT: jr $ra
3357 ; MIPS32-NEXT: addiu $sp, $sp, 24
3359 ; MIPS64-N32-LABEL: fround:
3360 ; MIPS64-N32: # %bb.0: # %entry
3361 ; MIPS64-N32-NEXT: addiu $sp, $sp, -32
3362 ; MIPS64-N32-NEXT: .cfi_def_cfa_offset 32
3363 ; MIPS64-N32-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3364 ; MIPS64-N32-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3365 ; MIPS64-N32-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3366 ; MIPS64-N32-NEXT: .cfi_offset 31, -8
3367 ; MIPS64-N32-NEXT: .cfi_offset 28, -16
3368 ; MIPS64-N32-NEXT: .cfi_offset 16, -24
3369 ; MIPS64-N32-NEXT: lui $1, %hi(%neg(%gp_rel(fround)))
3370 ; MIPS64-N32-NEXT: addu $1, $1, $25
3371 ; MIPS64-N32-NEXT: addiu $gp, $1, %lo(%neg(%gp_rel(fround)))
3372 ; MIPS64-N32-NEXT: lw $16, %got_disp(g)($gp)
3373 ; MIPS64-N32-NEXT: lh $1, 0($16)
3374 ; MIPS64-N32-NEXT: fill.h $w0, $1
3375 ; MIPS64-N32-NEXT: fexupr.w $w0, $w0
3376 ; MIPS64-N32-NEXT: copy_s.w $1, $w0[0]
3377 ; MIPS64-N32-NEXT: lw $25, %call16(roundf)($gp)
3378 ; MIPS64-N32-NEXT: jalr $25
3379 ; MIPS64-N32-NEXT: mtc1 $1, $f12
3380 ; MIPS64-N32-NEXT: mfc1 $1, $f0
3381 ; MIPS64-N32-NEXT: fill.w $w0, $1
3382 ; MIPS64-N32-NEXT: fexdo.h $w0, $w0, $w0
3383 ; MIPS64-N32-NEXT: copy_u.h $1, $w0[0]
3384 ; MIPS64-N32-NEXT: sh $1, 0($16)
3385 ; MIPS64-N32-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3386 ; MIPS64-N32-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3387 ; MIPS64-N32-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3388 ; MIPS64-N32-NEXT: jr $ra
3389 ; MIPS64-N32-NEXT: addiu $sp, $sp, 32
3391 ; MIPS64-N64-LABEL: fround:
3392 ; MIPS64-N64: # %bb.0: # %entry
3393 ; MIPS64-N64-NEXT: daddiu $sp, $sp, -32
3394 ; MIPS64-N64-NEXT: .cfi_def_cfa_offset 32
3395 ; MIPS64-N64-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
3396 ; MIPS64-N64-NEXT: sd $gp, 16($sp) # 8-byte Folded Spill
3397 ; MIPS64-N64-NEXT: sd $16, 8($sp) # 8-byte Folded Spill
3398 ; MIPS64-N64-NEXT: .cfi_offset 31, -8
3399 ; MIPS64-N64-NEXT: .cfi_offset 28, -16
3400 ; MIPS64-N64-NEXT: .cfi_offset 16, -24
3401 ; MIPS64-N64-NEXT: lui $1, %hi(%neg(%gp_rel(fround)))
3402 ; MIPS64-N64-NEXT: daddu $1, $1, $25
3403 ; MIPS64-N64-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(fround)))
3404 ; MIPS64-N64-NEXT: ld $16, %got_disp(g)($gp)
3405 ; MIPS64-N64-NEXT: lh $1, 0($16)
3406 ; MIPS64-N64-NEXT: fill.h $w0, $1
3407 ; MIPS64-N64-NEXT: fexupr.w $w0, $w0
3408 ; MIPS64-N64-NEXT: copy_s.w $1, $w0[0]
3409 ; MIPS64-N64-NEXT: ld $25, %call16(roundf)($gp)
3410 ; MIPS64-N64-NEXT: jalr $25
3411 ; MIPS64-N64-NEXT: mtc1 $1, $f12
3412 ; MIPS64-N64-NEXT: mfc1 $1, $f0
3413 ; MIPS64-N64-NEXT: fill.w $w0, $1
3414 ; MIPS64-N64-NEXT: fexdo.h $w0, $w0, $w0
3415 ; MIPS64-N64-NEXT: copy_u.h $1, $w0[0]
3416 ; MIPS64-N64-NEXT: sh $1, 0($16)
3417 ; MIPS64-N64-NEXT: ld $16, 8($sp) # 8-byte Folded Reload
3418 ; MIPS64-N64-NEXT: ld $gp, 16($sp) # 8-byte Folded Reload
3419 ; MIPS64-N64-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
3420 ; MIPS64-N64-NEXT: jr $ra
3421 ; MIPS64-N64-NEXT: daddiu $sp, $sp, 32
3423 %0 = load i16, ptr @g, align 2
3424 %1 = call float @llvm.convert.from.fp16.f32(i16 %0)
3427 %round = call float @llvm.round.f32(float %1)
3428 %2 = call i16 @llvm.convert.to.fp16.f32(float %round)
3431 store i16 %2, ptr @g, align 2