This is an archive of the discontinued LLVM Phabricator instance.

[ARM,MVE] Add intrinsics and isel for MVE fused multiply-add.
ClosedPublic

Authored by simon_tatham on Mar 11 2020, 8:37 AM.

Details

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.)

Diff Detail

Event Timeline

simon_tatham created this revision.Mar 11 2020, 8:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 11 2020, 8:37 AM

Update test results following a last-minute correctness fix. (I updated one of the two test files but not the other.)

Harbormaster completed remote builds in B48823: Diff 249641.
dmgreen accepted this revision.Mar 11 2020, 1:41 PM

LGTM. Thanks

This revision is now accepted and ready to land.Mar 11 2020, 1:41 PM
This revision was automatically updated to reflect the committed changes.