This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Teach DemandedVectorElts about VMOVN lanes
ClosedPublic

Authored by dmgreen on Sep 6 2021, 7:31 AM.

Details

Summary

The class of instructions that write to narrow top/bottom lanes only demand the even or odd elements of the input lanes. Which means that VMOVNT; VMOVNB demands no lanes from the original input. This teaches that to instcombine from the target hooks available through ARMTTIImpl.

Diff Detail

Event Timeline

dmgreen created this revision.Sep 6 2021, 7:31 AM
dmgreen requested review of this revision.Sep 6 2021, 7:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2021, 7:31 AM

Before I continue reading the rest, just wanted to check this:

The class of instructions that write to narrow top/bottom lanes only demand the even or odd elements of the input lanes. Which means that VMOVNT; VMOVNB demands no lanes from the original input.

I don't follow the conclusion here that the VMOVNT; VMOVNB don't demand lanes from the original input, because we do read from the original input?

Before I continue reading the rest, just wanted to check this:

The class of instructions that write to narrow top/bottom lanes only demand the even or odd elements of the input lanes. Which means that VMOVNT; VMOVNB demands no lanes from the original input.

I don't follow the conclusion here that the VMOVNT; VMOVNB don't demand lanes from the original input, because we do read from the original input?

Oh yeah, good point - the predicated intrinsics will not work this way if they are not acting on all lanes. I had forgotten that the first input is also the passthrough value. I'll update the patch to remove those.

For the non-predicated cases I mean to say - if you have overwritten the top lanes and you have overwritten the bottom lanes - then no value from the original input are demanded. You have overridden all the lanes. So a VMOVNT will demand the bottom (even) lanes from the first input and insert a new value into into the top (odd) lanes. A VMOVNB will demand the top (odd) lanes and write new values into the bottom. A pair of X=VMOVNT A, B; Y= VMOVNB X, C will use none of the lanes of A.

dmgreen updated this revision to Diff 371838.Sep 10 2021, 2:21 AM

Remove predicated instructions.

SjoerdMeijer accepted this revision.Sep 10 2021, 2:38 AM

Ah, thanks, got it, that's clear! Looks like a good change to me.

llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
276

The constants 2, 4, and 7 here were not immediately obvious to me. Perhaps a comment would help less familiar readers.

This revision is now accepted and ready to land.Sep 10 2021, 2:38 AM
This revision was landed with ongoing or failed builds.Sep 14 2021, 3:05 AM
This revision was automatically updated to reflect the committed changes.