1; RUN: llc < %s -mtriple=aarch64 -mattr=+v8.2a,+neon,+fullfp16 | FileCheck %s 2 3define dso_local half @t_vfmah_f16(half %a, half %b, half %c) { 4; CHECK-LABEL: t_vfmah_f16: 5; CHECK: fmadd h0, h1, h2, h0 6; CHECK-NEXT: ret 7entry: 8 %0 = tail call half @llvm.fma.f16(half %b, half %c, half %a) 9 ret half %0 10} 11 12define half @fnma16(half %a, half %b, half %c) nounwind readnone ssp { 13; CHECK-LABEL: fnma16: 14; CHECK: fnmadd h0, h0, h1, h2 15entry: 16 %0 = tail call half @llvm.fma.f16(half %a, half %b, half %c) 17 %mul = fmul half %0, -1.000000e+00 18 ret half %mul 19} 20 21define half @fms16(half %a, half %b, half %c) nounwind readnone ssp { 22; CHECK-LABEL: fms16: 23; CHECK: fmsub h0, h0, h1, h2 24entry: 25 %mul = fneg half %b 26 %0 = tail call half @llvm.fma.f16(half %a, half %mul, half %c) 27 ret half %0 28} 29 30define half @fms16_com(half %a, half %b, half %c) nounwind readnone ssp { 31; CHECK-LABEL: fms16_com: 32; CHECK: fmsub h0, h1, h0, h2 33; CHECK-NEXT: ret 34entry: 35 %mul = fneg half %b 36 %0 = tail call half @llvm.fma.f16(half %mul, half %a, half %c) 37 ret half %0 38} 39 40define half @fnms16(half %a, half %b, half %c) nounwind readnone ssp { 41; CHECK-LABEL: fnms16: 42; CHECK: fnmsub h0, h0, h1, h2 43; CHECK-NEXT: ret 44entry: 45 %mul = fneg half %c 46 %0 = tail call half @llvm.fma.f16(half %a, half %b, half %mul) 47 ret half %0 48} 49 50define half @test_fmsub(half %a, half %b, half %c) { 51; CHECK-LABEL: test_fmsub: 52; CHECK: fmsub h0, h0, h1, h2 53; CHECK-NEXT: ret 54entry: 55 %nega = fsub half -0.0, %a 56 %val = call half @llvm.fma.f16(half %nega, half %b, half %c) 57 ret half %val 58} 59 60define half @test_fnmadd(half %a, half %b, half %c) { 61; CHECK-LABEL: test_fnmadd: 62; CHECK: fnmadd h0, h0, h1, h2 63; CHECK-NEXT: ret 64entry: 65 %nega = fsub half -0.0, %a 66 %negc = fsub half -0.0, %c 67 %val = call half @llvm.fma.f16(half %nega, half %b, half %negc) 68 ret half %val 69} 70 71define half @test_fmadd(half %a, half %b, half %c) { 72; CHECK-LABEL: test_fmadd: 73; CHECK: fmadd h0, h0, h1, h2 74; CHECK-NEXT: ret 75entry: 76 %nega = fsub half -0.0, %a 77 %negb = fsub half -0.0, %b 78 %val = call half @llvm.fma.f16(half %nega, half %negb, half %c) 79 ret half %val 80} 81 82define half @test_fnmsub(half %a, half %b, half %c) { 83; CHECK-LABEL: test_fnmsub: 84; CHECK: fnmsub h0, h0, h1, h2 85; CHECK-NEXT: ret 86entry: 87 %negc = fsub half -0.0, %c 88 %val = call half @llvm.fma.f16(half %a, half %b, half %negc) 89 ret half %val 90} 91 92declare half @llvm.fma.f16(half, half, half) 93