This is an archive of the discontinued LLVM Phabricator instance.

[ARM,MVE] Add intrinsics to deal with predicates.
ClosedPublic

Authored by simon_tatham on Nov 20 2019, 2:58 AM.

Details

Summary

This commit adds the vpselq intrinsics which take an MVE predicate
word and select lanes from two vectors; the vctp intrinsics which
create a tail predicate word suitable for processing the first m
elements of a vector (e.g. in the last iteration of a loop); and
vpnot, which simply complements a predicate word and is just
syntactic sugar for the ~ operator.

The vctp ACLE intrinsics are lowered to the IR intrinsics we've
already added (and which D70592 just reorganized). I've filled in the
missing isel rule for VCTP64, and added another set of rules to
generate the predicated forms.

I needed one small tweak in MveEmitter to allow the unpromoted type
modifier to apply to predicates as well as integers, so that vpnot
doesn't pointlessly convert its input integer to an <n x i1> before
complementing it.

Diff Detail

Event Timeline

simon_tatham created this revision.Nov 20 2019, 2:58 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 20 2019, 2:58 AM
dmgreen added inline comments.Nov 21 2019, 7:58 AM
llvm/include/llvm/IR/IntrinsicsARM.td
780 ↗(On Diff #230223)

Should we rename int_arm_vctp8 to int_arm_mve_vctp8?

783 ↗(On Diff #230223)

Is this ever used anywhere? It doesn't select as far as I can see, so I think you can just remove it.

llvm/lib/Target/ARM/ARMInstrMVE.td
4288–4289

Maybe call this MVE_VCTP and name the instruction MVE_VCTPInst, or something like it.

4292

Two lines on this one please, just to make it more obvious when looking at it.

simon_tatham marked an inline comment as done.

Made all the requested changes.

simon_tatham edited the summary of this revision. (Show Details)Nov 21 2019, 9:15 AM
simon_tatham added inline comments.
llvm/include/llvm/IR/IntrinsicsARM.td
780 ↗(On Diff #230223)

Ha! What you mean by this and the next comment is "Simon, you are totally wrong when you claim in the commit message that these intrinsics are for NEON as well". :-)

I was misled myself by the lack of "mve" in the name. So yes, now I've found out that they are MVE-specific, I agree I should put it in!

dmgreen accepted this revision.Nov 21 2019, 11:03 AM

Thanks, LGTM

This revision is now accepted and ready to land.Nov 21 2019, 11:03 AM
simon_tatham edited the summary of this revision. (Show Details)

Revised again to fix test failures. But I've also split off the rework of int_arm_vctp into a separate patch D70592, to make it clearer what's going on.

dmgreen accepted this revision.Nov 22 2019, 7:36 AM

Thanks. I'm still happy.

This revision was automatically updated to reflect the committed changes.