Page MenuHomePhabricator

[ARM] One-off identity shuffle

Authored by dmgreen on Jan 27 2021, 11:16 AM.



A One-Off Identity mask is a shuffle that is mostly an identity mask from as single source but contains a single element out-of-place, either from a different vector or from another position in the same vector. As opposed to lowering this via a ARMISD::BUILD_VECTOR we can generate an extract/insert pair directly. Under ARM with individually accessible lane elements this often becomes a simple lane move.

This also alters the LowerVECTOR_SHUFFLEUsingMovs code to use v4f32 (not v4i32), a more natural type for lane moves.

Diff Detail

Event Timeline

dmgreen created this revision.Jan 27 2021, 11:16 AM
dmgreen requested review of this revision.Jan 27 2021, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2021, 11:16 AM
SjoerdMeijer added inline comments.Feb 8 2021, 1:23 AM

Why are we changing this into v4f32?

Thanks for talking a look


A v4f32 is a more natural type for lane moves, which is what this is essentially doing. We are moving s registers around, with are naturally f32's.

SjoerdMeijer added inline comments.Feb 8 2021, 7:09 AM

nit: shorter is:

for (int i = 0; i < Mask.size(); ++i)

Do we have a test for this? Might have missed it, but didn't see one I think.

dmgreen added inline comments.Feb 8 2021, 7:59 AM

I believe this is how llvm specifies this should be. So we only evaluate Mask.size() once. Apparently I got it from here:


For undef elements? Yeah they will be tested as a part of the vld3 and shuffle3steptype tests I believe, but I'll make sure there are specific tests.

dmgreen updated this revision to Diff 322115.Feb 8 2021, 8:07 AM

Rebase and add some undef mask element tests.

SjoerdMeijer accepted this revision.Feb 8 2021, 8:23 AM

Thanks, LGTM

This revision is now accepted and ready to land.Feb 8 2021, 8:23 AM
This revision was automatically updated to reflect the committed changes.