[ARM,MVE] Add intrinsics and isel for MVE fused multiply-add.
authorSimon Tatham <simon.tatham@arm.com>
Thu, 12 Mar 2020 09:57:48 +0000 (09:57 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Thu, 12 Mar 2020 11:13:50 +0000 (11:13 +0000)
commit3f8e714e2f9f2dc3367d2f3fc569abfaf28f314c
tree182732fbecf0059d579773c4dff7bb58be218b17
parentd608fee8399a9fa6f2819076131c6ac30cc16eef
[ARM,MVE] Add intrinsics and isel for MVE fused multiply-add.

Summary:
This adds the ACLE intrinsic family for the VFMA and VFMS
instructions, which perform fused multiply-add on vectors of floats.

I've represented the unpredicated versions in IR using the cross-
platform `@llvm.fma` IR intrinsic. We already had isel rules to
convert one of those into a vector VFMA in the simplest possible way;
but we didn't have rules to detect a negated argument and turn it into
VFMS, or rules to detect a splat argument and turn it into one of the
two vector/scalar forms of the instruction. Now we have all of those.

The predicated form uses a target-specific intrinsic as usual, but
I've stuck to just one, for a predicated FMA. The subtraction and
splat versions are code-generated by passing an fneg or a splat as one
of its operands, the same way as the unpredicated version.

In arm_mve_defs.h, I've had to introduce a tiny extra piece of
infrastructure: a record `id` for use in codegen dags which implements
the identity function. (Just because you can't declare a Tablegen
value of type dag which is //only// a `$varname`: you have to wrap it
in something. Now I can write `(id $varname)` to get the same effect.)

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D75998
clang/include/clang/Basic/arm_mve.td
clang/include/clang/Basic/arm_mve_defs.td
clang/test/CodeGen/arm-mve-intrinsics/ternary.c [new file with mode: 0644]
llvm/include/llvm/IR/IntrinsicsARM.td
llvm/lib/Target/ARM/ARMInstrMVE.td
llvm/test/CodeGen/Thumb2/mve-fmas.ll
llvm/test/CodeGen/Thumb2/mve-intrinsics/ternary.ll [new file with mode: 0644]