This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Handle splats of constants for MVE qr instruction
ClosedPublic

Authored by dmgreen on Dec 7 2021, 4:53 AM.

Details

Summary

Some MVE instructions have "qr" variants that take a Q and R register, splatting the R register for each lane. This is usually handled fine for standard splats as we sink the splat into the loop and combine the resulting dup into the qr instruction. It does not work for constant splats though, as we generate a vmovimm or constant pool load instead.

The intercepts that, generating a vdup of the constant instead where we can turn the result into a qr instruction variant.

Diff Detail

Event Timeline

dmgreen created this revision.Dec 7 2021, 4:53 AM
dmgreen requested review of this revision.Dec 7 2021, 4:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2021, 4:53 AM
samtebbs added inline comments.Dec 9 2021, 9:17 AM
llvm/lib/Target/ARM/ARMISelLowering.cpp
7737

Can this info be put in tablegen somehow? We might well add support for a qr instruction and forget to add it here.

7802

I know that a 64 bit SplatBitSize shouldn't be legal at this point, but it may be worth adding an assertion to make sure it isn't 64, just for future proofing.

dmgreen added inline comments.Dec 10 2021, 3:47 AM
llvm/lib/Target/ARM/ARMISelLowering.cpp
7737

I'm not sure that is very simple simple. We are using the nodes/intrinsics here, not the final instructions. So only looking at ISD::ADD or the Intrinsic::arm_mve_add_predicated intrinsic, etc.

7802

The SplatBitSize is checked in the if above, so shouldn't be 64bits. It is probably worth making sure that SpaltBitSize == VT.getScalarSizeInBits(), to make sure the sizes are the same and the DUP will be able to be folded into the instruction. I'll add that in.

dmgreen updated this revision to Diff 393437.Dec 10 2021, 3:48 AM

Check the SplatSize and type match.

samtebbs accepted this revision.Dec 14 2021, 3:19 AM

Nice one

This revision is now accepted and ready to land.Dec 14 2021, 3:19 AM
This revision was automatically updated to reflect the committed changes.