1*9880d681SAndroid Build Coastguard Worker; RUN: llc -asm-verbose=false < %s -mattr=+vfp3,+fp16 | FileCheck %s -check-prefix=CHECK-FP16 --check-prefix=CHECK-VFP -check-prefix=CHECK-ALL 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -asm-verbose=false < %s | FileCheck %s -check-prefix=CHECK-LIBCALL --check-prefix=CHECK-VFP -check-prefix=CHECK-ALL --check-prefix=CHECK-LIBCALL-VFP 3*9880d681SAndroid Build Coastguard Worker; RUN: llc -asm-verbose=false < %s -mattr=-vfp2 | FileCheck %s --check-prefix=CHECK-LIBCALL -check-prefix=CHECK-NOVFP -check-prefix=CHECK-ALL 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32" 6*9880d681SAndroid Build Coastguard Workertarget triple = "armv7---eabihf" 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fadd: 9*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 10*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 11*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 12*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 13*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vadd.f32 14*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fadd 15*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 16*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 17*9880d681SAndroid Build Coastguard Workerdefine void @test_fadd(half* %p, half* %q) #0 { 18*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 19*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 20*9880d681SAndroid Build Coastguard Worker %r = fadd half %a, %b 21*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 22*9880d681SAndroid Build Coastguard Worker ret void 23*9880d681SAndroid Build Coastguard Worker} 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fsub: 26*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 27*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 28*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 29*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 30*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vsub.f32 31*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fsub 32*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 33*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 34*9880d681SAndroid Build Coastguard Workerdefine void @test_fsub(half* %p, half* %q) #0 { 35*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 36*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 37*9880d681SAndroid Build Coastguard Worker %r = fsub half %a, %b 38*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 39*9880d681SAndroid Build Coastguard Worker ret void 40*9880d681SAndroid Build Coastguard Worker} 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fmul: 43*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 44*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 45*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 46*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 47*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vmul.f32 48*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fmul 49*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 50*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 51*9880d681SAndroid Build Coastguard Workerdefine void @test_fmul(half* %p, half* %q) #0 { 52*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 53*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 54*9880d681SAndroid Build Coastguard Worker %r = fmul half %a, %b 55*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 56*9880d681SAndroid Build Coastguard Worker ret void 57*9880d681SAndroid Build Coastguard Worker} 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fdiv: 60*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 61*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 62*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 63*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 64*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vdiv.f32 65*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fdiv 66*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 67*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 68*9880d681SAndroid Build Coastguard Workerdefine void @test_fdiv(half* %p, half* %q) #0 { 69*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 70*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 71*9880d681SAndroid Build Coastguard Worker %r = fdiv half %a, %b 72*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 73*9880d681SAndroid Build Coastguard Worker ret void 74*9880d681SAndroid Build Coastguard Worker} 75*9880d681SAndroid Build Coastguard Worker 76*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_frem: 77*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 78*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 79*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 80*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 81*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl fmodf 82*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 83*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 84*9880d681SAndroid Build Coastguard Workerdefine void @test_frem(half* %p, half* %q) #0 { 85*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 86*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 87*9880d681SAndroid Build Coastguard Worker %r = frem half %a, %b 88*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 89*9880d681SAndroid Build Coastguard Worker ret void 90*9880d681SAndroid Build Coastguard Worker} 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_load_store: 93*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 94*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh {{r[0-9]+}}, [{{r[0-9]+}}] 95*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh {{r[0-9]+}}, [{{r[0-9]+}}] 96*9880d681SAndroid Build Coastguard Workerdefine void @test_load_store(half* %p, half* %q) #0 { 97*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 98*9880d681SAndroid Build Coastguard Worker store half %a, half* %q 99*9880d681SAndroid Build Coastguard Worker ret void 100*9880d681SAndroid Build Coastguard Worker} 101*9880d681SAndroid Build Coastguard Worker 102*9880d681SAndroid Build Coastguard Worker; Testing only successfull compilation of function calls. In ARM ABI, half 103*9880d681SAndroid Build Coastguard Worker; args and returns are handled as f32. 104*9880d681SAndroid Build Coastguard Worker 105*9880d681SAndroid Build Coastguard Workerdeclare half @test_callee(half %a, half %b) #0 106*9880d681SAndroid Build Coastguard Worker 107*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_call: 108*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 109*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .save {r11, lr} 110*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: push {r11, lr} 111*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: bl test_callee 112*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: pop {r11, pc} 113*9880d681SAndroid Build Coastguard Workerdefine half @test_call(half %a, half %b) #0 { 114*9880d681SAndroid Build Coastguard Worker %r = call half @test_callee(half %a, half %b) 115*9880d681SAndroid Build Coastguard Worker ret half %r 116*9880d681SAndroid Build Coastguard Worker} 117*9880d681SAndroid Build Coastguard Worker 118*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_call_flipped: 119*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 120*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .save {r11, lr} 121*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: push {r11, lr} 122*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-NEXT: vmov.f32 s2, s0 123*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-NEXT: vmov.f32 s0, s1 124*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-NEXT: vmov.f32 s1, s2 125*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r2, r0 126*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r0, r1 127*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r1, r2 128*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: bl test_callee 129*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: pop {r11, pc} 130*9880d681SAndroid Build Coastguard Workerdefine half @test_call_flipped(half %a, half %b) #0 { 131*9880d681SAndroid Build Coastguard Worker %r = call half @test_callee(half %b, half %a) 132*9880d681SAndroid Build Coastguard Worker ret half %r 133*9880d681SAndroid Build Coastguard Worker} 134*9880d681SAndroid Build Coastguard Worker 135*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_tailcall_flipped: 136*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 137*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-NEXT: vmov.f32 s2, s0 138*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-NEXT: vmov.f32 s0, s1 139*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-NEXT: vmov.f32 s1, s2 140*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r2, r0 141*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r0, r1 142*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r1, r2 143*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: b test_callee 144*9880d681SAndroid Build Coastguard Workerdefine half @test_tailcall_flipped(half %a, half %b) #0 { 145*9880d681SAndroid Build Coastguard Worker %r = tail call half @test_callee(half %b, half %a) 146*9880d681SAndroid Build Coastguard Worker ret half %r 147*9880d681SAndroid Build Coastguard Worker} 148*9880d681SAndroid Build Coastguard Worker 149*9880d681SAndroid Build Coastguard Worker; Optimizer picks %p or %q based on %c and only loads that value 150*9880d681SAndroid Build Coastguard Worker; No conversion is needed 151*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_select: 152*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: cmp {{r[0-9]+}}, #0 153*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: movne {{r[0-9]+}}, {{r[0-9]+}} 154*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh {{r[0-9]+}}, [{{r[0-9]+}}] 155*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh {{r[0-9]+}}, [{{r[0-9]+}}] 156*9880d681SAndroid Build Coastguard Workerdefine void @test_select(half* %p, half* %q, i1 zeroext %c) #0 { 157*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 158*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 159*9880d681SAndroid Build Coastguard Worker %r = select i1 %c, half %a, half %b 160*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 161*9880d681SAndroid Build Coastguard Worker ret void 162*9880d681SAndroid Build Coastguard Worker} 163*9880d681SAndroid Build Coastguard Worker 164*9880d681SAndroid Build Coastguard Worker; Test only two variants of fcmp. These get translated to f32 vcmpe 165*9880d681SAndroid Build Coastguard Worker; instructions anyway. 166*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fcmp_une: 167*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 168*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 169*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 170*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 171*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcmpe.f32 172*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fcmpeq 173*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vmrs APSR_nzcv, fpscr 174*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: movw{{ne|eq}} 175*9880d681SAndroid Build Coastguard Workerdefine i1 @test_fcmp_une(half* %p, half* %q) #0 { 176*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 177*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 178*9880d681SAndroid Build Coastguard Worker %r = fcmp une half %a, %b 179*9880d681SAndroid Build Coastguard Worker ret i1 %r 180*9880d681SAndroid Build Coastguard Worker} 181*9880d681SAndroid Build Coastguard Worker 182*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fcmp_ueq: 183*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 184*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 185*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 186*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 187*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcmpe.f32 188*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fcmpeq 189*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vmrs APSR_nzcv, fpscr 190*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: movw{{ne|eq}} 191*9880d681SAndroid Build Coastguard Workerdefine i1 @test_fcmp_ueq(half* %p, half* %q) #0 { 192*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 193*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 194*9880d681SAndroid Build Coastguard Worker %r = fcmp ueq half %a, %b 195*9880d681SAndroid Build Coastguard Worker ret i1 %r 196*9880d681SAndroid Build Coastguard Worker} 197*9880d681SAndroid Build Coastguard Worker 198*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_br_cc: 199*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 200*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 201*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 202*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 203*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcmpe.f32 204*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fcmplt 205*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vmrs APSR_nzcv, fpscr 206*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: strmi 207*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: strpl 208*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: strne 209*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: streq 210*9880d681SAndroid Build Coastguard Workerdefine void @test_br_cc(half* %p, half* %q, i32* %p1, i32* %p2) #0 { 211*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 212*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 213*9880d681SAndroid Build Coastguard Worker %c = fcmp uge half %a, %b 214*9880d681SAndroid Build Coastguard Worker br i1 %c, label %then, label %else 215*9880d681SAndroid Build Coastguard Workerthen: 216*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %p1 217*9880d681SAndroid Build Coastguard Worker ret void 218*9880d681SAndroid Build Coastguard Workerelse: 219*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %p2 220*9880d681SAndroid Build Coastguard Worker ret void 221*9880d681SAndroid Build Coastguard Worker} 222*9880d681SAndroid Build Coastguard Worker 223*9880d681SAndroid Build Coastguard Workerdeclare i1 @test_dummy(half* %p) #0 224*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_phi: 225*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 226*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: [[LOOP:.LBB[1-9_]+]]: 227*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 228*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl test_dummy 229*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bne [[LOOP]] 230*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 231*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-VFP: bl __aeabi_h2f 232*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: [[LOOP:.LBB[1-9_]+]]: 233*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-VFP: bl __aeabi_h2f 234*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl test_dummy 235*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bne [[LOOP]] 236*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-VFP: bl __aeabi_f2h 237*9880d681SAndroid Build Coastguard Workerdefine void @test_phi(half* %p) #0 { 238*9880d681SAndroid Build Coastguard Workerentry: 239*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p 240*9880d681SAndroid Build Coastguard Worker br label %loop 241*9880d681SAndroid Build Coastguard Workerloop: 242*9880d681SAndroid Build Coastguard Worker %r = phi half [%a, %entry], [%b, %loop] 243*9880d681SAndroid Build Coastguard Worker %b = load half, half* %p 244*9880d681SAndroid Build Coastguard Worker %c = call i1 @test_dummy(half* %p) 245*9880d681SAndroid Build Coastguard Worker br i1 %c, label %loop, label %return 246*9880d681SAndroid Build Coastguard Workerreturn: 247*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 248*9880d681SAndroid Build Coastguard Worker ret void 249*9880d681SAndroid Build Coastguard Worker} 250*9880d681SAndroid Build Coastguard Worker 251*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fptosi_i32: 252*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 253*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 254*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcvt.s32.f32 255*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_f2iz 256*9880d681SAndroid Build Coastguard Workerdefine i32 @test_fptosi_i32(half* %p) #0 { 257*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 258*9880d681SAndroid Build Coastguard Worker %r = fptosi half %a to i32 259*9880d681SAndroid Build Coastguard Worker ret i32 %r 260*9880d681SAndroid Build Coastguard Worker} 261*9880d681SAndroid Build Coastguard Worker 262*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fptosi_i64: 263*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 264*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 265*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: bl __aeabi_f2lz 266*9880d681SAndroid Build Coastguard Workerdefine i64 @test_fptosi_i64(half* %p) #0 { 267*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 268*9880d681SAndroid Build Coastguard Worker %r = fptosi half %a to i64 269*9880d681SAndroid Build Coastguard Worker ret i64 %r 270*9880d681SAndroid Build Coastguard Worker} 271*9880d681SAndroid Build Coastguard Worker 272*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fptoui_i32: 273*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 274*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 275*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcvt.u32.f32 276*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_f2uiz 277*9880d681SAndroid Build Coastguard Workerdefine i32 @test_fptoui_i32(half* %p) #0 { 278*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 279*9880d681SAndroid Build Coastguard Worker %r = fptoui half %a to i32 280*9880d681SAndroid Build Coastguard Worker ret i32 %r 281*9880d681SAndroid Build Coastguard Worker} 282*9880d681SAndroid Build Coastguard Worker 283*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_fptoui_i64: 284*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 285*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 286*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: bl __aeabi_f2ulz 287*9880d681SAndroid Build Coastguard Workerdefine i64 @test_fptoui_i64(half* %p) #0 { 288*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 289*9880d681SAndroid Build Coastguard Worker %r = fptoui half %a to i64 290*9880d681SAndroid Build Coastguard Worker ret i64 %r 291*9880d681SAndroid Build Coastguard Worker} 292*9880d681SAndroid Build Coastguard Worker 293*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_sitofp_i32: 294*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcvt.f32.s32 295*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_i2f 296*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 297*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 298*9880d681SAndroid Build Coastguard Workerdefine void @test_sitofp_i32(i32 %a, half* %p) #0 { 299*9880d681SAndroid Build Coastguard Worker %r = sitofp i32 %a to half 300*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 301*9880d681SAndroid Build Coastguard Worker ret void 302*9880d681SAndroid Build Coastguard Worker} 303*9880d681SAndroid Build Coastguard Worker 304*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_uitofp_i32: 305*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcvt.f32.u32 306*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_ui2f 307*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 308*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 309*9880d681SAndroid Build Coastguard Workerdefine void @test_uitofp_i32(i32 %a, half* %p) #0 { 310*9880d681SAndroid Build Coastguard Worker %r = uitofp i32 %a to half 311*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 312*9880d681SAndroid Build Coastguard Worker ret void 313*9880d681SAndroid Build Coastguard Worker} 314*9880d681SAndroid Build Coastguard Worker 315*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_sitofp_i64: 316*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: bl __aeabi_l2f 317*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 318*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 319*9880d681SAndroid Build Coastguard Workerdefine void @test_sitofp_i64(i64 %a, half* %p) #0 { 320*9880d681SAndroid Build Coastguard Worker %r = sitofp i64 %a to half 321*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 322*9880d681SAndroid Build Coastguard Worker ret void 323*9880d681SAndroid Build Coastguard Worker} 324*9880d681SAndroid Build Coastguard Worker 325*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_uitofp_i64: 326*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: bl __aeabi_ul2f 327*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 328*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 329*9880d681SAndroid Build Coastguard Workerdefine void @test_uitofp_i64(i64 %a, half* %p) #0 { 330*9880d681SAndroid Build Coastguard Worker %r = uitofp i64 %a to half 331*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 332*9880d681SAndroid Build Coastguard Worker ret void 333*9880d681SAndroid Build Coastguard Worker} 334*9880d681SAndroid Build Coastguard Worker 335*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fptrunc_float: 336*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 337*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fptrunc_float: 338*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 339*9880d681SAndroid Build Coastguard Workerdefine void @test_fptrunc_float(float %f, half* %p) #0 { 340*9880d681SAndroid Build Coastguard Worker %a = fptrunc float %f to half 341*9880d681SAndroid Build Coastguard Worker store half %a, half* %p 342*9880d681SAndroid Build Coastguard Worker ret void 343*9880d681SAndroid Build Coastguard Worker} 344*9880d681SAndroid Build Coastguard Worker 345*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fptrunc_double: 346*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl __aeabi_d2h 347*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fptrunc_double: 348*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_d2h 349*9880d681SAndroid Build Coastguard Workerdefine void @test_fptrunc_double(double %d, half* %p) #0 { 350*9880d681SAndroid Build Coastguard Worker %a = fptrunc double %d to half 351*9880d681SAndroid Build Coastguard Worker store half %a, half* %p 352*9880d681SAndroid Build Coastguard Worker ret void 353*9880d681SAndroid Build Coastguard Worker} 354*9880d681SAndroid Build Coastguard Worker 355*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fpextend_float: 356*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 357*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fpextend_float: 358*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 359*9880d681SAndroid Build Coastguard Workerdefine float @test_fpextend_float(half* %p) { 360*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 361*9880d681SAndroid Build Coastguard Worker %r = fpext half %a to float 362*9880d681SAndroid Build Coastguard Worker ret float %r 363*9880d681SAndroid Build Coastguard Worker} 364*9880d681SAndroid Build Coastguard Worker 365*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fpextend_double: 366*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 367*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fpextend_double: 368*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 369*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vcvt.f64.f32 370*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_f2d 371*9880d681SAndroid Build Coastguard Workerdefine double @test_fpextend_double(half* %p) { 372*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 373*9880d681SAndroid Build Coastguard Worker %r = fpext half %a to double 374*9880d681SAndroid Build Coastguard Worker ret double %r 375*9880d681SAndroid Build Coastguard Worker} 376*9880d681SAndroid Build Coastguard Worker 377*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_bitcast_halftoi16: 378*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 379*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: ldrh r0, [r0] 380*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: bx lr 381*9880d681SAndroid Build Coastguard Workerdefine i16 @test_bitcast_halftoi16(half* %p) #0 { 382*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 383*9880d681SAndroid Build Coastguard Worker %r = bitcast half %a to i16 384*9880d681SAndroid Build Coastguard Worker ret i16 %r 385*9880d681SAndroid Build Coastguard Worker} 386*9880d681SAndroid Build Coastguard Worker 387*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_bitcast_i16tohalf: 388*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 389*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: strh r0, [r1] 390*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: bx lr 391*9880d681SAndroid Build Coastguard Workerdefine void @test_bitcast_i16tohalf(i16 %a, half* %p) #0 { 392*9880d681SAndroid Build Coastguard Worker %r = bitcast i16 %a to half 393*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 394*9880d681SAndroid Build Coastguard Worker ret void 395*9880d681SAndroid Build Coastguard Worker} 396*9880d681SAndroid Build Coastguard Worker 397*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.sqrt.f16(half %a) #0 398*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.powi.f16(half %a, i32 %b) #0 399*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.sin.f16(half %a) #0 400*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.cos.f16(half %a) #0 401*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.pow.f16(half %a, half %b) #0 402*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.exp.f16(half %a) #0 403*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.exp2.f16(half %a) #0 404*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.log.f16(half %a) #0 405*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.log10.f16(half %a) #0 406*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.log2.f16(half %a) #0 407*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.fma.f16(half %a, half %b, half %c) #0 408*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.fabs.f16(half %a) #0 409*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.minnum.f16(half %a, half %b) #0 410*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.maxnum.f16(half %a, half %b) #0 411*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.copysign.f16(half %a, half %b) #0 412*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.floor.f16(half %a) #0 413*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.ceil.f16(half %a) #0 414*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.trunc.f16(half %a) #0 415*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.rint.f16(half %a) #0 416*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.nearbyint.f16(half %a) #0 417*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.round.f16(half %a) #0 418*9880d681SAndroid Build Coastguard Workerdeclare half @llvm.fmuladd.f16(half %a, half %b, half %c) #0 419*9880d681SAndroid Build Coastguard Worker 420*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_sqrt: 421*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 422*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vsqrt.f32 423*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 424*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 425*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-LIBCALL: vsqrt.f32 426*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl sqrtf 427*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 428*9880d681SAndroid Build Coastguard Workerdefine void @test_sqrt(half* %p) #0 { 429*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 430*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.sqrt.f16(half %a) 431*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 432*9880d681SAndroid Build Coastguard Worker ret void 433*9880d681SAndroid Build Coastguard Worker} 434*9880d681SAndroid Build Coastguard Worker 435*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fpowi: 436*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 437*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl __powisf2 438*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 439*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fpowi: 440*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 441*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __powisf2 442*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 443*9880d681SAndroid Build Coastguard Workerdefine void @test_fpowi(half* %p, i32 %b) #0 { 444*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 445*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.powi.f16(half %a, i32 %b) 446*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 447*9880d681SAndroid Build Coastguard Worker ret void 448*9880d681SAndroid Build Coastguard Worker} 449*9880d681SAndroid Build Coastguard Worker 450*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_sin: 451*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 452*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl sinf 453*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 454*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_sin: 455*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 456*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl sinf 457*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 458*9880d681SAndroid Build Coastguard Workerdefine void @test_sin(half* %p) #0 { 459*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 460*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.sin.f16(half %a) 461*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 462*9880d681SAndroid Build Coastguard Worker ret void 463*9880d681SAndroid Build Coastguard Worker} 464*9880d681SAndroid Build Coastguard Worker 465*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_cos: 466*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 467*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl cosf 468*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 469*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_cos: 470*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 471*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl cosf 472*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 473*9880d681SAndroid Build Coastguard Workerdefine void @test_cos(half* %p) #0 { 474*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 475*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.cos.f16(half %a) 476*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 477*9880d681SAndroid Build Coastguard Worker ret void 478*9880d681SAndroid Build Coastguard Worker} 479*9880d681SAndroid Build Coastguard Worker 480*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_pow: 481*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 482*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 483*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl powf 484*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 485*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_pow: 486*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 487*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 488*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl powf 489*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 490*9880d681SAndroid Build Coastguard Workerdefine void @test_pow(half* %p, half* %q) #0 { 491*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 492*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 493*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.pow.f16(half %a, half %b) 494*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 495*9880d681SAndroid Build Coastguard Worker ret void 496*9880d681SAndroid Build Coastguard Worker} 497*9880d681SAndroid Build Coastguard Worker 498*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_exp: 499*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 500*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl expf 501*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 502*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_exp: 503*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 504*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl expf 505*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 506*9880d681SAndroid Build Coastguard Workerdefine void @test_exp(half* %p) #0 { 507*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 508*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.exp.f16(half %a) 509*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 510*9880d681SAndroid Build Coastguard Worker ret void 511*9880d681SAndroid Build Coastguard Worker} 512*9880d681SAndroid Build Coastguard Worker 513*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_exp2: 514*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 515*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl exp2f 516*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 517*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_exp2: 518*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 519*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl exp2f 520*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 521*9880d681SAndroid Build Coastguard Workerdefine void @test_exp2(half* %p) #0 { 522*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 523*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.exp2.f16(half %a) 524*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 525*9880d681SAndroid Build Coastguard Worker ret void 526*9880d681SAndroid Build Coastguard Worker} 527*9880d681SAndroid Build Coastguard Worker 528*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_log: 529*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 530*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl logf 531*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 532*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_log: 533*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 534*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl logf 535*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 536*9880d681SAndroid Build Coastguard Workerdefine void @test_log(half* %p) #0 { 537*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 538*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.log.f16(half %a) 539*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 540*9880d681SAndroid Build Coastguard Worker ret void 541*9880d681SAndroid Build Coastguard Worker} 542*9880d681SAndroid Build Coastguard Worker 543*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_log10: 544*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 545*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl log10f 546*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 547*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_log10: 548*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 549*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl log10f 550*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 551*9880d681SAndroid Build Coastguard Workerdefine void @test_log10(half* %p) #0 { 552*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 553*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.log10.f16(half %a) 554*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 555*9880d681SAndroid Build Coastguard Worker ret void 556*9880d681SAndroid Build Coastguard Worker} 557*9880d681SAndroid Build Coastguard Worker 558*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_log2: 559*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 560*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl log2f 561*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 562*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_log2: 563*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 564*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl log2f 565*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 566*9880d681SAndroid Build Coastguard Workerdefine void @test_log2(half* %p) #0 { 567*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 568*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.log2.f16(half %a) 569*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 570*9880d681SAndroid Build Coastguard Worker ret void 571*9880d681SAndroid Build Coastguard Worker} 572*9880d681SAndroid Build Coastguard Worker 573*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fma: 574*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 575*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 576*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 577*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl fmaf 578*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 579*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fma: 580*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 581*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 582*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 583*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl fmaf 584*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 585*9880d681SAndroid Build Coastguard Workerdefine void @test_fma(half* %p, half* %q, half* %r) #0 { 586*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 587*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 588*9880d681SAndroid Build Coastguard Worker %c = load half, half* %r, align 2 589*9880d681SAndroid Build Coastguard Worker %v = call half @llvm.fma.f16(half %a, half %b, half %c) 590*9880d681SAndroid Build Coastguard Worker store half %v, half* %p 591*9880d681SAndroid Build Coastguard Worker ret void 592*9880d681SAndroid Build Coastguard Worker} 593*9880d681SAndroid Build Coastguard Worker 594*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fabs: 595*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 596*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vabs.f32 597*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 598*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fabs: 599*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 600*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bfc 601*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 602*9880d681SAndroid Build Coastguard Workerdefine void @test_fabs(half* %p) { 603*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 604*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.fabs.f16(half %a) 605*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 606*9880d681SAndroid Build Coastguard Worker ret void 607*9880d681SAndroid Build Coastguard Worker} 608*9880d681SAndroid Build Coastguard Worker 609*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_minnum: 610*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 611*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 612*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl fminf 613*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 614*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_minnum: 615*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 616*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 617*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl fminf 618*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 619*9880d681SAndroid Build Coastguard Workerdefine void @test_minnum(half* %p, half* %q) #0 { 620*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 621*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 622*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.minnum.f16(half %a, half %b) 623*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 624*9880d681SAndroid Build Coastguard Worker ret void 625*9880d681SAndroid Build Coastguard Worker} 626*9880d681SAndroid Build Coastguard Worker 627*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_maxnum: 628*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 629*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 630*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl fmaxf 631*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 632*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_maxnum: 633*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 634*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 635*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl fmaxf 636*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 637*9880d681SAndroid Build Coastguard Workerdefine void @test_maxnum(half* %p, half* %q) #0 { 638*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 639*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 640*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.maxnum.f16(half %a, half %b) 641*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 642*9880d681SAndroid Build Coastguard Worker ret void 643*9880d681SAndroid Build Coastguard Worker} 644*9880d681SAndroid Build Coastguard Worker 645*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_minnan: 646*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 647*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 648*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 649*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 650*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vmin.f32 651*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fcmpge 652*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 653*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 654*9880d681SAndroid Build Coastguard Workerdefine void @test_minnan(half* %p) #0 { 655*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 656*9880d681SAndroid Build Coastguard Worker %c = fcmp ult half %a, 1.0 657*9880d681SAndroid Build Coastguard Worker %r = select i1 %c, half %a, half 1.0 658*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 659*9880d681SAndroid Build Coastguard Worker ret void 660*9880d681SAndroid Build Coastguard Worker} 661*9880d681SAndroid Build Coastguard Worker 662*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_maxnan: 663*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 664*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 665*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 666*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 667*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: vmax.f32 668*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fcmple 669*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 670*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 671*9880d681SAndroid Build Coastguard Workerdefine void @test_maxnan(half* %p) #0 { 672*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 673*9880d681SAndroid Build Coastguard Worker %c = fcmp ugt half %a, 1.0 674*9880d681SAndroid Build Coastguard Worker %r = select i1 %c, half %a, half 1.0 675*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 676*9880d681SAndroid Build Coastguard Worker ret void 677*9880d681SAndroid Build Coastguard Worker} 678*9880d681SAndroid Build Coastguard Worker 679*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_copysign: 680*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 681*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 682*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vbsl 683*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 684*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_copysign: 685*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 686*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 687*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-LIBCALL: vbsl 688*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bfc 689*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: and 690*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: orr 691*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 692*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign(half* %p, half* %q) #0 { 693*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 694*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 695*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.copysign.f16(half %a, half %b) 696*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 697*9880d681SAndroid Build Coastguard Worker ret void 698*9880d681SAndroid Build Coastguard Worker} 699*9880d681SAndroid Build Coastguard Worker 700*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_floor: 701*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 702*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl floorf 703*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 704*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_floor: 705*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 706*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl floorf 707*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 708*9880d681SAndroid Build Coastguard Workerdefine void @test_floor(half* %p) { 709*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 710*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.floor.f16(half %a) 711*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 712*9880d681SAndroid Build Coastguard Worker ret void 713*9880d681SAndroid Build Coastguard Worker} 714*9880d681SAndroid Build Coastguard Worker 715*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_ceil: 716*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 717*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl ceilf 718*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 719*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_ceil: 720*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 721*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl ceilf 722*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 723*9880d681SAndroid Build Coastguard Workerdefine void @test_ceil(half* %p) { 724*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 725*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.ceil.f16(half %a) 726*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 727*9880d681SAndroid Build Coastguard Worker ret void 728*9880d681SAndroid Build Coastguard Worker} 729*9880d681SAndroid Build Coastguard Worker 730*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_trunc: 731*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 732*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl truncf 733*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 734*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_trunc: 735*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 736*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl truncf 737*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 738*9880d681SAndroid Build Coastguard Workerdefine void @test_trunc(half* %p) { 739*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 740*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.trunc.f16(half %a) 741*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 742*9880d681SAndroid Build Coastguard Worker ret void 743*9880d681SAndroid Build Coastguard Worker} 744*9880d681SAndroid Build Coastguard Worker 745*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_rint: 746*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 747*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl rintf 748*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 749*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_rint: 750*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 751*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl rintf 752*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 753*9880d681SAndroid Build Coastguard Workerdefine void @test_rint(half* %p) { 754*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 755*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.rint.f16(half %a) 756*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 757*9880d681SAndroid Build Coastguard Worker ret void 758*9880d681SAndroid Build Coastguard Worker} 759*9880d681SAndroid Build Coastguard Worker 760*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_nearbyint: 761*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 762*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl nearbyintf 763*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 764*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_nearbyint: 765*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 766*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl nearbyintf 767*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 768*9880d681SAndroid Build Coastguard Workerdefine void @test_nearbyint(half* %p) { 769*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 770*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.nearbyint.f16(half %a) 771*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 772*9880d681SAndroid Build Coastguard Worker ret void 773*9880d681SAndroid Build Coastguard Worker} 774*9880d681SAndroid Build Coastguard Worker 775*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_round: 776*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 777*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: bl roundf 778*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 779*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_round: 780*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 781*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl roundf 782*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 783*9880d681SAndroid Build Coastguard Workerdefine void @test_round(half* %p) { 784*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 785*9880d681SAndroid Build Coastguard Worker %r = call half @llvm.round.f16(half %a) 786*9880d681SAndroid Build Coastguard Worker store half %r, half* %p 787*9880d681SAndroid Build Coastguard Worker ret void 788*9880d681SAndroid Build Coastguard Worker} 789*9880d681SAndroid Build Coastguard Worker 790*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-LABEL: test_fmuladd: 791*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 792*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 793*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 794*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vmla.f32 795*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f16.f32 796*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-LABEL: test_fmuladd: 797*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 798*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 799*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_h2f 800*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-LIBCALL: vmla.f32 801*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: bl __aeabi_fmul 802*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL: bl __aeabi_f2h 803*9880d681SAndroid Build Coastguard Workerdefine void @test_fmuladd(half* %p, half* %q, half* %r) #0 { 804*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 805*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q, align 2 806*9880d681SAndroid Build Coastguard Worker %c = load half, half* %r, align 2 807*9880d681SAndroid Build Coastguard Worker %v = call half @llvm.fmuladd.f16(half %a, half %b, half %c) 808*9880d681SAndroid Build Coastguard Worker store half %v, half* %p 809*9880d681SAndroid Build Coastguard Worker ret void 810*9880d681SAndroid Build Coastguard Worker} 811*9880d681SAndroid Build Coastguard Worker 812*9880d681SAndroid Build Coastguard Worker; f16 vectors are not legal in the backend. Vector elements are not assigned 813*9880d681SAndroid Build Coastguard Worker; to the register, but are stored in the stack instead. Hence insertelement 814*9880d681SAndroid Build Coastguard Worker; and extractelement have these extra loads and stores. 815*9880d681SAndroid Build Coastguard Worker 816*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_insertelement: 817*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: sub sp, sp, #8 818*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 819*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 820*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 821*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 822*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 823*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 824*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 825*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 826*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: mov 827*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-DAG: ldrh 828*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-DAG: add 829*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 830*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 831*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 832*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 833*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 834*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 835*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 836*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 837*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 838*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: add sp, sp, #8 839*9880d681SAndroid Build Coastguard Workerdefine void @test_insertelement(half* %p, <4 x half>* %q, i32 %i) #0 { 840*9880d681SAndroid Build Coastguard Worker %a = load half, half* %p, align 2 841*9880d681SAndroid Build Coastguard Worker %b = load <4 x half>, <4 x half>* %q, align 8 842*9880d681SAndroid Build Coastguard Worker %c = insertelement <4 x half> %b, half %a, i32 %i 843*9880d681SAndroid Build Coastguard Worker store <4 x half> %c, <4 x half>* %q 844*9880d681SAndroid Build Coastguard Worker ret void 845*9880d681SAndroid Build Coastguard Worker} 846*9880d681SAndroid Build Coastguard Worker 847*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_extractelement: 848*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: sub sp, sp, #8 849*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: ldrh 850*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: ldrh 851*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: orr 852*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: str 853*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: ldrh 854*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: ldrh 855*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: orr 856*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: str 857*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: mov 858*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: add 859*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: ldrh 860*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: strh 861*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: add sp, sp, #8 862*9880d681SAndroid Build Coastguard Worker; CHECK-VFP: bx lr 863*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: ldrh 864*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: strh 865*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: ldrh 866*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: strh 867*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: ldrh 868*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: strh 869*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: ldrh 870*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: strh 871*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP: ldrh 872*9880d681SAndroid Build Coastguard Workerdefine void @test_extractelement(half* %p, <4 x half>* %q, i32 %i) #0 { 873*9880d681SAndroid Build Coastguard Worker %a = load <4 x half>, <4 x half>* %q, align 8 874*9880d681SAndroid Build Coastguard Worker %b = extractelement <4 x half> %a, i32 %i 875*9880d681SAndroid Build Coastguard Worker store half %b, half* %p 876*9880d681SAndroid Build Coastguard Worker ret void 877*9880d681SAndroid Build Coastguard Worker} 878*9880d681SAndroid Build Coastguard Worker 879*9880d681SAndroid Build Coastguard Worker; test struct operations 880*9880d681SAndroid Build Coastguard Worker 881*9880d681SAndroid Build Coastguard Worker%struct.dummy = type { i32, half } 882*9880d681SAndroid Build Coastguard Worker 883*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_insertvalue: 884*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-DAG: ldr 885*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-DAG: ldrh 886*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-DAG: strh 887*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-DAG: str 888*9880d681SAndroid Build Coastguard Workerdefine void @test_insertvalue(%struct.dummy* %p, half* %q) { 889*9880d681SAndroid Build Coastguard Worker %a = load %struct.dummy, %struct.dummy* %p 890*9880d681SAndroid Build Coastguard Worker %b = load half, half* %q 891*9880d681SAndroid Build Coastguard Worker %c = insertvalue %struct.dummy %a, half %b, 1 892*9880d681SAndroid Build Coastguard Worker store %struct.dummy %c, %struct.dummy* %p 893*9880d681SAndroid Build Coastguard Worker ret void 894*9880d681SAndroid Build Coastguard Worker} 895*9880d681SAndroid Build Coastguard Worker 896*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_extractvalue: 897*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: .fnstart 898*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: ldrh 899*9880d681SAndroid Build Coastguard Worker; CHECK-ALL: strh 900*9880d681SAndroid Build Coastguard Workerdefine void @test_extractvalue(%struct.dummy* %p, half* %q) { 901*9880d681SAndroid Build Coastguard Worker %a = load %struct.dummy, %struct.dummy* %p 902*9880d681SAndroid Build Coastguard Worker %b = extractvalue %struct.dummy %a, 1 903*9880d681SAndroid Build Coastguard Worker store half %b, half* %q 904*9880d681SAndroid Build Coastguard Worker ret void 905*9880d681SAndroid Build Coastguard Worker} 906*9880d681SAndroid Build Coastguard Worker 907*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_struct_return: 908*9880d681SAndroid Build Coastguard Worker; CHECK-FP16: vcvtb.f32.f16 909*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-LIBCALL: bl __aeabi_h2f 910*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-DAG: ldr 911*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-DAG: ldrh 912*9880d681SAndroid Build Coastguard Workerdefine %struct.dummy @test_struct_return(%struct.dummy* %p) { 913*9880d681SAndroid Build Coastguard Worker %a = load %struct.dummy, %struct.dummy* %p 914*9880d681SAndroid Build Coastguard Worker ret %struct.dummy %a 915*9880d681SAndroid Build Coastguard Worker} 916*9880d681SAndroid Build Coastguard Worker 917*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-LABEL: test_struct_arg: 918*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: .fnstart 919*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-NEXT: mov r0, r1 920*9880d681SAndroid Build Coastguard Worker; CHECK-ALL-NEXT: bx lr 921*9880d681SAndroid Build Coastguard Workerdefine half @test_struct_arg(%struct.dummy %p) { 922*9880d681SAndroid Build Coastguard Worker %a = extractvalue %struct.dummy %p, 1 923*9880d681SAndroid Build Coastguard Worker ret half %a 924*9880d681SAndroid Build Coastguard Worker} 925*9880d681SAndroid Build Coastguard Worker 926*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_uitofp_i32_fadd: 927*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-DAG: vcvt.f32.u32 928*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-DAG: bl __aeabi_ui2f 929*9880d681SAndroid Build Coastguard Worker 930*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-DAG: vcvtb.f16.f32 931*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-DAG: vcvtb.f32.f16 932*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-DAG: bl __aeabi_h2f 933*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-DAG: bl __aeabi_h2f 934*9880d681SAndroid Build Coastguard Worker 935*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-DAG: vadd.f32 936*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-DAG: bl __aeabi_fadd 937*9880d681SAndroid Build Coastguard Worker 938*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-DAG: vcvtb.f16.f32 939*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-DAG: bl __aeabi_f2h 940*9880d681SAndroid Build Coastguard Workerdefine half @test_uitofp_i32_fadd(i32 %a, half %b) #0 { 941*9880d681SAndroid Build Coastguard Worker %c = uitofp i32 %a to half 942*9880d681SAndroid Build Coastguard Worker %r = fadd half %b, %c 943*9880d681SAndroid Build Coastguard Worker ret half %r 944*9880d681SAndroid Build Coastguard Worker} 945*9880d681SAndroid Build Coastguard Worker 946*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_sitofp_i32_fadd: 947*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-DAG: vcvt.f32.s32 948*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-DAG: bl __aeabi_i2f 949*9880d681SAndroid Build Coastguard Worker 950*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-DAG: vcvtb.f16.f32 951*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-DAG: vcvtb.f32.f16 952*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-DAG: bl __aeabi_h2f 953*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-DAG: bl __aeabi_h2f 954*9880d681SAndroid Build Coastguard Worker 955*9880d681SAndroid Build Coastguard Worker; CHECK-VFP-DAG: vadd.f32 956*9880d681SAndroid Build Coastguard Worker; CHECK-NOVFP-DAG: bl __aeabi_fadd 957*9880d681SAndroid Build Coastguard Worker 958*9880d681SAndroid Build Coastguard Worker; CHECK-FP16-DAG: vcvtb.f16.f32 959*9880d681SAndroid Build Coastguard Worker; CHECK-LIBCALL-DAG: bl __aeabi_f2h 960*9880d681SAndroid Build Coastguard Workerdefine half @test_sitofp_i32_fadd(i32 %a, half %b) #0 { 961*9880d681SAndroid Build Coastguard Worker %c = sitofp i32 %a to half 962*9880d681SAndroid Build Coastguard Worker %r = fadd half %b, %c 963*9880d681SAndroid Build Coastguard Worker ret half %r 964*9880d681SAndroid Build Coastguard Worker} 965*9880d681SAndroid Build Coastguard Worker 966*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind } 967