This is an archive of the discontinued LLVM Phabricator instance.

[ARM,MVE] Intrinsics for partial-overwrite imm shifts.
ClosedPublic

Authored by simon_tatham on Jan 7 2020, 5:56 AM.

Details

Summary

This batch of intrinsics covers two sets of immediate shift
instructions, which have in common that they only overwrite part of
their output register and so they need an extra input giving its
previous value.

The VSLI and VSRI instructions shift each lane of the input vector
left or right just as if they were normal immediate VSHL/VSHR, but
then they only overwrite the output bits that correspond to actual
shifted bits of the input. So VSLI will leave the low n bits of each
output lane unchanged, and VSRI the same with the top n bits.

The V[Q][R]SHR[U]N family are all narrowing shifts: they take an input
vector of 2n-bit integers, shift each lane right by a constant, and
then narrowing the shifted result to only n bits. So they only
overwrite half of the n-bit lanes in the output register, and the B/T
suffix indicates whether it's the bottom or top half of each 2n-bit
lane.

I've implemented the whole of the latter family using a single IR
intrinsic vshrn, which takes a lot of i32 parameters indicating
which instruction it expands to (by specifying signedness of the input
and output types, whether it saturates and/or rounds, etc).

Diff Detail

Event Timeline

simon_tatham created this revision.Jan 7 2020, 5:56 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 7 2020, 5:56 AM
dmgreen accepted this revision.Jan 8 2020, 5:21 AM

LGTM I think

clang/utils/TableGen/MveEmitter.cpp
1105

DesiredSize

This revision is now accepted and ready to land.Jan 8 2020, 5:21 AM
This revision was automatically updated to reflect the committed changes.
simon_tatham marked an inline comment as done.