This is an archive of the discontinued LLVM Phabricator instance.

[ARM,MVE] Add intrinsics and isel for MVE integer VMLA.
ClosedPublic

Authored by simon_tatham on Mar 13 2020, 2:34 AM.

Details

Summary

These instructions compute multiply+add in integers, with one of the
operands being a splat of a scalar. (VMLA and VMLAS differ in whether
the splat operand is a multiplier or the addend.)

I've represented these in IR using existing standard IR operations for
the unpredicated forms. The predicated forms are done with target-
specific intrinsics, as usual.

When operating on n-bit vector lanes, only the bottom n bits of the
i32 scalar operand are used. So we have to tell that to isel lowering,
to allow it to remove a pointless sign- or zero-extension instruction
on that input register. That's done in PerformIntrinsicCombine, but
first I had to enable PerformIntrinsicCombine for MVE targets
(previously all the intrinsics it handled were for NEON), and make it
a method of ARMTargetLowering so that it can get at
SimplifyDemandedBits.

Diff Detail

Event Timeline

simon_tatham created this revision.Mar 13 2020, 2:34 AM

Fix clang-format warnings.

(Is it really sensible to require even test input files, which are often autogenerated, to be fixed points of clang-format?)

dmgreen accepted this revision.Mar 16 2020, 7:38 AM

LGTM

llvm/lib/Target/ARM/ARMISelLowering.cpp
14323–14339

I know it's not part of this patch, but what is this code for?

llvm/lib/Target/ARM/ARMInstrMVE.td
5172

Can you make it so that patterns are:

def : Pat<(VTI.Vec (add (mul v1, v2), vs)),
          (VTI.Vec (Inst v1, v2, s))>;

So they are easier to read.

This revision is now accepted and ready to land.Mar 16 2020, 7:38 AM
simon_tatham marked an inline comment as done.Mar 16 2020, 10:14 AM
simon_tatham added inline comments.
llvm/lib/Target/ARM/ARMISelLowering.cpp
14323–14339

I have no idea! They date from rG2e076c4e02fb99 in 2009 which first introduced NEON support, and even then, the switch they appear in had a default: break clause.

My best guess is that they're intended as a kind of documentation. They signal to the reader: "I didn't forget about these intrinsics, I carefully considered them, decided they didn't need handling here, and included a comment saying why not."

This revision was automatically updated to reflect the committed changes.
simon_tatham marked an inline comment as done.