1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc < %s -mtriple thumbv8.1m.main-none-eabi | FileCheck %s --check-prefixes=CHECK,CHECK-NOFP
3 ; RUN: llc < %s -mtriple thumbv8.1m.main-none-eabihf -mattr=+fullfp16 | FileCheck %s --check-prefixes=CHECK,CHECK-FP,CHECK-FPNO64
4 ; RUN: llc < %s -mtriple thumbv8.1m.main-none-eabihf -mattr=+fullfp16,+fp64 | FileCheck %s --check-prefixes=CHECK,CHECK-FP,CHECK-FP64
6 define bfloat @test_fadd(bfloat %a, bfloat %b) {
7 ; CHECK-NOFP-LABEL: test_fadd:
9 ; CHECK-NOFP-NEXT: .save {r7, lr}
10 ; CHECK-NOFP-NEXT: push {r7, lr}
11 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
12 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
13 ; CHECK-NOFP-NEXT: bl __aeabi_fadd
14 ; CHECK-NOFP-NEXT: bl __truncsfbf2
15 ; CHECK-NOFP-NEXT: pop {r7, pc}
17 ; CHECK-FP-LABEL: test_fadd:
19 ; CHECK-FP-NEXT: .save {r7, lr}
20 ; CHECK-FP-NEXT: push {r7, lr}
21 ; CHECK-FP-NEXT: vmov r0, s1
22 ; CHECK-FP-NEXT: vmov r1, s0
23 ; CHECK-FP-NEXT: lsls r0, r0, #16
24 ; CHECK-FP-NEXT: vmov s0, r0
25 ; CHECK-FP-NEXT: lsls r0, r1, #16
26 ; CHECK-FP-NEXT: vmov s2, r0
27 ; CHECK-FP-NEXT: vadd.f32 s0, s2, s0
28 ; CHECK-FP-NEXT: bl __truncsfbf2
29 ; CHECK-FP-NEXT: vmov.f16 r0, s0
30 ; CHECK-FP-NEXT: vmov s0, r0
31 ; CHECK-FP-NEXT: pop {r7, pc}
32 %r = fadd bfloat %a, %b
36 define bfloat @test_fsub(bfloat %a, bfloat %b) {
38 ; CHECK-NOFP-LABEL: test_fsub:
39 ; CHECK-NOFP: @ %bb.0:
40 ; CHECK-NOFP-NEXT: .save {r7, lr}
41 ; CHECK-NOFP-NEXT: push {r7, lr}
42 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
43 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
44 ; CHECK-NOFP-NEXT: bl __aeabi_fsub
45 ; CHECK-NOFP-NEXT: bl __truncsfbf2
46 ; CHECK-NOFP-NEXT: pop {r7, pc}
48 ; CHECK-FP-LABEL: test_fsub:
50 ; CHECK-FP-NEXT: .save {r7, lr}
51 ; CHECK-FP-NEXT: push {r7, lr}
52 ; CHECK-FP-NEXT: vmov r0, s1
53 ; CHECK-FP-NEXT: vmov r1, s0
54 ; CHECK-FP-NEXT: lsls r0, r0, #16
55 ; CHECK-FP-NEXT: vmov s0, r0
56 ; CHECK-FP-NEXT: lsls r0, r1, #16
57 ; CHECK-FP-NEXT: vmov s2, r0
58 ; CHECK-FP-NEXT: vsub.f32 s0, s2, s0
59 ; CHECK-FP-NEXT: bl __truncsfbf2
60 ; CHECK-FP-NEXT: vmov.f16 r0, s0
61 ; CHECK-FP-NEXT: vmov s0, r0
62 ; CHECK-FP-NEXT: pop {r7, pc}
63 %r = fsub bfloat %a, %b
67 define bfloat @test_fmul(bfloat %a, bfloat %b) {
69 ; CHECK-NOFP-LABEL: test_fmul:
70 ; CHECK-NOFP: @ %bb.0:
71 ; CHECK-NOFP-NEXT: .save {r7, lr}
72 ; CHECK-NOFP-NEXT: push {r7, lr}
73 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
74 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
75 ; CHECK-NOFP-NEXT: bl __aeabi_fmul
76 ; CHECK-NOFP-NEXT: bl __truncsfbf2
77 ; CHECK-NOFP-NEXT: pop {r7, pc}
79 ; CHECK-FP-LABEL: test_fmul:
81 ; CHECK-FP-NEXT: .save {r7, lr}
82 ; CHECK-FP-NEXT: push {r7, lr}
83 ; CHECK-FP-NEXT: vmov r0, s1
84 ; CHECK-FP-NEXT: vmov r1, s0
85 ; CHECK-FP-NEXT: lsls r0, r0, #16
86 ; CHECK-FP-NEXT: vmov s0, r0
87 ; CHECK-FP-NEXT: lsls r0, r1, #16
88 ; CHECK-FP-NEXT: vmov s2, r0
89 ; CHECK-FP-NEXT: vmul.f32 s0, s2, s0
90 ; CHECK-FP-NEXT: bl __truncsfbf2
91 ; CHECK-FP-NEXT: vmov.f16 r0, s0
92 ; CHECK-FP-NEXT: vmov s0, r0
93 ; CHECK-FP-NEXT: pop {r7, pc}
94 %r = fmul bfloat %a, %b
98 define bfloat @test_fmadd(bfloat %a, bfloat %b, bfloat %c) {
100 ; CHECK-NOFP-LABEL: test_fmadd:
101 ; CHECK-NOFP: @ %bb.0:
102 ; CHECK-NOFP-NEXT: .save {r4, lr}
103 ; CHECK-NOFP-NEXT: push {r4, lr}
104 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
105 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
106 ; CHECK-NOFP-NEXT: mov r4, r2
107 ; CHECK-NOFP-NEXT: bl __aeabi_fmul
108 ; CHECK-NOFP-NEXT: bl __truncsfbf2
109 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
110 ; CHECK-NOFP-NEXT: lsls r1, r4, #16
111 ; CHECK-NOFP-NEXT: bl __aeabi_fadd
112 ; CHECK-NOFP-NEXT: bl __truncsfbf2
113 ; CHECK-NOFP-NEXT: pop {r4, pc}
115 ; CHECK-FP-LABEL: test_fmadd:
117 ; CHECK-FP-NEXT: .save {r7, lr}
118 ; CHECK-FP-NEXT: push {r7, lr}
119 ; CHECK-FP-NEXT: .vsave {d8}
120 ; CHECK-FP-NEXT: vpush {d8}
121 ; CHECK-FP-NEXT: vmov r0, s1
122 ; CHECK-FP-NEXT: vmov r1, s0
123 ; CHECK-FP-NEXT: vmov.f32 s16, s2
124 ; CHECK-FP-NEXT: lsls r0, r0, #16
125 ; CHECK-FP-NEXT: vmov s0, r0
126 ; CHECK-FP-NEXT: lsls r0, r1, #16
127 ; CHECK-FP-NEXT: vmov s2, r0
128 ; CHECK-FP-NEXT: vmul.f32 s0, s2, s0
129 ; CHECK-FP-NEXT: bl __truncsfbf2
130 ; CHECK-FP-NEXT: vmov r0, s16
131 ; CHECK-FP-NEXT: vmov r1, s0
132 ; CHECK-FP-NEXT: lsls r0, r0, #16
133 ; CHECK-FP-NEXT: vmov s0, r0
134 ; CHECK-FP-NEXT: lsls r0, r1, #16
135 ; CHECK-FP-NEXT: vmov s2, r0
136 ; CHECK-FP-NEXT: vadd.f32 s0, s2, s0
137 ; CHECK-FP-NEXT: bl __truncsfbf2
138 ; CHECK-FP-NEXT: vmov.f16 r0, s0
139 ; CHECK-FP-NEXT: vmov s0, r0
140 ; CHECK-FP-NEXT: vpop {d8}
141 ; CHECK-FP-NEXT: pop {r7, pc}
142 %mul = fmul fast bfloat %a, %b
143 %r = fadd fast bfloat %mul, %c
147 define bfloat @test_fdiv(bfloat %a, bfloat %b) {
149 ; CHECK-NOFP-LABEL: test_fdiv:
150 ; CHECK-NOFP: @ %bb.0:
151 ; CHECK-NOFP-NEXT: .save {r7, lr}
152 ; CHECK-NOFP-NEXT: push {r7, lr}
153 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
154 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
155 ; CHECK-NOFP-NEXT: bl __aeabi_fdiv
156 ; CHECK-NOFP-NEXT: bl __truncsfbf2
157 ; CHECK-NOFP-NEXT: pop {r7, pc}
159 ; CHECK-FP-LABEL: test_fdiv:
161 ; CHECK-FP-NEXT: .save {r7, lr}
162 ; CHECK-FP-NEXT: push {r7, lr}
163 ; CHECK-FP-NEXT: vmov r0, s1
164 ; CHECK-FP-NEXT: vmov r1, s0
165 ; CHECK-FP-NEXT: lsls r0, r0, #16
166 ; CHECK-FP-NEXT: vmov s0, r0
167 ; CHECK-FP-NEXT: lsls r0, r1, #16
168 ; CHECK-FP-NEXT: vmov s2, r0
169 ; CHECK-FP-NEXT: vdiv.f32 s0, s2, s0
170 ; CHECK-FP-NEXT: bl __truncsfbf2
171 ; CHECK-FP-NEXT: vmov.f16 r0, s0
172 ; CHECK-FP-NEXT: vmov s0, r0
173 ; CHECK-FP-NEXT: pop {r7, pc}
174 %r = fdiv bfloat %a, %b
178 define bfloat @test_frem(bfloat %a, bfloat %b) {
180 ; CHECK-NOFP-LABEL: test_frem:
181 ; CHECK-NOFP: @ %bb.0:
182 ; CHECK-NOFP-NEXT: .save {r7, lr}
183 ; CHECK-NOFP-NEXT: push {r7, lr}
184 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
185 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
186 ; CHECK-NOFP-NEXT: bl fmodf
187 ; CHECK-NOFP-NEXT: bl __truncsfbf2
188 ; CHECK-NOFP-NEXT: pop {r7, pc}
190 ; CHECK-FP-LABEL: test_frem:
192 ; CHECK-FP-NEXT: .save {r7, lr}
193 ; CHECK-FP-NEXT: push {r7, lr}
194 ; CHECK-FP-NEXT: vmov r0, s1
195 ; CHECK-FP-NEXT: vmov r1, s0
196 ; CHECK-FP-NEXT: lsls r0, r0, #16
197 ; CHECK-FP-NEXT: lsls r1, r1, #16
198 ; CHECK-FP-NEXT: vmov s1, r0
199 ; CHECK-FP-NEXT: vmov s0, r1
200 ; CHECK-FP-NEXT: bl fmodf
201 ; CHECK-FP-NEXT: bl __truncsfbf2
202 ; CHECK-FP-NEXT: vmov.f16 r0, s0
203 ; CHECK-FP-NEXT: vmov s0, r0
204 ; CHECK-FP-NEXT: pop {r7, pc}
205 %r = frem bfloat %a, %b
209 define void @test_store(bfloat %a, ptr %b) {
210 ; CHECK-NOFP-LABEL: test_store:
211 ; CHECK-NOFP: @ %bb.0:
212 ; CHECK-NOFP-NEXT: strh r0, [r1]
213 ; CHECK-NOFP-NEXT: bx lr
215 ; CHECK-FP-LABEL: test_store:
217 ; CHECK-FP-NEXT: vmov r1, s0
218 ; CHECK-FP-NEXT: strh r1, [r0]
219 ; CHECK-FP-NEXT: bx lr
220 store bfloat %a, ptr %b
224 define void @test_truncstore32(float %a, ptr %b) {
225 ; CHECK-NOFP-LABEL: test_truncstore32:
226 ; CHECK-NOFP: @ %bb.0:
227 ; CHECK-NOFP-NEXT: .save {r4, lr}
228 ; CHECK-NOFP-NEXT: push {r4, lr}
229 ; CHECK-NOFP-NEXT: mov r4, r1
230 ; CHECK-NOFP-NEXT: bl __truncsfbf2
231 ; CHECK-NOFP-NEXT: strh r0, [r4]
232 ; CHECK-NOFP-NEXT: pop {r4, pc}
234 ; CHECK-FP-LABEL: test_truncstore32:
236 ; CHECK-FP-NEXT: .save {r4, lr}
237 ; CHECK-FP-NEXT: push {r4, lr}
238 ; CHECK-FP-NEXT: mov r4, r0
239 ; CHECK-FP-NEXT: bl __truncsfbf2
240 ; CHECK-FP-NEXT: vmov r0, s0
241 ; CHECK-FP-NEXT: strh r0, [r4]
242 ; CHECK-FP-NEXT: pop {r4, pc}
243 %r = fptrunc float %a to bfloat
244 store bfloat %r, ptr %b
248 define void @test_truncstore64(double %a, ptr %b) {
249 ; CHECK-NOFP-LABEL: test_truncstore64:
250 ; CHECK-NOFP: @ %bb.0:
251 ; CHECK-NOFP-NEXT: .save {r4, lr}
252 ; CHECK-NOFP-NEXT: push {r4, lr}
253 ; CHECK-NOFP-NEXT: mov r4, r2
254 ; CHECK-NOFP-NEXT: bl __truncdfbf2
255 ; CHECK-NOFP-NEXT: strh r0, [r4]
256 ; CHECK-NOFP-NEXT: pop {r4, pc}
258 ; CHECK-FP-LABEL: test_truncstore64:
260 ; CHECK-FP-NEXT: .save {r4, lr}
261 ; CHECK-FP-NEXT: push {r4, lr}
262 ; CHECK-FP-NEXT: mov r4, r0
263 ; CHECK-FP-NEXT: bl __truncdfbf2
264 ; CHECK-FP-NEXT: vmov r0, s0
265 ; CHECK-FP-NEXT: strh r0, [r4]
266 ; CHECK-FP-NEXT: pop {r4, pc}
267 %r = fptrunc double %a to bfloat
268 store bfloat %r, ptr %b
272 define bfloat @test_load(ptr %a) {
273 ; CHECK-NOFP-LABEL: test_load:
274 ; CHECK-NOFP: @ %bb.0:
275 ; CHECK-NOFP-NEXT: ldrh r0, [r0]
276 ; CHECK-NOFP-NEXT: bx lr
278 ; CHECK-FP-LABEL: test_load:
280 ; CHECK-FP-NEXT: ldrh r0, [r0]
281 ; CHECK-FP-NEXT: vmov s0, r0
282 ; CHECK-FP-NEXT: bx lr
283 %r = load bfloat, ptr %a
287 define float @test_loadext32(ptr %a) {
288 ; CHECK-NOFP-LABEL: test_loadext32:
289 ; CHECK-NOFP: @ %bb.0:
290 ; CHECK-NOFP-NEXT: ldrh r0, [r0]
291 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
292 ; CHECK-NOFP-NEXT: bx lr
294 ; CHECK-FP-LABEL: test_loadext32:
296 ; CHECK-FP-NEXT: ldrh r0, [r0]
297 ; CHECK-FP-NEXT: lsls r0, r0, #16
298 ; CHECK-FP-NEXT: vmov s0, r0
299 ; CHECK-FP-NEXT: bx lr
300 %r = load bfloat, ptr %a
301 %d = fpext bfloat %r to float
305 define double @test_loadext64(ptr %a) {
306 ; CHECK-NOFP-LABEL: test_loadext64:
307 ; CHECK-NOFP: @ %bb.0:
308 ; CHECK-NOFP-NEXT: .save {r7, lr}
309 ; CHECK-NOFP-NEXT: push {r7, lr}
310 ; CHECK-NOFP-NEXT: ldrh r0, [r0]
311 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
312 ; CHECK-NOFP-NEXT: bl __aeabi_f2d
313 ; CHECK-NOFP-NEXT: pop {r7, pc}
315 ; CHECK-FPNO64-LABEL: test_loadext64:
316 ; CHECK-FPNO64: @ %bb.0:
317 ; CHECK-FPNO64-NEXT: .save {r7, lr}
318 ; CHECK-FPNO64-NEXT: push {r7, lr}
319 ; CHECK-FPNO64-NEXT: ldrh r0, [r0]
320 ; CHECK-FPNO64-NEXT: lsls r0, r0, #16
321 ; CHECK-FPNO64-NEXT: bl __aeabi_f2d
322 ; CHECK-FPNO64-NEXT: vmov d0, r0, r1
323 ; CHECK-FPNO64-NEXT: pop {r7, pc}
325 ; CHECK-FP64-LABEL: test_loadext64:
326 ; CHECK-FP64: @ %bb.0:
327 ; CHECK-FP64-NEXT: ldrh r0, [r0]
328 ; CHECK-FP64-NEXT: lsls r0, r0, #16
329 ; CHECK-FP64-NEXT: vmov s0, r0
330 ; CHECK-FP64-NEXT: vcvt.f64.f32 d0, s0
331 ; CHECK-FP64-NEXT: bx lr
332 %r = load bfloat, ptr %a
333 %d = fpext bfloat %r to double
337 declare bfloat @test_callee(bfloat %a, bfloat %b)
339 define bfloat @test_call(bfloat %a, bfloat %b) {
340 ; CHECK-LABEL: test_call:
342 ; CHECK-NEXT: .save {r7, lr}
343 ; CHECK-NEXT: push {r7, lr}
344 ; CHECK-NEXT: bl test_callee
345 ; CHECK-NEXT: pop {r7, pc}
346 %r = call bfloat @test_callee(bfloat %a, bfloat %b)
350 define void @test_call_store(bfloat %a, bfloat %b, ptr %p) {
351 ; CHECK-NOFP-LABEL: test_call_store:
352 ; CHECK-NOFP: @ %bb.0:
353 ; CHECK-NOFP-NEXT: .save {r4, lr}
354 ; CHECK-NOFP-NEXT: push {r4, lr}
355 ; CHECK-NOFP-NEXT: mov r4, r2
356 ; CHECK-NOFP-NEXT: bl test_callee
357 ; CHECK-NOFP-NEXT: strh r0, [r4]
358 ; CHECK-NOFP-NEXT: pop {r4, pc}
360 ; CHECK-FP-LABEL: test_call_store:
362 ; CHECK-FP-NEXT: .save {r4, lr}
363 ; CHECK-FP-NEXT: push {r4, lr}
364 ; CHECK-FP-NEXT: mov r4, r0
365 ; CHECK-FP-NEXT: bl test_callee
366 ; CHECK-FP-NEXT: vmov r0, s0
367 ; CHECK-FP-NEXT: strh r0, [r4]
368 ; CHECK-FP-NEXT: pop {r4, pc}
369 %r = call bfloat @test_callee(bfloat %a, bfloat %b)
370 store bfloat %r, ptr %p
374 define bfloat @test_call_flipped(bfloat %a, bfloat %b) {
375 ; CHECK-NOFP-LABEL: test_call_flipped:
376 ; CHECK-NOFP: @ %bb.0:
377 ; CHECK-NOFP-NEXT: .save {r7, lr}
378 ; CHECK-NOFP-NEXT: push {r7, lr}
379 ; CHECK-NOFP-NEXT: mov r2, r0
380 ; CHECK-NOFP-NEXT: mov r0, r1
381 ; CHECK-NOFP-NEXT: mov r1, r2
382 ; CHECK-NOFP-NEXT: bl test_callee
383 ; CHECK-NOFP-NEXT: pop {r7, pc}
385 ; CHECK-FP-LABEL: test_call_flipped:
387 ; CHECK-FP-NEXT: .save {r7, lr}
388 ; CHECK-FP-NEXT: push {r7, lr}
389 ; CHECK-FP-NEXT: vmov.f32 s2, s0
390 ; CHECK-FP-NEXT: vmov.f32 s0, s1
391 ; CHECK-FP-NEXT: vmov.f32 s1, s2
392 ; CHECK-FP-NEXT: bl test_callee
393 ; CHECK-FP-NEXT: pop {r7, pc}
394 %r = call bfloat @test_callee(bfloat %b, bfloat %a)
398 define bfloat @test_tailcall_flipped(bfloat %a, bfloat %b) {
399 ; CHECK-NOFP-LABEL: test_tailcall_flipped:
400 ; CHECK-NOFP: @ %bb.0:
401 ; CHECK-NOFP-NEXT: mov r2, r0
402 ; CHECK-NOFP-NEXT: mov r0, r1
403 ; CHECK-NOFP-NEXT: mov r1, r2
404 ; CHECK-NOFP-NEXT: b test_callee
406 ; CHECK-FP-LABEL: test_tailcall_flipped:
408 ; CHECK-FP-NEXT: vmov.f32 s2, s0
409 ; CHECK-FP-NEXT: vmov.f32 s0, s1
410 ; CHECK-FP-NEXT: vmov.f32 s1, s2
411 ; CHECK-FP-NEXT: b test_callee
412 %r = tail call bfloat @test_callee(bfloat %b, bfloat %a)
416 define bfloat @test_select(bfloat %a, bfloat %b, i1 zeroext %c) {
417 ; CHECK-NOFP-LABEL: test_select:
418 ; CHECK-NOFP: @ %bb.0:
419 ; CHECK-NOFP-NEXT: cmp r2, #0
420 ; CHECK-NOFP-NEXT: csel r0, r0, r1, ne
421 ; CHECK-NOFP-NEXT: bx lr
423 ; CHECK-FP-LABEL: test_select:
425 ; CHECK-FP-NEXT: vmov r1, s1
426 ; CHECK-FP-NEXT: cmp r0, #0
427 ; CHECK-FP-NEXT: it ne
428 ; CHECK-FP-NEXT: vmovne r1, s0
429 ; CHECK-FP-NEXT: vmov.f16 s0, r1
430 ; CHECK-FP-NEXT: vmov.f16 r0, s0
431 ; CHECK-FP-NEXT: vmov s0, r0
432 ; CHECK-FP-NEXT: bx lr
433 %r = select i1 %c, bfloat %a, bfloat %b
437 define bfloat @test_select_cc(bfloat %a, bfloat %b, bfloat %c, bfloat %d) {
438 ; CHECK-NOFP-LABEL: test_select_cc:
439 ; CHECK-NOFP: @ %bb.0:
440 ; CHECK-NOFP-NEXT: .save {r4, r5, r7, lr}
441 ; CHECK-NOFP-NEXT: push {r4, r5, r7, lr}
442 ; CHECK-NOFP-NEXT: mov r4, r1
443 ; CHECK-NOFP-NEXT: mov r5, r0
444 ; CHECK-NOFP-NEXT: lsls r0, r2, #16
445 ; CHECK-NOFP-NEXT: lsls r1, r3, #16
446 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
447 ; CHECK-NOFP-NEXT: cmp r0, #0
448 ; CHECK-NOFP-NEXT: csel r0, r5, r4, eq
449 ; CHECK-NOFP-NEXT: pop {r4, r5, r7, pc}
451 ; CHECK-FP-LABEL: test_select_cc:
453 ; CHECK-FP-NEXT: vmov r0, s3
454 ; CHECK-FP-NEXT: vmov r1, s2
455 ; CHECK-FP-NEXT: lsls r0, r0, #16
456 ; CHECK-FP-NEXT: vmov s2, r0
457 ; CHECK-FP-NEXT: lsls r0, r1, #16
458 ; CHECK-FP-NEXT: vmov s4, r0
459 ; CHECK-FP-NEXT: vmov r0, s1
460 ; CHECK-FP-NEXT: vcmp.f32 s4, s2
461 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
462 ; CHECK-FP-NEXT: it ne
463 ; CHECK-FP-NEXT: vmovne r0, s0
464 ; CHECK-FP-NEXT: vmov.f16 s0, r0
465 ; CHECK-FP-NEXT: vmov.f16 r0, s0
466 ; CHECK-FP-NEXT: vmov s0, r0
467 ; CHECK-FP-NEXT: bx lr
468 %cc = fcmp une bfloat %c, %d
469 %r = select i1 %cc, bfloat %a, bfloat %b
473 define float @test_select_cc_f32_f16(float %a, float %b, bfloat %c, bfloat %d) {
474 ; CHECK-NOFP-LABEL: test_select_cc_f32_f16:
475 ; CHECK-NOFP: @ %bb.0:
476 ; CHECK-NOFP-NEXT: .save {r4, r5, r7, lr}
477 ; CHECK-NOFP-NEXT: push {r4, r5, r7, lr}
478 ; CHECK-NOFP-NEXT: mov r4, r1
479 ; CHECK-NOFP-NEXT: mov r5, r0
480 ; CHECK-NOFP-NEXT: lsls r0, r2, #16
481 ; CHECK-NOFP-NEXT: lsls r1, r3, #16
482 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
483 ; CHECK-NOFP-NEXT: cmp r0, #0
484 ; CHECK-NOFP-NEXT: csel r0, r5, r4, eq
485 ; CHECK-NOFP-NEXT: pop {r4, r5, r7, pc}
487 ; CHECK-FP-LABEL: test_select_cc_f32_f16:
489 ; CHECK-FP-NEXT: vmov r0, s3
490 ; CHECK-FP-NEXT: vmov r1, s2
491 ; CHECK-FP-NEXT: lsls r0, r0, #16
492 ; CHECK-FP-NEXT: vmov s2, r0
493 ; CHECK-FP-NEXT: lsls r0, r1, #16
494 ; CHECK-FP-NEXT: vmov s4, r0
495 ; CHECK-FP-NEXT: vcmp.f32 s4, s2
496 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
497 ; CHECK-FP-NEXT: vseleq.f32 s0, s1, s0
498 ; CHECK-FP-NEXT: bx lr
499 %cc = fcmp une bfloat %c, %d
500 %r = select i1 %cc, float %a, float %b
504 define bfloat @test_select_cc_f16_f32(bfloat %a, bfloat %b, float %c, float %d) {
505 ; CHECK-NOFP-LABEL: test_select_cc_f16_f32:
506 ; CHECK-NOFP: @ %bb.0:
507 ; CHECK-NOFP-NEXT: .save {r4, r5, r7, lr}
508 ; CHECK-NOFP-NEXT: push {r4, r5, r7, lr}
509 ; CHECK-NOFP-NEXT: mov r4, r1
510 ; CHECK-NOFP-NEXT: mov r5, r0
511 ; CHECK-NOFP-NEXT: mov r0, r2
512 ; CHECK-NOFP-NEXT: mov r1, r3
513 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
514 ; CHECK-NOFP-NEXT: cmp r0, #0
515 ; CHECK-NOFP-NEXT: csel r0, r5, r4, eq
516 ; CHECK-NOFP-NEXT: pop {r4, r5, r7, pc}
518 ; CHECK-FP-LABEL: test_select_cc_f16_f32:
520 ; CHECK-FP-NEXT: vcmp.f32 s2, s3
521 ; CHECK-FP-NEXT: vmov r0, s1
522 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
523 ; CHECK-FP-NEXT: it ne
524 ; CHECK-FP-NEXT: vmovne r0, s0
525 ; CHECK-FP-NEXT: vmov.f16 s0, r0
526 ; CHECK-FP-NEXT: vmov.f16 r0, s0
527 ; CHECK-FP-NEXT: vmov s0, r0
528 ; CHECK-FP-NEXT: bx lr
529 %cc = fcmp une float %c, %d
530 %r = select i1 %cc, bfloat %a, bfloat %b
534 define i1 @test_fcmp_une(bfloat %a, bfloat %b) {
535 ; CHECK-NOFP-LABEL: test_fcmp_une:
536 ; CHECK-NOFP: @ %bb.0:
537 ; CHECK-NOFP-NEXT: .save {r7, lr}
538 ; CHECK-NOFP-NEXT: push {r7, lr}
539 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
540 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
541 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
542 ; CHECK-NOFP-NEXT: cmp r0, #0
543 ; CHECK-NOFP-NEXT: cset r0, eq
544 ; CHECK-NOFP-NEXT: pop {r7, pc}
546 ; CHECK-FP-LABEL: test_fcmp_une:
548 ; CHECK-FP-NEXT: vmov r0, s1
549 ; CHECK-FP-NEXT: vmov r1, s0
550 ; CHECK-FP-NEXT: lsls r0, r0, #16
551 ; CHECK-FP-NEXT: vmov s0, r0
552 ; CHECK-FP-NEXT: lsls r0, r1, #16
553 ; CHECK-FP-NEXT: vmov s2, r0
554 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
555 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
556 ; CHECK-FP-NEXT: cset r0, ne
557 ; CHECK-FP-NEXT: bx lr
558 %r = fcmp une bfloat %a, %b
562 define i1 @test_fcmp_ueq(bfloat %a, bfloat %b) {
563 ; CHECK-NOFP-LABEL: test_fcmp_ueq:
564 ; CHECK-NOFP: @ %bb.0:
565 ; CHECK-NOFP-NEXT: .save {r4, r5, r6, lr}
566 ; CHECK-NOFP-NEXT: push {r4, r5, r6, lr}
567 ; CHECK-NOFP-NEXT: lsls r4, r0, #16
568 ; CHECK-NOFP-NEXT: lsls r5, r1, #16
569 ; CHECK-NOFP-NEXT: mov r0, r4
570 ; CHECK-NOFP-NEXT: mov r1, r5
571 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
572 ; CHECK-NOFP-NEXT: mov r6, r0
573 ; CHECK-NOFP-NEXT: mov r0, r4
574 ; CHECK-NOFP-NEXT: mov r1, r5
575 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpun
576 ; CHECK-NOFP-NEXT: orrs r0, r6
577 ; CHECK-NOFP-NEXT: cset r0, ne
578 ; CHECK-NOFP-NEXT: pop {r4, r5, r6, pc}
580 ; CHECK-FP-LABEL: test_fcmp_ueq:
582 ; CHECK-FP-NEXT: vmov r0, s1
583 ; CHECK-FP-NEXT: vmov r1, s0
584 ; CHECK-FP-NEXT: lsls r0, r0, #16
585 ; CHECK-FP-NEXT: vmov s0, r0
586 ; CHECK-FP-NEXT: lsls r0, r1, #16
587 ; CHECK-FP-NEXT: vmov s2, r0
588 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
589 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
590 ; CHECK-FP-NEXT: cset r0, eq
591 ; CHECK-FP-NEXT: csinc r0, r0, zr, vc
592 ; CHECK-FP-NEXT: bx lr
593 %r = fcmp ueq bfloat %a, %b
597 define i1 @test_fcmp_ugt(bfloat %a, bfloat %b) {
598 ; CHECK-NOFP-LABEL: test_fcmp_ugt:
599 ; CHECK-NOFP: @ %bb.0:
600 ; CHECK-NOFP-NEXT: .save {r7, lr}
601 ; CHECK-NOFP-NEXT: push {r7, lr}
602 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
603 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
604 ; CHECK-NOFP-NEXT: bl __aeabi_fcmple
605 ; CHECK-NOFP-NEXT: cmp r0, #0
606 ; CHECK-NOFP-NEXT: cset r0, eq
607 ; CHECK-NOFP-NEXT: pop {r7, pc}
609 ; CHECK-FP-LABEL: test_fcmp_ugt:
611 ; CHECK-FP-NEXT: vmov r0, s1
612 ; CHECK-FP-NEXT: vmov r1, s0
613 ; CHECK-FP-NEXT: lsls r0, r0, #16
614 ; CHECK-FP-NEXT: vmov s0, r0
615 ; CHECK-FP-NEXT: lsls r0, r1, #16
616 ; CHECK-FP-NEXT: vmov s2, r0
617 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
618 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
619 ; CHECK-FP-NEXT: cset r0, hi
620 ; CHECK-FP-NEXT: bx lr
621 %r = fcmp ugt bfloat %a, %b
625 define i1 @test_fcmp_uge(bfloat %a, bfloat %b) {
626 ; CHECK-NOFP-LABEL: test_fcmp_uge:
627 ; CHECK-NOFP: @ %bb.0:
628 ; CHECK-NOFP-NEXT: .save {r7, lr}
629 ; CHECK-NOFP-NEXT: push {r7, lr}
630 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
631 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
632 ; CHECK-NOFP-NEXT: bl __aeabi_fcmplt
633 ; CHECK-NOFP-NEXT: cmp r0, #0
634 ; CHECK-NOFP-NEXT: cset r0, eq
635 ; CHECK-NOFP-NEXT: pop {r7, pc}
637 ; CHECK-FP-LABEL: test_fcmp_uge:
639 ; CHECK-FP-NEXT: vmov r0, s1
640 ; CHECK-FP-NEXT: vmov r1, s0
641 ; CHECK-FP-NEXT: lsls r0, r0, #16
642 ; CHECK-FP-NEXT: vmov s0, r0
643 ; CHECK-FP-NEXT: lsls r0, r1, #16
644 ; CHECK-FP-NEXT: vmov s2, r0
645 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
646 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
647 ; CHECK-FP-NEXT: cset r0, pl
648 ; CHECK-FP-NEXT: bx lr
649 %r = fcmp uge bfloat %a, %b
653 define i1 @test_fcmp_ult(bfloat %a, bfloat %b) {
654 ; CHECK-NOFP-LABEL: test_fcmp_ult:
655 ; CHECK-NOFP: @ %bb.0:
656 ; CHECK-NOFP-NEXT: .save {r7, lr}
657 ; CHECK-NOFP-NEXT: push {r7, lr}
658 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
659 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
660 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpge
661 ; CHECK-NOFP-NEXT: cmp r0, #0
662 ; CHECK-NOFP-NEXT: cset r0, eq
663 ; CHECK-NOFP-NEXT: pop {r7, pc}
665 ; CHECK-FP-LABEL: test_fcmp_ult:
667 ; CHECK-FP-NEXT: vmov r0, s1
668 ; CHECK-FP-NEXT: vmov r1, s0
669 ; CHECK-FP-NEXT: lsls r0, r0, #16
670 ; CHECK-FP-NEXT: vmov s0, r0
671 ; CHECK-FP-NEXT: lsls r0, r1, #16
672 ; CHECK-FP-NEXT: vmov s2, r0
673 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
674 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
675 ; CHECK-FP-NEXT: cset r0, lt
676 ; CHECK-FP-NEXT: bx lr
677 %r = fcmp ult bfloat %a, %b
681 define i1 @test_fcmp_ule(bfloat %a, bfloat %b) {
682 ; CHECK-NOFP-LABEL: test_fcmp_ule:
683 ; CHECK-NOFP: @ %bb.0:
684 ; CHECK-NOFP-NEXT: .save {r7, lr}
685 ; CHECK-NOFP-NEXT: push {r7, lr}
686 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
687 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
688 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpgt
689 ; CHECK-NOFP-NEXT: cmp r0, #0
690 ; CHECK-NOFP-NEXT: cset r0, eq
691 ; CHECK-NOFP-NEXT: pop {r7, pc}
693 ; CHECK-FP-LABEL: test_fcmp_ule:
695 ; CHECK-FP-NEXT: vmov r0, s1
696 ; CHECK-FP-NEXT: vmov r1, s0
697 ; CHECK-FP-NEXT: lsls r0, r0, #16
698 ; CHECK-FP-NEXT: vmov s0, r0
699 ; CHECK-FP-NEXT: lsls r0, r1, #16
700 ; CHECK-FP-NEXT: vmov s2, r0
701 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
702 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
703 ; CHECK-FP-NEXT: cset r0, le
704 ; CHECK-FP-NEXT: bx lr
705 %r = fcmp ule bfloat %a, %b
709 define i1 @test_fcmp_uno(bfloat %a, bfloat %b) {
710 ; CHECK-NOFP-LABEL: test_fcmp_uno:
711 ; CHECK-NOFP: @ %bb.0:
712 ; CHECK-NOFP-NEXT: .save {r7, lr}
713 ; CHECK-NOFP-NEXT: push {r7, lr}
714 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
715 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
716 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpun
717 ; CHECK-NOFP-NEXT: cmp r0, #0
718 ; CHECK-NOFP-NEXT: cset r0, ne
719 ; CHECK-NOFP-NEXT: pop {r7, pc}
721 ; CHECK-FP-LABEL: test_fcmp_uno:
723 ; CHECK-FP-NEXT: vmov r0, s1
724 ; CHECK-FP-NEXT: vmov r1, s0
725 ; CHECK-FP-NEXT: lsls r0, r0, #16
726 ; CHECK-FP-NEXT: vmov s0, r0
727 ; CHECK-FP-NEXT: lsls r0, r1, #16
728 ; CHECK-FP-NEXT: vmov s2, r0
729 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
730 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
731 ; CHECK-FP-NEXT: cset r0, vs
732 ; CHECK-FP-NEXT: bx lr
733 %r = fcmp uno bfloat %a, %b
737 define i1 @test_fcmp_one(bfloat %a, bfloat %b) {
738 ; CHECK-NOFP-LABEL: test_fcmp_one:
739 ; CHECK-NOFP: @ %bb.0:
740 ; CHECK-NOFP-NEXT: .save {r4, r5, r6, lr}
741 ; CHECK-NOFP-NEXT: push {r4, r5, r6, lr}
742 ; CHECK-NOFP-NEXT: lsls r4, r0, #16
743 ; CHECK-NOFP-NEXT: lsls r5, r1, #16
744 ; CHECK-NOFP-NEXT: mov r0, r4
745 ; CHECK-NOFP-NEXT: mov r1, r5
746 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
747 ; CHECK-NOFP-NEXT: mov r6, r0
748 ; CHECK-NOFP-NEXT: mov r0, r4
749 ; CHECK-NOFP-NEXT: mov r1, r5
750 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpun
751 ; CHECK-NOFP-NEXT: orrs r0, r6
752 ; CHECK-NOFP-NEXT: cset r0, eq
753 ; CHECK-NOFP-NEXT: pop {r4, r5, r6, pc}
755 ; CHECK-FP-LABEL: test_fcmp_one:
757 ; CHECK-FP-NEXT: vmov r0, s1
758 ; CHECK-FP-NEXT: vmov r1, s0
759 ; CHECK-FP-NEXT: lsls r0, r0, #16
760 ; CHECK-FP-NEXT: vmov s0, r0
761 ; CHECK-FP-NEXT: lsls r0, r1, #16
762 ; CHECK-FP-NEXT: vmov s2, r0
763 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
764 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
765 ; CHECK-FP-NEXT: cset r0, mi
766 ; CHECK-FP-NEXT: csinc r0, r0, zr, le
767 ; CHECK-FP-NEXT: bx lr
768 %r = fcmp one bfloat %a, %b
772 define i1 @test_fcmp_oeq(bfloat %a, bfloat %b) {
773 ; CHECK-NOFP-LABEL: test_fcmp_oeq:
774 ; CHECK-NOFP: @ %bb.0:
775 ; CHECK-NOFP-NEXT: .save {r7, lr}
776 ; CHECK-NOFP-NEXT: push {r7, lr}
777 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
778 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
779 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpeq
780 ; CHECK-NOFP-NEXT: cmp r0, #0
781 ; CHECK-NOFP-NEXT: cset r0, ne
782 ; CHECK-NOFP-NEXT: pop {r7, pc}
784 ; CHECK-FP-LABEL: test_fcmp_oeq:
786 ; CHECK-FP-NEXT: vmov r0, s1
787 ; CHECK-FP-NEXT: vmov r1, s0
788 ; CHECK-FP-NEXT: lsls r0, r0, #16
789 ; CHECK-FP-NEXT: vmov s0, r0
790 ; CHECK-FP-NEXT: lsls r0, r1, #16
791 ; CHECK-FP-NEXT: vmov s2, r0
792 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
793 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
794 ; CHECK-FP-NEXT: cset r0, eq
795 ; CHECK-FP-NEXT: bx lr
796 %r = fcmp oeq bfloat %a, %b
800 define i1 @test_fcmp_ogt(bfloat %a, bfloat %b) {
801 ; CHECK-NOFP-LABEL: test_fcmp_ogt:
802 ; CHECK-NOFP: @ %bb.0:
803 ; CHECK-NOFP-NEXT: .save {r7, lr}
804 ; CHECK-NOFP-NEXT: push {r7, lr}
805 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
806 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
807 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpgt
808 ; CHECK-NOFP-NEXT: cmp r0, #0
809 ; CHECK-NOFP-NEXT: cset r0, ne
810 ; CHECK-NOFP-NEXT: pop {r7, pc}
812 ; CHECK-FP-LABEL: test_fcmp_ogt:
814 ; CHECK-FP-NEXT: vmov r0, s1
815 ; CHECK-FP-NEXT: vmov r1, s0
816 ; CHECK-FP-NEXT: lsls r0, r0, #16
817 ; CHECK-FP-NEXT: vmov s0, r0
818 ; CHECK-FP-NEXT: lsls r0, r1, #16
819 ; CHECK-FP-NEXT: vmov s2, r0
820 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
821 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
822 ; CHECK-FP-NEXT: cset r0, gt
823 ; CHECK-FP-NEXT: bx lr
824 %r = fcmp ogt bfloat %a, %b
828 define i1 @test_fcmp_oge(bfloat %a, bfloat %b) {
829 ; CHECK-NOFP-LABEL: test_fcmp_oge:
830 ; CHECK-NOFP: @ %bb.0:
831 ; CHECK-NOFP-NEXT: .save {r7, lr}
832 ; CHECK-NOFP-NEXT: push {r7, lr}
833 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
834 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
835 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpge
836 ; CHECK-NOFP-NEXT: cmp r0, #0
837 ; CHECK-NOFP-NEXT: cset r0, ne
838 ; CHECK-NOFP-NEXT: pop {r7, pc}
840 ; CHECK-FP-LABEL: test_fcmp_oge:
842 ; CHECK-FP-NEXT: vmov r0, s1
843 ; CHECK-FP-NEXT: vmov r1, s0
844 ; CHECK-FP-NEXT: lsls r0, r0, #16
845 ; CHECK-FP-NEXT: vmov s0, r0
846 ; CHECK-FP-NEXT: lsls r0, r1, #16
847 ; CHECK-FP-NEXT: vmov s2, r0
848 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
849 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
850 ; CHECK-FP-NEXT: cset r0, ge
851 ; CHECK-FP-NEXT: bx lr
852 %r = fcmp oge bfloat %a, %b
856 define i1 @test_fcmp_olt(bfloat %a, bfloat %b) {
857 ; CHECK-NOFP-LABEL: test_fcmp_olt:
858 ; CHECK-NOFP: @ %bb.0:
859 ; CHECK-NOFP-NEXT: .save {r7, lr}
860 ; CHECK-NOFP-NEXT: push {r7, lr}
861 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
862 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
863 ; CHECK-NOFP-NEXT: bl __aeabi_fcmplt
864 ; CHECK-NOFP-NEXT: cmp r0, #0
865 ; CHECK-NOFP-NEXT: cset r0, ne
866 ; CHECK-NOFP-NEXT: pop {r7, pc}
868 ; CHECK-FP-LABEL: test_fcmp_olt:
870 ; CHECK-FP-NEXT: vmov r0, s1
871 ; CHECK-FP-NEXT: vmov r1, s0
872 ; CHECK-FP-NEXT: lsls r0, r0, #16
873 ; CHECK-FP-NEXT: vmov s0, r0
874 ; CHECK-FP-NEXT: lsls r0, r1, #16
875 ; CHECK-FP-NEXT: vmov s2, r0
876 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
877 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
878 ; CHECK-FP-NEXT: cset r0, mi
879 ; CHECK-FP-NEXT: bx lr
880 %r = fcmp olt bfloat %a, %b
884 define i1 @test_fcmp_ole(bfloat %a, bfloat %b) {
885 ; CHECK-NOFP-LABEL: test_fcmp_ole:
886 ; CHECK-NOFP: @ %bb.0:
887 ; CHECK-NOFP-NEXT: .save {r7, lr}
888 ; CHECK-NOFP-NEXT: push {r7, lr}
889 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
890 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
891 ; CHECK-NOFP-NEXT: bl __aeabi_fcmple
892 ; CHECK-NOFP-NEXT: cmp r0, #0
893 ; CHECK-NOFP-NEXT: cset r0, ne
894 ; CHECK-NOFP-NEXT: pop {r7, pc}
896 ; CHECK-FP-LABEL: test_fcmp_ole:
898 ; CHECK-FP-NEXT: vmov r0, s1
899 ; CHECK-FP-NEXT: vmov r1, s0
900 ; CHECK-FP-NEXT: lsls r0, r0, #16
901 ; CHECK-FP-NEXT: vmov s0, r0
902 ; CHECK-FP-NEXT: lsls r0, r1, #16
903 ; CHECK-FP-NEXT: vmov s2, r0
904 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
905 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
906 ; CHECK-FP-NEXT: cset r0, ls
907 ; CHECK-FP-NEXT: bx lr
908 %r = fcmp ole bfloat %a, %b
912 define i1 @test_fcmp_ord(bfloat %a, bfloat %b) {
913 ; CHECK-NOFP-LABEL: test_fcmp_ord:
914 ; CHECK-NOFP: @ %bb.0:
915 ; CHECK-NOFP-NEXT: .save {r7, lr}
916 ; CHECK-NOFP-NEXT: push {r7, lr}
917 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
918 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
919 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpun
920 ; CHECK-NOFP-NEXT: cmp r0, #0
921 ; CHECK-NOFP-NEXT: cset r0, eq
922 ; CHECK-NOFP-NEXT: pop {r7, pc}
924 ; CHECK-FP-LABEL: test_fcmp_ord:
926 ; CHECK-FP-NEXT: vmov r0, s1
927 ; CHECK-FP-NEXT: vmov r1, s0
928 ; CHECK-FP-NEXT: lsls r0, r0, #16
929 ; CHECK-FP-NEXT: vmov s0, r0
930 ; CHECK-FP-NEXT: lsls r0, r1, #16
931 ; CHECK-FP-NEXT: vmov s2, r0
932 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
933 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
934 ; CHECK-FP-NEXT: cset r0, vc
935 ; CHECK-FP-NEXT: bx lr
936 %r = fcmp ord bfloat %a, %b
940 define void @test_fccmp(bfloat %in, ptr %out) {
941 ; CHECK-NOFP-LABEL: test_fccmp:
942 ; CHECK-NOFP: @ %bb.0:
943 ; CHECK-NOFP-NEXT: .save {r4, r5, r6, r7, lr}
944 ; CHECK-NOFP-NEXT: push {r4, r5, r6, r7, lr}
945 ; CHECK-NOFP-NEXT: .pad #4
946 ; CHECK-NOFP-NEXT: sub sp, #4
947 ; CHECK-NOFP-NEXT: lsls r6, r0, #16
948 ; CHECK-NOFP-NEXT: mov r4, r1
949 ; CHECK-NOFP-NEXT: mov r5, r0
950 ; CHECK-NOFP-NEXT: mov r0, r6
951 ; CHECK-NOFP-NEXT: mov.w r1, #1207959552
952 ; CHECK-NOFP-NEXT: bl __aeabi_fcmpgt
953 ; CHECK-NOFP-NEXT: mov r7, r0
954 ; CHECK-NOFP-NEXT: mov r0, r6
955 ; CHECK-NOFP-NEXT: mov.w r1, #1157627904
956 ; CHECK-NOFP-NEXT: bl __aeabi_fcmplt
957 ; CHECK-NOFP-NEXT: mov.w r1, #17664
958 ; CHECK-NOFP-NEXT: cmp r0, #0
959 ; CHECK-NOFP-NEXT: csel r0, r5, r1, ne
960 ; CHECK-NOFP-NEXT: cmp r7, #0
961 ; CHECK-NOFP-NEXT: csel r0, r0, r1, ne
962 ; CHECK-NOFP-NEXT: strh r0, [r4]
963 ; CHECK-NOFP-NEXT: add sp, #4
964 ; CHECK-NOFP-NEXT: pop {r4, r5, r6, r7, pc}
966 ; CHECK-FP-LABEL: test_fccmp:
968 ; CHECK-FP-NEXT: vmov r1, s0
969 ; CHECK-FP-NEXT: vldr s0, .LCPI34_0
970 ; CHECK-FP-NEXT: vldr s4, .LCPI34_1
971 ; CHECK-FP-NEXT: lsls r2, r1, #16
972 ; CHECK-FP-NEXT: vmov s2, r2
973 ; CHECK-FP-NEXT: mov.w r2, #17664
974 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
975 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
976 ; CHECK-FP-NEXT: vcmp.f32 s2, s4
977 ; CHECK-FP-NEXT: csel r1, r1, r2, mi
978 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
979 ; CHECK-FP-NEXT: csel r1, r1, r2, gt
980 ; CHECK-FP-NEXT: strh r1, [r0]
981 ; CHECK-FP-NEXT: bx lr
982 ; CHECK-FP-NEXT: .p2align 2
983 ; CHECK-FP-NEXT: @ %bb.1:
984 ; CHECK-FP-NEXT: .LCPI34_0:
985 ; CHECK-FP-NEXT: .long 0x45000000 @ float 2048
986 ; CHECK-FP-NEXT: .LCPI34_1:
987 ; CHECK-FP-NEXT: .long 0x48000000 @ float 131072
988 %cmp1 = fcmp ogt bfloat %in, 0xR4800
989 %cmp2 = fcmp olt bfloat %in, 0xR4500
990 %cond = and i1 %cmp1, %cmp2
991 %result = select i1 %cond, bfloat %in, bfloat 0xR4500
992 store bfloat %result, ptr %out
996 define void @test_br_cc(bfloat %a, bfloat %b, ptr %p1, ptr %p2) {
997 ; CHECK-NOFP-LABEL: test_br_cc:
998 ; CHECK-NOFP: @ %bb.0: @ %common.ret
999 ; CHECK-NOFP-NEXT: .save {r4, r5, r7, lr}
1000 ; CHECK-NOFP-NEXT: push {r4, r5, r7, lr}
1001 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1002 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
1003 ; CHECK-NOFP-NEXT: mov r4, r3
1004 ; CHECK-NOFP-NEXT: mov r5, r2
1005 ; CHECK-NOFP-NEXT: bl __aeabi_fcmplt
1006 ; CHECK-NOFP-NEXT: cmp r0, #0
1007 ; CHECK-NOFP-NEXT: mov.w r1, #0
1008 ; CHECK-NOFP-NEXT: csel r0, r5, r4, eq
1009 ; CHECK-NOFP-NEXT: str r1, [r0]
1010 ; CHECK-NOFP-NEXT: pop {r4, r5, r7, pc}
1012 ; CHECK-FP-LABEL: test_br_cc:
1013 ; CHECK-FP: @ %bb.0: @ %common.ret
1014 ; CHECK-FP-NEXT: vmov r2, s1
1015 ; CHECK-FP-NEXT: vmov r3, s0
1016 ; CHECK-FP-NEXT: lsls r2, r2, #16
1017 ; CHECK-FP-NEXT: vmov s0, r2
1018 ; CHECK-FP-NEXT: lsls r2, r3, #16
1019 ; CHECK-FP-NEXT: vmov s2, r2
1020 ; CHECK-FP-NEXT: vcmp.f32 s2, s0
1021 ; CHECK-FP-NEXT: vmrs APSR_nzcv, fpscr
1022 ; CHECK-FP-NEXT: csel r0, r0, r1, pl
1023 ; CHECK-FP-NEXT: movs r1, #0
1024 ; CHECK-FP-NEXT: str r1, [r0]
1025 ; CHECK-FP-NEXT: bx lr
1026 %c = fcmp uge bfloat %a, %b
1027 br i1 %c, label %then, label %else
1029 store i32 0, ptr %p1
1032 store i32 0, ptr %p2
1036 define bfloat @test_phi(ptr %p1) {
1037 ; CHECK-NOFP-LABEL: test_phi:
1038 ; CHECK-NOFP: @ %bb.0: @ %entry
1039 ; CHECK-NOFP-NEXT: .save {r4, r5, r6, lr}
1040 ; CHECK-NOFP-NEXT: push {r4, r5, r6, lr}
1041 ; CHECK-NOFP-NEXT: ldrh r6, [r0]
1042 ; CHECK-NOFP-NEXT: mov r4, r0
1043 ; CHECK-NOFP-NEXT: .LBB36_1: @ %loop
1044 ; CHECK-NOFP-NEXT: @ =>This Inner Loop Header: Depth=1
1045 ; CHECK-NOFP-NEXT: mov r0, r4
1046 ; CHECK-NOFP-NEXT: mov r5, r6
1047 ; CHECK-NOFP-NEXT: ldrh r6, [r4]
1048 ; CHECK-NOFP-NEXT: bl test_dummy
1049 ; CHECK-NOFP-NEXT: lsls r0, r0, #31
1050 ; CHECK-NOFP-NEXT: bne .LBB36_1
1051 ; CHECK-NOFP-NEXT: @ %bb.2: @ %return
1052 ; CHECK-NOFP-NEXT: mov r0, r5
1053 ; CHECK-NOFP-NEXT: pop {r4, r5, r6, pc}
1055 ; CHECK-FP-LABEL: test_phi:
1056 ; CHECK-FP: @ %bb.0: @ %entry
1057 ; CHECK-FP-NEXT: .save {r4, lr}
1058 ; CHECK-FP-NEXT: push {r4, lr}
1059 ; CHECK-FP-NEXT: .vsave {d8, d9}
1060 ; CHECK-FP-NEXT: vpush {d8, d9}
1061 ; CHECK-FP-NEXT: mov r4, r0
1062 ; CHECK-FP-NEXT: ldrh r0, [r0]
1063 ; CHECK-FP-NEXT: vmov s18, r0
1064 ; CHECK-FP-NEXT: .LBB36_1: @ %loop
1065 ; CHECK-FP-NEXT: @ =>This Inner Loop Header: Depth=1
1066 ; CHECK-FP-NEXT: ldrh r0, [r4]
1067 ; CHECK-FP-NEXT: vmov.f32 s16, s18
1068 ; CHECK-FP-NEXT: vmov s18, r0
1069 ; CHECK-FP-NEXT: mov r0, r4
1070 ; CHECK-FP-NEXT: bl test_dummy
1071 ; CHECK-FP-NEXT: lsls r0, r0, #31
1072 ; CHECK-FP-NEXT: bne .LBB36_1
1073 ; CHECK-FP-NEXT: @ %bb.2: @ %return
1074 ; CHECK-FP-NEXT: vmov.f32 s0, s16
1075 ; CHECK-FP-NEXT: vpop {d8, d9}
1076 ; CHECK-FP-NEXT: pop {r4, pc}
1078 %a = load bfloat, ptr %p1
1081 %r = phi bfloat [%a, %entry], [%b, %loop]
1082 %b = load bfloat, ptr %p1
1083 %c = call i1 @test_dummy(ptr %p1)
1084 br i1 %c, label %loop, label %return
1089 declare i1 @test_dummy(ptr %p1) #0
1091 define i32 @test_fptosi_i32(bfloat %a) {
1092 ; CHECK-NOFP-LABEL: test_fptosi_i32:
1093 ; CHECK-NOFP: @ %bb.0:
1094 ; CHECK-NOFP-NEXT: .save {r7, lr}
1095 ; CHECK-NOFP-NEXT: push {r7, lr}
1096 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1097 ; CHECK-NOFP-NEXT: bl __aeabi_f2iz
1098 ; CHECK-NOFP-NEXT: pop {r7, pc}
1100 ; CHECK-FP-LABEL: test_fptosi_i32:
1101 ; CHECK-FP: @ %bb.0:
1102 ; CHECK-FP-NEXT: vmov r0, s0
1103 ; CHECK-FP-NEXT: lsls r0, r0, #16
1104 ; CHECK-FP-NEXT: vmov s0, r0
1105 ; CHECK-FP-NEXT: vcvt.s32.f32 s0, s0
1106 ; CHECK-FP-NEXT: vmov r0, s0
1107 ; CHECK-FP-NEXT: bx lr
1108 %r = fptosi bfloat %a to i32
1112 define i64 @test_fptosi_i64(bfloat %a) {
1113 ; CHECK-NOFP-LABEL: test_fptosi_i64:
1114 ; CHECK-NOFP: @ %bb.0:
1115 ; CHECK-NOFP-NEXT: .save {r7, lr}
1116 ; CHECK-NOFP-NEXT: push {r7, lr}
1117 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1118 ; CHECK-NOFP-NEXT: bl __aeabi_f2lz
1119 ; CHECK-NOFP-NEXT: pop {r7, pc}
1121 ; CHECK-FP-LABEL: test_fptosi_i64:
1122 ; CHECK-FP: @ %bb.0:
1123 ; CHECK-FP-NEXT: .save {r7, lr}
1124 ; CHECK-FP-NEXT: push {r7, lr}
1125 ; CHECK-FP-NEXT: vmov r0, s0
1126 ; CHECK-FP-NEXT: lsls r0, r0, #16
1127 ; CHECK-FP-NEXT: bl __aeabi_f2lz
1128 ; CHECK-FP-NEXT: pop {r7, pc}
1129 %r = fptosi bfloat %a to i64
1133 define i32 @test_fptoui_i32(bfloat %a) {
1134 ; CHECK-NOFP-LABEL: test_fptoui_i32:
1135 ; CHECK-NOFP: @ %bb.0:
1136 ; CHECK-NOFP-NEXT: .save {r7, lr}
1137 ; CHECK-NOFP-NEXT: push {r7, lr}
1138 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1139 ; CHECK-NOFP-NEXT: bl __aeabi_f2uiz
1140 ; CHECK-NOFP-NEXT: pop {r7, pc}
1142 ; CHECK-FP-LABEL: test_fptoui_i32:
1143 ; CHECK-FP: @ %bb.0:
1144 ; CHECK-FP-NEXT: vmov r0, s0
1145 ; CHECK-FP-NEXT: lsls r0, r0, #16
1146 ; CHECK-FP-NEXT: vmov s0, r0
1147 ; CHECK-FP-NEXT: vcvt.u32.f32 s0, s0
1148 ; CHECK-FP-NEXT: vmov r0, s0
1149 ; CHECK-FP-NEXT: bx lr
1150 %r = fptoui bfloat %a to i32
1154 define i64 @test_fptoui_i64(bfloat %a) {
1155 ; CHECK-NOFP-LABEL: test_fptoui_i64:
1156 ; CHECK-NOFP: @ %bb.0:
1157 ; CHECK-NOFP-NEXT: .save {r7, lr}
1158 ; CHECK-NOFP-NEXT: push {r7, lr}
1159 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1160 ; CHECK-NOFP-NEXT: bl __aeabi_f2ulz
1161 ; CHECK-NOFP-NEXT: pop {r7, pc}
1163 ; CHECK-FP-LABEL: test_fptoui_i64:
1164 ; CHECK-FP: @ %bb.0:
1165 ; CHECK-FP-NEXT: .save {r7, lr}
1166 ; CHECK-FP-NEXT: push {r7, lr}
1167 ; CHECK-FP-NEXT: vmov r0, s0
1168 ; CHECK-FP-NEXT: lsls r0, r0, #16
1169 ; CHECK-FP-NEXT: bl __aeabi_f2ulz
1170 ; CHECK-FP-NEXT: pop {r7, pc}
1171 %r = fptoui bfloat %a to i64
1175 define bfloat @test_uitofp_i32(i32 %a) {
1177 ; CHECK-NOFP-LABEL: test_uitofp_i32:
1178 ; CHECK-NOFP: @ %bb.0:
1179 ; CHECK-NOFP-NEXT: .save {r7, lr}
1180 ; CHECK-NOFP-NEXT: push {r7, lr}
1181 ; CHECK-NOFP-NEXT: bl __aeabi_ui2f
1182 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1183 ; CHECK-NOFP-NEXT: pop {r7, pc}
1185 ; CHECK-FP-LABEL: test_uitofp_i32:
1186 ; CHECK-FP: @ %bb.0:
1187 ; CHECK-FP-NEXT: .save {r7, lr}
1188 ; CHECK-FP-NEXT: push {r7, lr}
1189 ; CHECK-FP-NEXT: vmov s0, r0
1190 ; CHECK-FP-NEXT: vcvt.f32.u32 s0, s0
1191 ; CHECK-FP-NEXT: bl __truncsfbf2
1192 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1193 ; CHECK-FP-NEXT: vmov s0, r0
1194 ; CHECK-FP-NEXT: pop {r7, pc}
1195 %r = uitofp i32 %a to bfloat
1199 define bfloat @test_uitofp_i64(i64 %a) {
1201 ; CHECK-NOFP-LABEL: test_uitofp_i64:
1202 ; CHECK-NOFP: @ %bb.0:
1203 ; CHECK-NOFP-NEXT: .save {r7, lr}
1204 ; CHECK-NOFP-NEXT: push {r7, lr}
1205 ; CHECK-NOFP-NEXT: bl __aeabi_ul2f
1206 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1207 ; CHECK-NOFP-NEXT: pop {r7, pc}
1209 ; CHECK-FP-LABEL: test_uitofp_i64:
1210 ; CHECK-FP: @ %bb.0:
1211 ; CHECK-FP-NEXT: .save {r7, lr}
1212 ; CHECK-FP-NEXT: push {r7, lr}
1213 ; CHECK-FP-NEXT: bl __aeabi_ul2f
1214 ; CHECK-FP-NEXT: vmov s0, r0
1215 ; CHECK-FP-NEXT: bl __truncsfbf2
1216 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1217 ; CHECK-FP-NEXT: vmov s0, r0
1218 ; CHECK-FP-NEXT: pop {r7, pc}
1219 %r = uitofp i64 %a to bfloat
1223 define bfloat @test_sitofp_i32(i32 %a) {
1225 ; CHECK-NOFP-LABEL: test_sitofp_i32:
1226 ; CHECK-NOFP: @ %bb.0:
1227 ; CHECK-NOFP-NEXT: .save {r7, lr}
1228 ; CHECK-NOFP-NEXT: push {r7, lr}
1229 ; CHECK-NOFP-NEXT: bl __aeabi_i2f
1230 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1231 ; CHECK-NOFP-NEXT: pop {r7, pc}
1233 ; CHECK-FP-LABEL: test_sitofp_i32:
1234 ; CHECK-FP: @ %bb.0:
1235 ; CHECK-FP-NEXT: .save {r7, lr}
1236 ; CHECK-FP-NEXT: push {r7, lr}
1237 ; CHECK-FP-NEXT: vmov s0, r0
1238 ; CHECK-FP-NEXT: vcvt.f32.s32 s0, s0
1239 ; CHECK-FP-NEXT: bl __truncsfbf2
1240 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1241 ; CHECK-FP-NEXT: vmov s0, r0
1242 ; CHECK-FP-NEXT: pop {r7, pc}
1243 %r = sitofp i32 %a to bfloat
1247 define bfloat @test_sitofp_i64(i64 %a) {
1249 ; CHECK-NOFP-LABEL: test_sitofp_i64:
1250 ; CHECK-NOFP: @ %bb.0:
1251 ; CHECK-NOFP-NEXT: .save {r7, lr}
1252 ; CHECK-NOFP-NEXT: push {r7, lr}
1253 ; CHECK-NOFP-NEXT: bl __aeabi_l2f
1254 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1255 ; CHECK-NOFP-NEXT: pop {r7, pc}
1257 ; CHECK-FP-LABEL: test_sitofp_i64:
1258 ; CHECK-FP: @ %bb.0:
1259 ; CHECK-FP-NEXT: .save {r7, lr}
1260 ; CHECK-FP-NEXT: push {r7, lr}
1261 ; CHECK-FP-NEXT: bl __aeabi_l2f
1262 ; CHECK-FP-NEXT: vmov s0, r0
1263 ; CHECK-FP-NEXT: bl __truncsfbf2
1264 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1265 ; CHECK-FP-NEXT: vmov s0, r0
1266 ; CHECK-FP-NEXT: pop {r7, pc}
1267 %r = sitofp i64 %a to bfloat
1271 define bfloat @test_uitofp_i32_fadd(i32 %a, bfloat %b) {
1273 ; CHECK-NOFP-LABEL: test_uitofp_i32_fadd:
1274 ; CHECK-NOFP: @ %bb.0:
1275 ; CHECK-NOFP-NEXT: .save {r4, lr}
1276 ; CHECK-NOFP-NEXT: push {r4, lr}
1277 ; CHECK-NOFP-NEXT: mov r4, r1
1278 ; CHECK-NOFP-NEXT: bl __aeabi_ui2f
1279 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1280 ; CHECK-NOFP-NEXT: lsls r2, r4, #16
1281 ; CHECK-NOFP-NEXT: lsls r1, r0, #16
1282 ; CHECK-NOFP-NEXT: mov r0, r2
1283 ; CHECK-NOFP-NEXT: bl __aeabi_fadd
1284 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1285 ; CHECK-NOFP-NEXT: pop {r4, pc}
1287 ; CHECK-FP-LABEL: test_uitofp_i32_fadd:
1288 ; CHECK-FP: @ %bb.0:
1289 ; CHECK-FP-NEXT: .save {r4, lr}
1290 ; CHECK-FP-NEXT: push {r4, lr}
1291 ; CHECK-FP-NEXT: vmov s2, r0
1292 ; CHECK-FP-NEXT: vmov r4, s0
1293 ; CHECK-FP-NEXT: vcvt.f32.u32 s2, s2
1294 ; CHECK-FP-NEXT: vmov.f32 s0, s2
1295 ; CHECK-FP-NEXT: bl __truncsfbf2
1296 ; CHECK-FP-NEXT: vmov r0, s0
1297 ; CHECK-FP-NEXT: lsls r1, r4, #16
1298 ; CHECK-FP-NEXT: vmov s0, r1
1299 ; CHECK-FP-NEXT: lsls r0, r0, #16
1300 ; CHECK-FP-NEXT: vmov s2, r0
1301 ; CHECK-FP-NEXT: vadd.f32 s0, s0, s2
1302 ; CHECK-FP-NEXT: bl __truncsfbf2
1303 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1304 ; CHECK-FP-NEXT: vmov s0, r0
1305 ; CHECK-FP-NEXT: pop {r4, pc}
1306 %c = uitofp i32 %a to bfloat
1307 %r = fadd bfloat %b, %c
1311 define bfloat @test_sitofp_i32_fadd(i32 %a, bfloat %b) {
1313 ; CHECK-NOFP-LABEL: test_sitofp_i32_fadd:
1314 ; CHECK-NOFP: @ %bb.0:
1315 ; CHECK-NOFP-NEXT: .save {r4, lr}
1316 ; CHECK-NOFP-NEXT: push {r4, lr}
1317 ; CHECK-NOFP-NEXT: mov r4, r1
1318 ; CHECK-NOFP-NEXT: bl __aeabi_i2f
1319 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1320 ; CHECK-NOFP-NEXT: lsls r2, r4, #16
1321 ; CHECK-NOFP-NEXT: lsls r1, r0, #16
1322 ; CHECK-NOFP-NEXT: mov r0, r2
1323 ; CHECK-NOFP-NEXT: bl __aeabi_fadd
1324 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1325 ; CHECK-NOFP-NEXT: pop {r4, pc}
1327 ; CHECK-FP-LABEL: test_sitofp_i32_fadd:
1328 ; CHECK-FP: @ %bb.0:
1329 ; CHECK-FP-NEXT: .save {r4, lr}
1330 ; CHECK-FP-NEXT: push {r4, lr}
1331 ; CHECK-FP-NEXT: vmov s2, r0
1332 ; CHECK-FP-NEXT: vmov r4, s0
1333 ; CHECK-FP-NEXT: vcvt.f32.s32 s2, s2
1334 ; CHECK-FP-NEXT: vmov.f32 s0, s2
1335 ; CHECK-FP-NEXT: bl __truncsfbf2
1336 ; CHECK-FP-NEXT: vmov r0, s0
1337 ; CHECK-FP-NEXT: lsls r1, r4, #16
1338 ; CHECK-FP-NEXT: vmov s0, r1
1339 ; CHECK-FP-NEXT: lsls r0, r0, #16
1340 ; CHECK-FP-NEXT: vmov s2, r0
1341 ; CHECK-FP-NEXT: vadd.f32 s0, s0, s2
1342 ; CHECK-FP-NEXT: bl __truncsfbf2
1343 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1344 ; CHECK-FP-NEXT: vmov s0, r0
1345 ; CHECK-FP-NEXT: pop {r4, pc}
1346 %c = sitofp i32 %a to bfloat
1347 %r = fadd bfloat %b, %c
1351 define bfloat @test_fptrunc_float(float %a) {
1353 ; CHECK-NOFP-LABEL: test_fptrunc_float:
1354 ; CHECK-NOFP: @ %bb.0:
1355 ; CHECK-NOFP-NEXT: .save {r7, lr}
1356 ; CHECK-NOFP-NEXT: push {r7, lr}
1357 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1358 ; CHECK-NOFP-NEXT: pop {r7, pc}
1360 ; CHECK-FP-LABEL: test_fptrunc_float:
1361 ; CHECK-FP: @ %bb.0:
1362 ; CHECK-FP-NEXT: .save {r7, lr}
1363 ; CHECK-FP-NEXT: push {r7, lr}
1364 ; CHECK-FP-NEXT: bl __truncsfbf2
1365 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1366 ; CHECK-FP-NEXT: vmov s0, r0
1367 ; CHECK-FP-NEXT: pop {r7, pc}
1368 %r = fptrunc float %a to bfloat
1372 define bfloat @test_fptrunc_double(double %a) {
1374 ; CHECK-NOFP-LABEL: test_fptrunc_double:
1375 ; CHECK-NOFP: @ %bb.0:
1376 ; CHECK-NOFP-NEXT: .save {r7, lr}
1377 ; CHECK-NOFP-NEXT: push {r7, lr}
1378 ; CHECK-NOFP-NEXT: bl __truncdfbf2
1379 ; CHECK-NOFP-NEXT: pop {r7, pc}
1381 ; CHECK-FP-LABEL: test_fptrunc_double:
1382 ; CHECK-FP: @ %bb.0:
1383 ; CHECK-FP-NEXT: .save {r7, lr}
1384 ; CHECK-FP-NEXT: push {r7, lr}
1385 ; CHECK-FP-NEXT: bl __truncdfbf2
1386 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1387 ; CHECK-FP-NEXT: vmov s0, r0
1388 ; CHECK-FP-NEXT: pop {r7, pc}
1389 %r = fptrunc double %a to bfloat
1393 define float @test_fpext_float(bfloat %a) {
1394 ; CHECK-NOFP-LABEL: test_fpext_float:
1395 ; CHECK-NOFP: @ %bb.0:
1396 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1397 ; CHECK-NOFP-NEXT: bx lr
1399 ; CHECK-FP-LABEL: test_fpext_float:
1400 ; CHECK-FP: @ %bb.0:
1401 ; CHECK-FP-NEXT: vmov r0, s0
1402 ; CHECK-FP-NEXT: lsls r0, r0, #16
1403 ; CHECK-FP-NEXT: vmov s0, r0
1404 ; CHECK-FP-NEXT: bx lr
1405 %r = fpext bfloat %a to float
1409 define double @test_fpext_double(bfloat %a) {
1410 ; CHECK-NOFP-LABEL: test_fpext_double:
1411 ; CHECK-NOFP: @ %bb.0:
1412 ; CHECK-NOFP-NEXT: .save {r7, lr}
1413 ; CHECK-NOFP-NEXT: push {r7, lr}
1414 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1415 ; CHECK-NOFP-NEXT: bl __aeabi_f2d
1416 ; CHECK-NOFP-NEXT: pop {r7, pc}
1418 ; CHECK-FPNO64-LABEL: test_fpext_double:
1419 ; CHECK-FPNO64: @ %bb.0:
1420 ; CHECK-FPNO64-NEXT: .save {r7, lr}
1421 ; CHECK-FPNO64-NEXT: push {r7, lr}
1422 ; CHECK-FPNO64-NEXT: vmov r0, s0
1423 ; CHECK-FPNO64-NEXT: lsls r0, r0, #16
1424 ; CHECK-FPNO64-NEXT: bl __aeabi_f2d
1425 ; CHECK-FPNO64-NEXT: vmov d0, r0, r1
1426 ; CHECK-FPNO64-NEXT: pop {r7, pc}
1428 ; CHECK-FP64-LABEL: test_fpext_double:
1429 ; CHECK-FP64: @ %bb.0:
1430 ; CHECK-FP64-NEXT: vmov r0, s0
1431 ; CHECK-FP64-NEXT: lsls r0, r0, #16
1432 ; CHECK-FP64-NEXT: vmov s0, r0
1433 ; CHECK-FP64-NEXT: vcvt.f64.f32 d0, s0
1434 ; CHECK-FP64-NEXT: bx lr
1435 %r = fpext bfloat %a to double
1439 define i16 @test_bitcast_bfloattoi16(bfloat %a) {
1440 ; CHECK-NOFP-LABEL: test_bitcast_bfloattoi16:
1441 ; CHECK-NOFP: @ %bb.0:
1442 ; CHECK-NOFP-NEXT: bx lr
1444 ; CHECK-FP-LABEL: test_bitcast_bfloattoi16:
1445 ; CHECK-FP: @ %bb.0:
1446 ; CHECK-FP-NEXT: vmov r0, s0
1447 ; CHECK-FP-NEXT: bx lr
1448 %r = bitcast bfloat %a to i16
1452 define bfloat @test_bitcast_i16tobfloat(i16 %a) {
1453 ; CHECK-NOFP-LABEL: test_bitcast_i16tobfloat:
1454 ; CHECK-NOFP: @ %bb.0:
1455 ; CHECK-NOFP-NEXT: bx lr
1457 ; CHECK-FP-LABEL: test_bitcast_i16tobfloat:
1458 ; CHECK-FP: @ %bb.0:
1459 ; CHECK-FP-NEXT: vmov s0, r0
1460 ; CHECK-FP-NEXT: bx lr
1461 %r = bitcast i16 %a to bfloat
1465 declare bfloat @llvm.sqrt.f16(bfloat %a) #0
1466 declare bfloat @llvm.powi.f16.i32(bfloat %a, i32 %b) #0
1467 declare bfloat @llvm.sin.f16(bfloat %a) #0
1468 declare bfloat @llvm.cos.f16(bfloat %a) #0
1469 declare bfloat @llvm.tan.f16(bfloat %a) #0
1470 declare bfloat @llvm.asin.f16(bfloat %a) #0
1471 declare bfloat @llvm.acos.f16(bfloat %a) #0
1472 declare bfloat @llvm.atan.f16(bfloat %a) #0
1473 declare bfloat @llvm.atan2.f16(bfloat %a, bfloat %b) #0
1474 declare bfloat @llvm.sinh.f16(bfloat %a) #0
1475 declare bfloat @llvm.cosh.f16(bfloat %a) #0
1476 declare bfloat @llvm.tanh.f16(bfloat %a) #0
1477 declare bfloat @llvm.pow.f16(bfloat %a, bfloat %b) #0
1478 declare bfloat @llvm.exp.f16(bfloat %a) #0
1479 declare bfloat @llvm.exp2.f16(bfloat %a) #0
1480 declare bfloat @llvm.log.f16(bfloat %a) #0
1481 declare bfloat @llvm.log10.f16(bfloat %a) #0
1482 declare bfloat @llvm.log2.f16(bfloat %a) #0
1483 declare bfloat @llvm.fma.f16(bfloat %a, bfloat %b, bfloat %c) #0
1484 declare bfloat @llvm.fabs.f16(bfloat %a) #0
1485 declare bfloat @llvm.minnum.f16(bfloat %a, bfloat %b) #0
1486 declare bfloat @llvm.maxnum.f16(bfloat %a, bfloat %b) #0
1487 declare bfloat @llvm.copysign.f16(bfloat %a, bfloat %b) #0
1488 declare bfloat @llvm.floor.f16(bfloat %a) #0
1489 declare bfloat @llvm.ceil.f16(bfloat %a) #0
1490 declare bfloat @llvm.trunc.f16(bfloat %a) #0
1491 declare bfloat @llvm.rint.f16(bfloat %a) #0
1492 declare bfloat @llvm.nearbyint.f16(bfloat %a) #0
1493 declare bfloat @llvm.round.f16(bfloat %a) #0
1494 declare bfloat @llvm.roundeven.f16(bfloat %a) #0
1495 declare bfloat @llvm.fmuladd.f16(bfloat %a, bfloat %b, bfloat %c) #0
1498 define bfloat @test_sqrt(bfloat %a) {
1500 ; CHECK-NOFP-LABEL: test_sqrt:
1501 ; CHECK-NOFP: @ %bb.0:
1502 ; CHECK-NOFP-NEXT: .save {r7, lr}
1503 ; CHECK-NOFP-NEXT: push {r7, lr}
1504 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1505 ; CHECK-NOFP-NEXT: bl sqrtf
1506 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1507 ; CHECK-NOFP-NEXT: pop {r7, pc}
1509 ; CHECK-FP-LABEL: test_sqrt:
1510 ; CHECK-FP: @ %bb.0:
1511 ; CHECK-FP-NEXT: .save {r7, lr}
1512 ; CHECK-FP-NEXT: push {r7, lr}
1513 ; CHECK-FP-NEXT: vmov r0, s0
1514 ; CHECK-FP-NEXT: lsls r0, r0, #16
1515 ; CHECK-FP-NEXT: vmov s0, r0
1516 ; CHECK-FP-NEXT: vsqrt.f32 s0, s0
1517 ; CHECK-FP-NEXT: bl __truncsfbf2
1518 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1519 ; CHECK-FP-NEXT: vmov s0, r0
1520 ; CHECK-FP-NEXT: pop {r7, pc}
1521 %r = call bfloat @llvm.sqrt.f16(bfloat %a)
1525 define bfloat @test_powi(bfloat %a, i32 %b) {
1527 ; CHECK-NOFP-LABEL: test_powi:
1528 ; CHECK-NOFP: @ %bb.0:
1529 ; CHECK-NOFP-NEXT: .save {r7, lr}
1530 ; CHECK-NOFP-NEXT: push {r7, lr}
1531 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1532 ; CHECK-NOFP-NEXT: bl __powisf2
1533 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1534 ; CHECK-NOFP-NEXT: pop {r7, pc}
1536 ; CHECK-FP-LABEL: test_powi:
1537 ; CHECK-FP: @ %bb.0:
1538 ; CHECK-FP-NEXT: .save {r7, lr}
1539 ; CHECK-FP-NEXT: push {r7, lr}
1540 ; CHECK-FP-NEXT: vmov r1, s0
1541 ; CHECK-FP-NEXT: lsls r1, r1, #16
1542 ; CHECK-FP-NEXT: vmov s0, r1
1543 ; CHECK-FP-NEXT: bl __powisf2
1544 ; CHECK-FP-NEXT: bl __truncsfbf2
1545 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1546 ; CHECK-FP-NEXT: vmov s0, r0
1547 ; CHECK-FP-NEXT: pop {r7, pc}
1548 %r = call bfloat @llvm.powi.f16.i32(bfloat %a, i32 %b)
1553 define bfloat @test_sin(bfloat %a) {
1555 ; CHECK-NOFP-LABEL: test_sin:
1556 ; CHECK-NOFP: @ %bb.0:
1557 ; CHECK-NOFP-NEXT: .save {r7, lr}
1558 ; CHECK-NOFP-NEXT: push {r7, lr}
1559 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1560 ; CHECK-NOFP-NEXT: bl sinf
1561 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1562 ; CHECK-NOFP-NEXT: pop {r7, pc}
1564 ; CHECK-FP-LABEL: test_sin:
1565 ; CHECK-FP: @ %bb.0:
1566 ; CHECK-FP-NEXT: .save {r7, lr}
1567 ; CHECK-FP-NEXT: push {r7, lr}
1568 ; CHECK-FP-NEXT: vmov r0, s0
1569 ; CHECK-FP-NEXT: lsls r0, r0, #16
1570 ; CHECK-FP-NEXT: vmov s0, r0
1571 ; CHECK-FP-NEXT: bl sinf
1572 ; CHECK-FP-NEXT: bl __truncsfbf2
1573 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1574 ; CHECK-FP-NEXT: vmov s0, r0
1575 ; CHECK-FP-NEXT: pop {r7, pc}
1576 %r = call bfloat @llvm.sin.f16(bfloat %a)
1580 define bfloat @test_cos(bfloat %a) {
1582 ; CHECK-NOFP-LABEL: test_cos:
1583 ; CHECK-NOFP: @ %bb.0:
1584 ; CHECK-NOFP-NEXT: .save {r7, lr}
1585 ; CHECK-NOFP-NEXT: push {r7, lr}
1586 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1587 ; CHECK-NOFP-NEXT: bl cosf
1588 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1589 ; CHECK-NOFP-NEXT: pop {r7, pc}
1591 ; CHECK-FP-LABEL: test_cos:
1592 ; CHECK-FP: @ %bb.0:
1593 ; CHECK-FP-NEXT: .save {r7, lr}
1594 ; CHECK-FP-NEXT: push {r7, lr}
1595 ; CHECK-FP-NEXT: vmov r0, s0
1596 ; CHECK-FP-NEXT: lsls r0, r0, #16
1597 ; CHECK-FP-NEXT: vmov s0, r0
1598 ; CHECK-FP-NEXT: bl cosf
1599 ; CHECK-FP-NEXT: bl __truncsfbf2
1600 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1601 ; CHECK-FP-NEXT: vmov s0, r0
1602 ; CHECK-FP-NEXT: pop {r7, pc}
1603 %r = call bfloat @llvm.cos.f16(bfloat %a)
1607 define bfloat @test_tan(bfloat %a) {
1609 ; CHECK-NOFP-LABEL: test_tan:
1610 ; CHECK-NOFP: @ %bb.0:
1611 ; CHECK-NOFP-NEXT: .save {r7, lr}
1612 ; CHECK-NOFP-NEXT: push {r7, lr}
1613 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1614 ; CHECK-NOFP-NEXT: bl tanf
1615 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1616 ; CHECK-NOFP-NEXT: pop {r7, pc}
1618 ; CHECK-FP-LABEL: test_tan:
1619 ; CHECK-FP: @ %bb.0:
1620 ; CHECK-FP-NEXT: .save {r7, lr}
1621 ; CHECK-FP-NEXT: push {r7, lr}
1622 ; CHECK-FP-NEXT: vmov r0, s0
1623 ; CHECK-FP-NEXT: lsls r0, r0, #16
1624 ; CHECK-FP-NEXT: vmov s0, r0
1625 ; CHECK-FP-NEXT: bl tanf
1626 ; CHECK-FP-NEXT: bl __truncsfbf2
1627 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1628 ; CHECK-FP-NEXT: vmov s0, r0
1629 ; CHECK-FP-NEXT: pop {r7, pc}
1630 %r = call bfloat @llvm.tan.f16(bfloat %a)
1634 define bfloat @test_acos(bfloat %a) {
1636 ; CHECK-NOFP-LABEL: test_acos:
1637 ; CHECK-NOFP: @ %bb.0:
1638 ; CHECK-NOFP-NEXT: .save {r7, lr}
1639 ; CHECK-NOFP-NEXT: push {r7, lr}
1640 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1641 ; CHECK-NOFP-NEXT: bl acosf
1642 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1643 ; CHECK-NOFP-NEXT: pop {r7, pc}
1645 ; CHECK-FP-LABEL: test_acos:
1646 ; CHECK-FP: @ %bb.0:
1647 ; CHECK-FP-NEXT: .save {r7, lr}
1648 ; CHECK-FP-NEXT: push {r7, lr}
1649 ; CHECK-FP-NEXT: vmov r0, s0
1650 ; CHECK-FP-NEXT: lsls r0, r0, #16
1651 ; CHECK-FP-NEXT: vmov s0, r0
1652 ; CHECK-FP-NEXT: bl acosf
1653 ; CHECK-FP-NEXT: bl __truncsfbf2
1654 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1655 ; CHECK-FP-NEXT: vmov s0, r0
1656 ; CHECK-FP-NEXT: pop {r7, pc}
1657 %r = call bfloat @llvm.acos.f16(bfloat %a)
1661 define bfloat @test_asin(bfloat %a) {
1663 ; CHECK-NOFP-LABEL: test_asin:
1664 ; CHECK-NOFP: @ %bb.0:
1665 ; CHECK-NOFP-NEXT: .save {r7, lr}
1666 ; CHECK-NOFP-NEXT: push {r7, lr}
1667 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1668 ; CHECK-NOFP-NEXT: bl asinf
1669 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1670 ; CHECK-NOFP-NEXT: pop {r7, pc}
1672 ; CHECK-FP-LABEL: test_asin:
1673 ; CHECK-FP: @ %bb.0:
1674 ; CHECK-FP-NEXT: .save {r7, lr}
1675 ; CHECK-FP-NEXT: push {r7, lr}
1676 ; CHECK-FP-NEXT: vmov r0, s0
1677 ; CHECK-FP-NEXT: lsls r0, r0, #16
1678 ; CHECK-FP-NEXT: vmov s0, r0
1679 ; CHECK-FP-NEXT: bl asinf
1680 ; CHECK-FP-NEXT: bl __truncsfbf2
1681 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1682 ; CHECK-FP-NEXT: vmov s0, r0
1683 ; CHECK-FP-NEXT: pop {r7, pc}
1684 %r = call bfloat @llvm.asin.f16(bfloat %a)
1688 define bfloat @test_atan(bfloat %a) {
1690 ; CHECK-NOFP-LABEL: test_atan:
1691 ; CHECK-NOFP: @ %bb.0:
1692 ; CHECK-NOFP-NEXT: .save {r7, lr}
1693 ; CHECK-NOFP-NEXT: push {r7, lr}
1694 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1695 ; CHECK-NOFP-NEXT: bl atanf
1696 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1697 ; CHECK-NOFP-NEXT: pop {r7, pc}
1699 ; CHECK-FP-LABEL: test_atan:
1700 ; CHECK-FP: @ %bb.0:
1701 ; CHECK-FP-NEXT: .save {r7, lr}
1702 ; CHECK-FP-NEXT: push {r7, lr}
1703 ; CHECK-FP-NEXT: vmov r0, s0
1704 ; CHECK-FP-NEXT: lsls r0, r0, #16
1705 ; CHECK-FP-NEXT: vmov s0, r0
1706 ; CHECK-FP-NEXT: bl atanf
1707 ; CHECK-FP-NEXT: bl __truncsfbf2
1708 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1709 ; CHECK-FP-NEXT: vmov s0, r0
1710 ; CHECK-FP-NEXT: pop {r7, pc}
1711 %r = call bfloat @llvm.atan.f16(bfloat %a)
1715 define bfloat @test_atan2(bfloat %a, bfloat %b) {
1717 ; CHECK-NOFP-LABEL: test_atan2:
1718 ; CHECK-NOFP: @ %bb.0:
1719 ; CHECK-NOFP-NEXT: .save {r7, lr}
1720 ; CHECK-NOFP-NEXT: push {r7, lr}
1721 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1722 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
1723 ; CHECK-NOFP-NEXT: bl atan2f
1724 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1725 ; CHECK-NOFP-NEXT: pop {r7, pc}
1727 ; CHECK-FP-LABEL: test_atan2:
1728 ; CHECK-FP: @ %bb.0:
1729 ; CHECK-FP-NEXT: .save {r7, lr}
1730 ; CHECK-FP-NEXT: push {r7, lr}
1731 ; CHECK-FP-NEXT: vmov r0, s1
1732 ; CHECK-FP-NEXT: vmov r1, s0
1733 ; CHECK-FP-NEXT: lsls r0, r0, #16
1734 ; CHECK-FP-NEXT: lsls r1, r1, #16
1735 ; CHECK-FP-NEXT: vmov s1, r0
1736 ; CHECK-FP-NEXT: vmov s0, r1
1737 ; CHECK-FP-NEXT: bl atan2f
1738 ; CHECK-FP-NEXT: bl __truncsfbf2
1739 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1740 ; CHECK-FP-NEXT: vmov s0, r0
1741 ; CHECK-FP-NEXT: pop {r7, pc}
1742 %r = call bfloat @llvm.atan2.f16(bfloat %a, bfloat %b)
1746 define bfloat @test_cosh(bfloat %a) {
1748 ; CHECK-NOFP-LABEL: test_cosh:
1749 ; CHECK-NOFP: @ %bb.0:
1750 ; CHECK-NOFP-NEXT: .save {r7, lr}
1751 ; CHECK-NOFP-NEXT: push {r7, lr}
1752 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1753 ; CHECK-NOFP-NEXT: bl coshf
1754 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1755 ; CHECK-NOFP-NEXT: pop {r7, pc}
1757 ; CHECK-FP-LABEL: test_cosh:
1758 ; CHECK-FP: @ %bb.0:
1759 ; CHECK-FP-NEXT: .save {r7, lr}
1760 ; CHECK-FP-NEXT: push {r7, lr}
1761 ; CHECK-FP-NEXT: vmov r0, s0
1762 ; CHECK-FP-NEXT: lsls r0, r0, #16
1763 ; CHECK-FP-NEXT: vmov s0, r0
1764 ; CHECK-FP-NEXT: bl coshf
1765 ; CHECK-FP-NEXT: bl __truncsfbf2
1766 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1767 ; CHECK-FP-NEXT: vmov s0, r0
1768 ; CHECK-FP-NEXT: pop {r7, pc}
1769 %r = call bfloat @llvm.cosh.f16(bfloat %a)
1773 define bfloat @test_sinh(bfloat %a) {
1775 ; CHECK-NOFP-LABEL: test_sinh:
1776 ; CHECK-NOFP: @ %bb.0:
1777 ; CHECK-NOFP-NEXT: .save {r7, lr}
1778 ; CHECK-NOFP-NEXT: push {r7, lr}
1779 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1780 ; CHECK-NOFP-NEXT: bl sinhf
1781 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1782 ; CHECK-NOFP-NEXT: pop {r7, pc}
1784 ; CHECK-FP-LABEL: test_sinh:
1785 ; CHECK-FP: @ %bb.0:
1786 ; CHECK-FP-NEXT: .save {r7, lr}
1787 ; CHECK-FP-NEXT: push {r7, lr}
1788 ; CHECK-FP-NEXT: vmov r0, s0
1789 ; CHECK-FP-NEXT: lsls r0, r0, #16
1790 ; CHECK-FP-NEXT: vmov s0, r0
1791 ; CHECK-FP-NEXT: bl sinhf
1792 ; CHECK-FP-NEXT: bl __truncsfbf2
1793 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1794 ; CHECK-FP-NEXT: vmov s0, r0
1795 ; CHECK-FP-NEXT: pop {r7, pc}
1796 %r = call bfloat @llvm.sinh.f16(bfloat %a)
1800 define bfloat @test_tanh(bfloat %a) {
1802 ; CHECK-NOFP-LABEL: test_tanh:
1803 ; CHECK-NOFP: @ %bb.0:
1804 ; CHECK-NOFP-NEXT: .save {r7, lr}
1805 ; CHECK-NOFP-NEXT: push {r7, lr}
1806 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1807 ; CHECK-NOFP-NEXT: bl tanhf
1808 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1809 ; CHECK-NOFP-NEXT: pop {r7, pc}
1811 ; CHECK-FP-LABEL: test_tanh:
1812 ; CHECK-FP: @ %bb.0:
1813 ; CHECK-FP-NEXT: .save {r7, lr}
1814 ; CHECK-FP-NEXT: push {r7, lr}
1815 ; CHECK-FP-NEXT: vmov r0, s0
1816 ; CHECK-FP-NEXT: lsls r0, r0, #16
1817 ; CHECK-FP-NEXT: vmov s0, r0
1818 ; CHECK-FP-NEXT: bl tanhf
1819 ; CHECK-FP-NEXT: bl __truncsfbf2
1820 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1821 ; CHECK-FP-NEXT: vmov s0, r0
1822 ; CHECK-FP-NEXT: pop {r7, pc}
1823 %r = call bfloat @llvm.tanh.f16(bfloat %a)
1827 define bfloat @test_pow(bfloat %a, bfloat %b) {
1829 ; CHECK-NOFP-LABEL: test_pow:
1830 ; CHECK-NOFP: @ %bb.0:
1831 ; CHECK-NOFP-NEXT: .save {r7, lr}
1832 ; CHECK-NOFP-NEXT: push {r7, lr}
1833 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1834 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
1835 ; CHECK-NOFP-NEXT: bl powf
1836 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1837 ; CHECK-NOFP-NEXT: pop {r7, pc}
1839 ; CHECK-FP-LABEL: test_pow:
1840 ; CHECK-FP: @ %bb.0:
1841 ; CHECK-FP-NEXT: .save {r7, lr}
1842 ; CHECK-FP-NEXT: push {r7, lr}
1843 ; CHECK-FP-NEXT: vmov r0, s1
1844 ; CHECK-FP-NEXT: vmov r1, s0
1845 ; CHECK-FP-NEXT: lsls r0, r0, #16
1846 ; CHECK-FP-NEXT: lsls r1, r1, #16
1847 ; CHECK-FP-NEXT: vmov s1, r0
1848 ; CHECK-FP-NEXT: vmov s0, r1
1849 ; CHECK-FP-NEXT: bl powf
1850 ; CHECK-FP-NEXT: bl __truncsfbf2
1851 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1852 ; CHECK-FP-NEXT: vmov s0, r0
1853 ; CHECK-FP-NEXT: pop {r7, pc}
1854 %r = call bfloat @llvm.pow.f16(bfloat %a, bfloat %b)
1858 define bfloat @test_exp(bfloat %a) {
1860 ; CHECK-NOFP-LABEL: test_exp:
1861 ; CHECK-NOFP: @ %bb.0:
1862 ; CHECK-NOFP-NEXT: .save {r7, lr}
1863 ; CHECK-NOFP-NEXT: push {r7, lr}
1864 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1865 ; CHECK-NOFP-NEXT: bl expf
1866 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1867 ; CHECK-NOFP-NEXT: pop {r7, pc}
1869 ; CHECK-FP-LABEL: test_exp:
1870 ; CHECK-FP: @ %bb.0:
1871 ; CHECK-FP-NEXT: .save {r7, lr}
1872 ; CHECK-FP-NEXT: push {r7, lr}
1873 ; CHECK-FP-NEXT: vmov r0, s0
1874 ; CHECK-FP-NEXT: lsls r0, r0, #16
1875 ; CHECK-FP-NEXT: vmov s0, r0
1876 ; CHECK-FP-NEXT: bl expf
1877 ; CHECK-FP-NEXT: bl __truncsfbf2
1878 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1879 ; CHECK-FP-NEXT: vmov s0, r0
1880 ; CHECK-FP-NEXT: pop {r7, pc}
1881 %r = call bfloat @llvm.exp.f16(bfloat %a)
1885 define bfloat @test_exp2(bfloat %a) {
1887 ; CHECK-NOFP-LABEL: test_exp2:
1888 ; CHECK-NOFP: @ %bb.0:
1889 ; CHECK-NOFP-NEXT: .save {r7, lr}
1890 ; CHECK-NOFP-NEXT: push {r7, lr}
1891 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1892 ; CHECK-NOFP-NEXT: bl exp2f
1893 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1894 ; CHECK-NOFP-NEXT: pop {r7, pc}
1896 ; CHECK-FP-LABEL: test_exp2:
1897 ; CHECK-FP: @ %bb.0:
1898 ; CHECK-FP-NEXT: .save {r7, lr}
1899 ; CHECK-FP-NEXT: push {r7, lr}
1900 ; CHECK-FP-NEXT: vmov r0, s0
1901 ; CHECK-FP-NEXT: lsls r0, r0, #16
1902 ; CHECK-FP-NEXT: vmov s0, r0
1903 ; CHECK-FP-NEXT: bl exp2f
1904 ; CHECK-FP-NEXT: bl __truncsfbf2
1905 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1906 ; CHECK-FP-NEXT: vmov s0, r0
1907 ; CHECK-FP-NEXT: pop {r7, pc}
1908 %r = call bfloat @llvm.exp2.f16(bfloat %a)
1912 define bfloat @test_log(bfloat %a) {
1914 ; CHECK-NOFP-LABEL: test_log:
1915 ; CHECK-NOFP: @ %bb.0:
1916 ; CHECK-NOFP-NEXT: .save {r7, lr}
1917 ; CHECK-NOFP-NEXT: push {r7, lr}
1918 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1919 ; CHECK-NOFP-NEXT: bl logf
1920 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1921 ; CHECK-NOFP-NEXT: pop {r7, pc}
1923 ; CHECK-FP-LABEL: test_log:
1924 ; CHECK-FP: @ %bb.0:
1925 ; CHECK-FP-NEXT: .save {r7, lr}
1926 ; CHECK-FP-NEXT: push {r7, lr}
1927 ; CHECK-FP-NEXT: vmov r0, s0
1928 ; CHECK-FP-NEXT: lsls r0, r0, #16
1929 ; CHECK-FP-NEXT: vmov s0, r0
1930 ; CHECK-FP-NEXT: bl logf
1931 ; CHECK-FP-NEXT: bl __truncsfbf2
1932 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1933 ; CHECK-FP-NEXT: vmov s0, r0
1934 ; CHECK-FP-NEXT: pop {r7, pc}
1935 %r = call bfloat @llvm.log.f16(bfloat %a)
1939 define bfloat @test_log10(bfloat %a) {
1941 ; CHECK-NOFP-LABEL: test_log10:
1942 ; CHECK-NOFP: @ %bb.0:
1943 ; CHECK-NOFP-NEXT: .save {r7, lr}
1944 ; CHECK-NOFP-NEXT: push {r7, lr}
1945 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1946 ; CHECK-NOFP-NEXT: bl log10f
1947 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1948 ; CHECK-NOFP-NEXT: pop {r7, pc}
1950 ; CHECK-FP-LABEL: test_log10:
1951 ; CHECK-FP: @ %bb.0:
1952 ; CHECK-FP-NEXT: .save {r7, lr}
1953 ; CHECK-FP-NEXT: push {r7, lr}
1954 ; CHECK-FP-NEXT: vmov r0, s0
1955 ; CHECK-FP-NEXT: lsls r0, r0, #16
1956 ; CHECK-FP-NEXT: vmov s0, r0
1957 ; CHECK-FP-NEXT: bl log10f
1958 ; CHECK-FP-NEXT: bl __truncsfbf2
1959 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1960 ; CHECK-FP-NEXT: vmov s0, r0
1961 ; CHECK-FP-NEXT: pop {r7, pc}
1962 %r = call bfloat @llvm.log10.f16(bfloat %a)
1966 define bfloat @test_log2(bfloat %a) {
1968 ; CHECK-NOFP-LABEL: test_log2:
1969 ; CHECK-NOFP: @ %bb.0:
1970 ; CHECK-NOFP-NEXT: .save {r7, lr}
1971 ; CHECK-NOFP-NEXT: push {r7, lr}
1972 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
1973 ; CHECK-NOFP-NEXT: bl log2f
1974 ; CHECK-NOFP-NEXT: bl __truncsfbf2
1975 ; CHECK-NOFP-NEXT: pop {r7, pc}
1977 ; CHECK-FP-LABEL: test_log2:
1978 ; CHECK-FP: @ %bb.0:
1979 ; CHECK-FP-NEXT: .save {r7, lr}
1980 ; CHECK-FP-NEXT: push {r7, lr}
1981 ; CHECK-FP-NEXT: vmov r0, s0
1982 ; CHECK-FP-NEXT: lsls r0, r0, #16
1983 ; CHECK-FP-NEXT: vmov s0, r0
1984 ; CHECK-FP-NEXT: bl log2f
1985 ; CHECK-FP-NEXT: bl __truncsfbf2
1986 ; CHECK-FP-NEXT: vmov.f16 r0, s0
1987 ; CHECK-FP-NEXT: vmov s0, r0
1988 ; CHECK-FP-NEXT: pop {r7, pc}
1989 %r = call bfloat @llvm.log2.f16(bfloat %a)
1993 define bfloat @test_fma(bfloat %a, bfloat %b, bfloat %c) {
1995 ; CHECK-NOFP-LABEL: test_fma:
1996 ; CHECK-NOFP: @ %bb.0:
1997 ; CHECK-NOFP-NEXT: .save {r7, lr}
1998 ; CHECK-NOFP-NEXT: push {r7, lr}
1999 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2000 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
2001 ; CHECK-NOFP-NEXT: lsls r2, r2, #16
2002 ; CHECK-NOFP-NEXT: bl fmaf
2003 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2004 ; CHECK-NOFP-NEXT: pop {r7, pc}
2006 ; CHECK-FP-LABEL: test_fma:
2007 ; CHECK-FP: @ %bb.0:
2008 ; CHECK-FP-NEXT: .save {r7, lr}
2009 ; CHECK-FP-NEXT: push {r7, lr}
2010 ; CHECK-FP-NEXT: vmov r0, s0
2011 ; CHECK-FP-NEXT: vmov r1, s1
2012 ; CHECK-FP-NEXT: vmov r2, s2
2013 ; CHECK-FP-NEXT: lsls r0, r0, #16
2014 ; CHECK-FP-NEXT: lsls r1, r1, #16
2015 ; CHECK-FP-NEXT: vmov s4, r0
2016 ; CHECK-FP-NEXT: lsls r0, r2, #16
2017 ; CHECK-FP-NEXT: vmov s2, r1
2018 ; CHECK-FP-NEXT: vmov s0, r0
2019 ; CHECK-FP-NEXT: vfma.f32 s0, s4, s2
2020 ; CHECK-FP-NEXT: bl __truncsfbf2
2021 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2022 ; CHECK-FP-NEXT: vmov s0, r0
2023 ; CHECK-FP-NEXT: pop {r7, pc}
2024 %r = call bfloat @llvm.fma.f16(bfloat %a, bfloat %b, bfloat %c)
2028 define bfloat @test_fabs(bfloat %a) {
2029 ; CHECK-NOFP-LABEL: test_fabs:
2030 ; CHECK-NOFP: @ %bb.0:
2031 ; CHECK-NOFP-NEXT: bfc r0, #15, #17
2032 ; CHECK-NOFP-NEXT: bx lr
2034 ; CHECK-FP-LABEL: test_fabs:
2035 ; CHECK-FP: @ %bb.0:
2036 ; CHECK-FP-NEXT: vmov r0, s0
2037 ; CHECK-FP-NEXT: bfc r0, #15, #17
2038 ; CHECK-FP-NEXT: vmov s0, r0
2039 ; CHECK-FP-NEXT: bx lr
2040 %r = call bfloat @llvm.fabs.f16(bfloat %a)
2044 define bfloat @test_minnum(bfloat %a, bfloat %b) {
2046 ; CHECK-NOFP-LABEL: test_minnum:
2047 ; CHECK-NOFP: @ %bb.0:
2048 ; CHECK-NOFP-NEXT: .save {r7, lr}
2049 ; CHECK-NOFP-NEXT: push {r7, lr}
2050 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2051 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
2052 ; CHECK-NOFP-NEXT: bl fminf
2053 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2054 ; CHECK-NOFP-NEXT: pop {r7, pc}
2056 ; CHECK-FP-LABEL: test_minnum:
2057 ; CHECK-FP: @ %bb.0:
2058 ; CHECK-FP-NEXT: .save {r7, lr}
2059 ; CHECK-FP-NEXT: push {r7, lr}
2060 ; CHECK-FP-NEXT: vmov r0, s1
2061 ; CHECK-FP-NEXT: vmov r1, s0
2062 ; CHECK-FP-NEXT: lsls r0, r0, #16
2063 ; CHECK-FP-NEXT: vmov s0, r0
2064 ; CHECK-FP-NEXT: lsls r0, r1, #16
2065 ; CHECK-FP-NEXT: vmov s2, r0
2066 ; CHECK-FP-NEXT: vminnm.f32 s0, s2, s0
2067 ; CHECK-FP-NEXT: bl __truncsfbf2
2068 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2069 ; CHECK-FP-NEXT: vmov s0, r0
2070 ; CHECK-FP-NEXT: pop {r7, pc}
2071 %r = call bfloat @llvm.minnum.f16(bfloat %a, bfloat %b)
2075 define bfloat @test_maxnum(bfloat %a, bfloat %b) {
2077 ; CHECK-NOFP-LABEL: test_maxnum:
2078 ; CHECK-NOFP: @ %bb.0:
2079 ; CHECK-NOFP-NEXT: .save {r7, lr}
2080 ; CHECK-NOFP-NEXT: push {r7, lr}
2081 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2082 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
2083 ; CHECK-NOFP-NEXT: bl fmaxf
2084 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2085 ; CHECK-NOFP-NEXT: pop {r7, pc}
2087 ; CHECK-FP-LABEL: test_maxnum:
2088 ; CHECK-FP: @ %bb.0:
2089 ; CHECK-FP-NEXT: .save {r7, lr}
2090 ; CHECK-FP-NEXT: push {r7, lr}
2091 ; CHECK-FP-NEXT: vmov r0, s1
2092 ; CHECK-FP-NEXT: vmov r1, s0
2093 ; CHECK-FP-NEXT: lsls r0, r0, #16
2094 ; CHECK-FP-NEXT: vmov s0, r0
2095 ; CHECK-FP-NEXT: lsls r0, r1, #16
2096 ; CHECK-FP-NEXT: vmov s2, r0
2097 ; CHECK-FP-NEXT: vmaxnm.f32 s0, s2, s0
2098 ; CHECK-FP-NEXT: bl __truncsfbf2
2099 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2100 ; CHECK-FP-NEXT: vmov s0, r0
2101 ; CHECK-FP-NEXT: pop {r7, pc}
2102 %r = call bfloat @llvm.maxnum.f16(bfloat %a, bfloat %b)
2106 define bfloat @test_copysign(bfloat %a, bfloat %b) {
2108 ; CHECK-NOFP-LABEL: test_copysign:
2109 ; CHECK-NOFP: @ %bb.0:
2110 ; CHECK-NOFP-NEXT: lsrs r1, r1, #15
2111 ; CHECK-NOFP-NEXT: bfi r0, r1, #15, #17
2112 ; CHECK-NOFP-NEXT: bx lr
2114 ; CHECK-FP-LABEL: test_copysign:
2115 ; CHECK-FP: @ %bb.0:
2116 ; CHECK-FP-NEXT: vmov r0, s0
2117 ; CHECK-FP-NEXT: vmov r1, s1
2118 ; CHECK-FP-NEXT: and r1, r1, #32768
2119 ; CHECK-FP-NEXT: bfc r0, #15, #17
2120 ; CHECK-FP-NEXT: add r0, r1
2121 ; CHECK-FP-NEXT: vmov.f16 s0, r0
2122 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2123 ; CHECK-FP-NEXT: vmov s0, r0
2124 ; CHECK-FP-NEXT: bx lr
2125 %r = call bfloat @llvm.copysign.f16(bfloat %a, bfloat %b)
2129 define bfloat @test_copysign_f32(bfloat %a, float %b) {
2131 ; CHECK-NOFP-LABEL: test_copysign_f32:
2132 ; CHECK-NOFP: @ %bb.0:
2133 ; CHECK-NOFP-NEXT: and r1, r1, #-2147483648
2134 ; CHECK-NOFP-NEXT: bfc r0, #15, #17
2135 ; CHECK-NOFP-NEXT: orr.w r0, r0, r1, lsr #16
2136 ; CHECK-NOFP-NEXT: bx lr
2138 ; CHECK-FP-LABEL: test_copysign_f32:
2139 ; CHECK-FP: @ %bb.0:
2140 ; CHECK-FP-NEXT: vmov r0, s0
2141 ; CHECK-FP-NEXT: vmov r1, s1
2142 ; CHECK-FP-NEXT: and r1, r1, #-2147483648
2143 ; CHECK-FP-NEXT: bfc r0, #15, #17
2144 ; CHECK-FP-NEXT: orr.w r0, r0, r1, lsr #16
2145 ; CHECK-FP-NEXT: vmov.f16 s0, r0
2146 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2147 ; CHECK-FP-NEXT: vmov s0, r0
2148 ; CHECK-FP-NEXT: bx lr
2149 %tb = fptrunc float %b to bfloat
2150 %r = call bfloat @llvm.copysign.f16(bfloat %a, bfloat %tb)
2154 define bfloat @test_copysign_f64(bfloat %a, double %b) {
2156 ; CHECK-NOFP-LABEL: test_copysign_f64:
2157 ; CHECK-NOFP: @ %bb.0:
2158 ; CHECK-NOFP-NEXT: and r1, r3, #-2147483648
2159 ; CHECK-NOFP-NEXT: bfc r0, #15, #17
2160 ; CHECK-NOFP-NEXT: orr.w r0, r0, r1, lsr #16
2161 ; CHECK-NOFP-NEXT: bx lr
2163 ; CHECK-FP-LABEL: test_copysign_f64:
2164 ; CHECK-FP: @ %bb.0:
2165 ; CHECK-FP-NEXT: vmov r0, s0
2166 ; CHECK-FP-NEXT: vmov r1, r2, d1
2167 ; CHECK-FP-NEXT: and r1, r2, #-2147483648
2168 ; CHECK-FP-NEXT: bfc r0, #15, #17
2169 ; CHECK-FP-NEXT: orr.w r0, r0, r1, lsr #16
2170 ; CHECK-FP-NEXT: vmov.f16 s0, r0
2171 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2172 ; CHECK-FP-NEXT: vmov s0, r0
2173 ; CHECK-FP-NEXT: bx lr
2174 %tb = fptrunc double %b to bfloat
2175 %r = call bfloat @llvm.copysign.f16(bfloat %a, bfloat %tb)
2179 ; away the (fpext (fp_round <result>)) here.
2181 define float @test_copysign_extended(bfloat %a, bfloat %b) {
2183 ; CHECK-NOFP-LABEL: test_copysign_extended:
2184 ; CHECK-NOFP: @ %bb.0:
2185 ; CHECK-NOFP-NEXT: lsrs r1, r1, #15
2186 ; CHECK-NOFP-NEXT: bfi r0, r1, #15, #17
2187 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2188 ; CHECK-NOFP-NEXT: bx lr
2190 ; CHECK-FP-LABEL: test_copysign_extended:
2191 ; CHECK-FP: @ %bb.0:
2192 ; CHECK-FP-NEXT: vmov r0, s0
2193 ; CHECK-FP-NEXT: vmov r1, s1
2194 ; CHECK-FP-NEXT: and r1, r1, #32768
2195 ; CHECK-FP-NEXT: bfc r0, #15, #17
2196 ; CHECK-FP-NEXT: add r0, r1
2197 ; CHECK-FP-NEXT: lsls r0, r0, #16
2198 ; CHECK-FP-NEXT: vmov s0, r0
2199 ; CHECK-FP-NEXT: bx lr
2200 %r = call bfloat @llvm.copysign.f16(bfloat %a, bfloat %b)
2201 %xr = fpext bfloat %r to float
2205 define bfloat @test_floor(bfloat %a) {
2207 ; CHECK-NOFP-LABEL: test_floor:
2208 ; CHECK-NOFP: @ %bb.0:
2209 ; CHECK-NOFP-NEXT: .save {r7, lr}
2210 ; CHECK-NOFP-NEXT: push {r7, lr}
2211 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2212 ; CHECK-NOFP-NEXT: bl floorf
2213 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2214 ; CHECK-NOFP-NEXT: pop {r7, pc}
2216 ; CHECK-FP-LABEL: test_floor:
2217 ; CHECK-FP: @ %bb.0:
2218 ; CHECK-FP-NEXT: .save {r7, lr}
2219 ; CHECK-FP-NEXT: push {r7, lr}
2220 ; CHECK-FP-NEXT: vmov r0, s0
2221 ; CHECK-FP-NEXT: lsls r0, r0, #16
2222 ; CHECK-FP-NEXT: vmov s0, r0
2223 ; CHECK-FP-NEXT: vrintm.f32 s0, s0
2224 ; CHECK-FP-NEXT: bl __truncsfbf2
2225 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2226 ; CHECK-FP-NEXT: vmov s0, r0
2227 ; CHECK-FP-NEXT: pop {r7, pc}
2228 %r = call bfloat @llvm.floor.f16(bfloat %a)
2232 define bfloat @test_ceil(bfloat %a) {
2234 ; CHECK-NOFP-LABEL: test_ceil:
2235 ; CHECK-NOFP: @ %bb.0:
2236 ; CHECK-NOFP-NEXT: .save {r7, lr}
2237 ; CHECK-NOFP-NEXT: push {r7, lr}
2238 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2239 ; CHECK-NOFP-NEXT: bl ceilf
2240 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2241 ; CHECK-NOFP-NEXT: pop {r7, pc}
2243 ; CHECK-FP-LABEL: test_ceil:
2244 ; CHECK-FP: @ %bb.0:
2245 ; CHECK-FP-NEXT: .save {r7, lr}
2246 ; CHECK-FP-NEXT: push {r7, lr}
2247 ; CHECK-FP-NEXT: vmov r0, s0
2248 ; CHECK-FP-NEXT: lsls r0, r0, #16
2249 ; CHECK-FP-NEXT: vmov s0, r0
2250 ; CHECK-FP-NEXT: vrintp.f32 s0, s0
2251 ; CHECK-FP-NEXT: bl __truncsfbf2
2252 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2253 ; CHECK-FP-NEXT: vmov s0, r0
2254 ; CHECK-FP-NEXT: pop {r7, pc}
2255 %r = call bfloat @llvm.ceil.f16(bfloat %a)
2259 define bfloat @test_trunc(bfloat %a) {
2261 ; CHECK-NOFP-LABEL: test_trunc:
2262 ; CHECK-NOFP: @ %bb.0:
2263 ; CHECK-NOFP-NEXT: .save {r7, lr}
2264 ; CHECK-NOFP-NEXT: push {r7, lr}
2265 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2266 ; CHECK-NOFP-NEXT: bl truncf
2267 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2268 ; CHECK-NOFP-NEXT: pop {r7, pc}
2270 ; CHECK-FP-LABEL: test_trunc:
2271 ; CHECK-FP: @ %bb.0:
2272 ; CHECK-FP-NEXT: .save {r7, lr}
2273 ; CHECK-FP-NEXT: push {r7, lr}
2274 ; CHECK-FP-NEXT: vmov r0, s0
2275 ; CHECK-FP-NEXT: lsls r0, r0, #16
2276 ; CHECK-FP-NEXT: vmov s0, r0
2277 ; CHECK-FP-NEXT: vrintz.f32 s0, s0
2278 ; CHECK-FP-NEXT: bl __truncsfbf2
2279 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2280 ; CHECK-FP-NEXT: vmov s0, r0
2281 ; CHECK-FP-NEXT: pop {r7, pc}
2282 %r = call bfloat @llvm.trunc.f16(bfloat %a)
2286 define bfloat @test_rint(bfloat %a) {
2288 ; CHECK-NOFP-LABEL: test_rint:
2289 ; CHECK-NOFP: @ %bb.0:
2290 ; CHECK-NOFP-NEXT: .save {r7, lr}
2291 ; CHECK-NOFP-NEXT: push {r7, lr}
2292 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2293 ; CHECK-NOFP-NEXT: bl rintf
2294 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2295 ; CHECK-NOFP-NEXT: pop {r7, pc}
2297 ; CHECK-FP-LABEL: test_rint:
2298 ; CHECK-FP: @ %bb.0:
2299 ; CHECK-FP-NEXT: .save {r7, lr}
2300 ; CHECK-FP-NEXT: push {r7, lr}
2301 ; CHECK-FP-NEXT: vmov r0, s0
2302 ; CHECK-FP-NEXT: lsls r0, r0, #16
2303 ; CHECK-FP-NEXT: vmov s0, r0
2304 ; CHECK-FP-NEXT: vrintx.f32 s0, s0
2305 ; CHECK-FP-NEXT: bl __truncsfbf2
2306 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2307 ; CHECK-FP-NEXT: vmov s0, r0
2308 ; CHECK-FP-NEXT: pop {r7, pc}
2309 %r = call bfloat @llvm.rint.f16(bfloat %a)
2313 define bfloat @test_nearbyint(bfloat %a) {
2315 ; CHECK-NOFP-LABEL: test_nearbyint:
2316 ; CHECK-NOFP: @ %bb.0:
2317 ; CHECK-NOFP-NEXT: .save {r7, lr}
2318 ; CHECK-NOFP-NEXT: push {r7, lr}
2319 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2320 ; CHECK-NOFP-NEXT: bl nearbyintf
2321 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2322 ; CHECK-NOFP-NEXT: pop {r7, pc}
2324 ; CHECK-FP-LABEL: test_nearbyint:
2325 ; CHECK-FP: @ %bb.0:
2326 ; CHECK-FP-NEXT: .save {r7, lr}
2327 ; CHECK-FP-NEXT: push {r7, lr}
2328 ; CHECK-FP-NEXT: vmov r0, s0
2329 ; CHECK-FP-NEXT: lsls r0, r0, #16
2330 ; CHECK-FP-NEXT: vmov s0, r0
2331 ; CHECK-FP-NEXT: vrintr.f32 s0, s0
2332 ; CHECK-FP-NEXT: bl __truncsfbf2
2333 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2334 ; CHECK-FP-NEXT: vmov s0, r0
2335 ; CHECK-FP-NEXT: pop {r7, pc}
2336 %r = call bfloat @llvm.nearbyint.f16(bfloat %a)
2340 define bfloat @test_round(bfloat %a) {
2342 ; CHECK-NOFP-LABEL: test_round:
2343 ; CHECK-NOFP: @ %bb.0:
2344 ; CHECK-NOFP-NEXT: .save {r7, lr}
2345 ; CHECK-NOFP-NEXT: push {r7, lr}
2346 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2347 ; CHECK-NOFP-NEXT: bl roundf
2348 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2349 ; CHECK-NOFP-NEXT: pop {r7, pc}
2351 ; CHECK-FP-LABEL: test_round:
2352 ; CHECK-FP: @ %bb.0:
2353 ; CHECK-FP-NEXT: .save {r7, lr}
2354 ; CHECK-FP-NEXT: push {r7, lr}
2355 ; CHECK-FP-NEXT: vmov r0, s0
2356 ; CHECK-FP-NEXT: lsls r0, r0, #16
2357 ; CHECK-FP-NEXT: vmov s0, r0
2358 ; CHECK-FP-NEXT: vrinta.f32 s0, s0
2359 ; CHECK-FP-NEXT: bl __truncsfbf2
2360 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2361 ; CHECK-FP-NEXT: vmov s0, r0
2362 ; CHECK-FP-NEXT: pop {r7, pc}
2363 %r = call bfloat @llvm.round.f16(bfloat %a)
2367 define bfloat @test_roundeven(bfloat %a) {
2369 ; CHECK-NOFP-LABEL: test_roundeven:
2370 ; CHECK-NOFP: @ %bb.0:
2371 ; CHECK-NOFP-NEXT: .save {r7, lr}
2372 ; CHECK-NOFP-NEXT: push {r7, lr}
2373 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2374 ; CHECK-NOFP-NEXT: bl roundevenf
2375 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2376 ; CHECK-NOFP-NEXT: pop {r7, pc}
2378 ; CHECK-FP-LABEL: test_roundeven:
2379 ; CHECK-FP: @ %bb.0:
2380 ; CHECK-FP-NEXT: .save {r7, lr}
2381 ; CHECK-FP-NEXT: push {r7, lr}
2382 ; CHECK-FP-NEXT: vmov r0, s0
2383 ; CHECK-FP-NEXT: lsls r0, r0, #16
2384 ; CHECK-FP-NEXT: vmov s0, r0
2385 ; CHECK-FP-NEXT: bl roundevenf
2386 ; CHECK-FP-NEXT: bl __truncsfbf2
2387 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2388 ; CHECK-FP-NEXT: vmov s0, r0
2389 ; CHECK-FP-NEXT: pop {r7, pc}
2390 %r = call bfloat @llvm.roundeven.f16(bfloat %a)
2394 define bfloat @test_fmuladd(bfloat %a, bfloat %b, bfloat %c) {
2396 ; CHECK-NOFP-LABEL: test_fmuladd:
2397 ; CHECK-NOFP: @ %bb.0:
2398 ; CHECK-NOFP-NEXT: .save {r4, lr}
2399 ; CHECK-NOFP-NEXT: push {r4, lr}
2400 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2401 ; CHECK-NOFP-NEXT: lsls r1, r1, #16
2402 ; CHECK-NOFP-NEXT: mov r4, r2
2403 ; CHECK-NOFP-NEXT: bl __aeabi_fmul
2404 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2405 ; CHECK-NOFP-NEXT: lsls r0, r0, #16
2406 ; CHECK-NOFP-NEXT: lsls r1, r4, #16
2407 ; CHECK-NOFP-NEXT: bl __aeabi_fadd
2408 ; CHECK-NOFP-NEXT: bl __truncsfbf2
2409 ; CHECK-NOFP-NEXT: pop {r4, pc}
2411 ; CHECK-FP-LABEL: test_fmuladd:
2412 ; CHECK-FP: @ %bb.0:
2413 ; CHECK-FP-NEXT: .save {r7, lr}
2414 ; CHECK-FP-NEXT: push {r7, lr}
2415 ; CHECK-FP-NEXT: .vsave {d8}
2416 ; CHECK-FP-NEXT: vpush {d8}
2417 ; CHECK-FP-NEXT: vmov r0, s1
2418 ; CHECK-FP-NEXT: vmov r1, s0
2419 ; CHECK-FP-NEXT: vmov.f32 s16, s2
2420 ; CHECK-FP-NEXT: lsls r0, r0, #16
2421 ; CHECK-FP-NEXT: vmov s0, r0
2422 ; CHECK-FP-NEXT: lsls r0, r1, #16
2423 ; CHECK-FP-NEXT: vmov s2, r0
2424 ; CHECK-FP-NEXT: vmul.f32 s0, s2, s0
2425 ; CHECK-FP-NEXT: bl __truncsfbf2
2426 ; CHECK-FP-NEXT: vmov r0, s16
2427 ; CHECK-FP-NEXT: vmov r1, s0
2428 ; CHECK-FP-NEXT: lsls r0, r0, #16
2429 ; CHECK-FP-NEXT: vmov s0, r0
2430 ; CHECK-FP-NEXT: lsls r0, r1, #16
2431 ; CHECK-FP-NEXT: vmov s2, r0
2432 ; CHECK-FP-NEXT: vadd.f32 s0, s2, s0
2433 ; CHECK-FP-NEXT: bl __truncsfbf2
2434 ; CHECK-FP-NEXT: vmov.f16 r0, s0
2435 ; CHECK-FP-NEXT: vmov s0, r0
2436 ; CHECK-FP-NEXT: vpop {d8}
2437 ; CHECK-FP-NEXT: pop {r7, pc}
2438 %r = call bfloat @llvm.fmuladd.f16(bfloat %a, bfloat %b, bfloat %c)