This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Split vrgather intrinsics into separate vrgather.vv and vrgather.vx intrinsics.
ClosedPublic

Authored by craig.topper on Feb 3 2021, 2:39 PM.

Details

Summary

The vrgather.vv instruction uses a vector of indices with the same
SEW as operand 0. The vrgather.vx instructions use a scalar index
operand of XLen bits.

By splitting this into 2 intrinsics we are able to use LLVMatchType
in the definition to avoid specifying the type for the index operand
when creating the IR for the intrinsic. For .vv it will match the
operand 0 type. And for .vx it will match the type of the vl operand
we already needed to specify a type for.

I'm considering splitting more intrinsics. This was a somewhat
odd one because the .vx doesn't use the element type, it always
use XLen.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 3 2021, 2:39 PM
craig.topper requested review of this revision.Feb 3 2021, 2:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2021, 2:39 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
khchen added a comment.Feb 3 2021, 9:59 PM

Agree, this improvement is reasonable to me.

Seems reasonable to me, but given I dip in and out of the intrinsics layer I might wait for another review.

llvm/include/llvm/IR/IntrinsicsRISCV.td
249

nit, but M seems out of place given that the others are still Mask?

Group VRGather classes together
Switch vcompress to use VUnaryAAMask and remove the class it was using since they were identical.

HsiangKai accepted this revision.Feb 4 2021, 5:29 PM

LGTM.

This revision is now accepted and ready to land.Feb 4 2021, 5:29 PM
This revision was landed with ongoing or failed builds.Feb 4 2021, 8:25 PM
This revision was automatically updated to reflect the committed changes.