From 02262662b4550d0227038470f2d7b3db7ada2b87 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Sat, 29 Sep 2012 23:52:48 +0000 Subject: [PATCH] Add an FMA intrinsic for ARM Neon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164904 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/arm_neon.td | 4 ++++ lib/CodeGen/CGBuiltin.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td index 360c7e2a63..3373e017de 100644 --- a/include/clang/Basic/arm_neon.td +++ b/include/clang/Basic/arm_neon.td @@ -394,3 +394,7 @@ def VREINTERPRET : Inst<"vreinterpret", "dd", "csilUcUsUiUlhfPcPsQcQsQiQlQUcQUsQUiQUlQhQfQPcQPs", OP_REINT>; +//////////////////////////////////////////////////////////////////////////////// +// Vector fused multiply-add operations + +def VFMA : SInst<"vfma", "dddd", "fQf">; diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 7a0abd71a6..a084be1f71 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -2032,6 +2032,14 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, Int = usgn ? Intrinsic::arm_neon_vmullu : Intrinsic::arm_neon_vmulls; Int = Type.isPoly() ? (unsigned)Intrinsic::arm_neon_vmullp : Int; return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vmull"); + case ARM::BI__builtin_neon_vfma_v: + case ARM::BI__builtin_neon_vfmaq_v: { + Value *F = CGM.getIntrinsic(Intrinsic::fma, Ty); + Ops[0] = Builder.CreateBitCast(Ops[0], Ty); + Ops[1] = Builder.CreateBitCast(Ops[1], Ty); + Ops[2] = Builder.CreateBitCast(Ops[2], Ty); + return Builder.CreateCall3(F, Ops[0], Ops[1], Ops[2]); + } case ARM::BI__builtin_neon_vpadal_v: case ARM::BI__builtin_neon_vpadalq_v: { Int = usgn ? Intrinsic::arm_neon_vpadalu : Intrinsic::arm_neon_vpadals; -- 2.40.0