Add Get/Set for vectors and use them to implement Concat* operators for RVV #2362
+181
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request
Get
andSet
operators for RVV, which correspond to the__riscv_vget*
and__riscv_vset*
intrinsics, respectively.Concat*
operators withGet
andSet
.There are new type categories introduced (
_GET_SET
,_GET_SET_VIRT
,_GET_SET_SMALLEST
). The reason why new categories are introduces is:vget
andvset
intrinsics for non-fractional vector types as the whole register movement instructions are only available for LMUL >= 1. This corresponds to the_GET_SET
category. We cannot simply reuse the_TRUNC
category as it contains fractional vector types._GET_SET_VIRT
category simulates the intrinsics using instructions other than whole register movement. The result is a register with half in LMUL.LowerHalf
, it is useful to haveGet
andSet
also for the smallest LMUL for each SEW. This is the_GET_SET_SMALLEST
category, and the result would be the same as the original register type for this category.For the
Get
operator for fractional vector types, we useTrunc
, which is effectively a no-op, to extract the lower part, and we useSlideDown
for the upper parts.For the
Set
operator for fractional vector types, we usevmv
with the tail undisturbed configuration to set the lower part. We useSlideUp
for the upper parts.The
Concat
operator can then be optimized withGet
andSet
. For operators other thanConcatLowerUpper
, we need aGet
and aSet
, and the program should be optimal for all SEW/LMUL combinations. For theConcatLowerUpper
operator, we will need twoGet
s and twoSet
s. This would be optimal only when theGet
operation is always a no-op, meaning that the LMUL for the extracted part must be greater or equal to zero.