This is an archive of the discontinued LLVM Phabricator instance.

[ARM] MVE Masked loads and stores
ClosedPublic

Authored by dmgreen on Aug 21 2019, 7:07 AM.

Details

Summary

Masked loads and store fit naturally with MVE, the instructions being easily predicated. This adds lowering for the simple cases of masked loads and stores. It does not yet deal with widening/narrowing or pre/post inc.

The llvm masked load intrinsic will accept a "passthru" value, dictating the values used for the zero masked lanes. In MVE the instructions write 0 to the zero predicated lanes, so we need to match a passthru that isn't 0 (or undef) with a select instruction to pull in the correct data after the load.

We also need to something with unaligned loads/stores. Currently this uses a similar method used in big endian, using an VLDRB.8 (and potentially a VREV in BE). This does mean that the predicate mask is converted from, for example, a v16i1 to a v4i1. The VLDR instructions are defined as using the first bit of the relevant mask lane, so this could potentially load different results if the predicate is little odd. As the input is a v4i1 however, I believe this is OK and all the bits required should be set in the predicate, making the VLDRB.8 load the same data.

Diff Detail

Event Timeline

dmgreen created this revision.Aug 21 2019, 7:07 AM

Sorry if I've missed it or misunderstood the tests, but are we testing the cases where we need to generated a vsel?

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

Aren't the aligned patterns the same for both LE and BE? If so, we can refactor this.

dmgreen updated this revision to Diff 217417.Aug 27 2019, 8:51 AM
dmgreen marked an inline comment as done.

Sorry if I've missed it or misunderstood the tests, but are we testing the cases where we need to generated a vsel?

I don't think showing the differences between the old tests was being very helpful. I've changes it to just show the new tests. It's the "_other" tests that include the vpsels.

samparker accepted this revision.Aug 28 2019, 3:04 AM

Thanks for clearing that up, LGTM.

This revision is now accepted and ready to land.Aug 28 2019, 3:04 AM
This revision was automatically updated to reflect the committed changes.
llvm/test/CodeGen/Thumb2/mve-masked-ldst.ll