riscv64: Implement SIMD swizzle and shuffle#6515
Merged
afonso360 merged 5 commits intoJun 6, 2023
Merged
Conversation
fitzgen
approved these changes
Jun 6, 2023
Member
fitzgen
left a comment
There was a problem hiding this comment.
LGTM with the following little nitpicks. Thanks!
| ;; UImm5 Helpers | ||
|
|
||
| ;; Extractor that matches a `Value` equivalent to a replicated UImm5 on all lanes. | ||
| ;; TODO: Try matching vconst here as well |
Member
There was a problem hiding this comment.
Can you either resolve this TODO in this PR or turn it into TODO(#1234) with a reference to a follow up issue?
| (VecAMode.UnitStride (gen_const_amode n)) | ||
| (mem_flags_trusted) | ||
| (unmasked) | ||
| ty)) No newline at end of file |
Member
There was a problem hiding this comment.
Nitpick: missing trailing newline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
👋 Hey,
This PR implements the
swizzleandshuffleinstructions in the RISC-V backend.swizzlemaps directly ontovrgatherwith a SEW of 8, so that's a fairly simple implementation. Forshufflewe have to do twovrgathersone for values in the range of the first register and the second for values in range of the second register and merge them together.I double checked the
shuffleimplementation, and it seems to match what v8 does.vrgatheris a somewhat special instruction in that it forbids the destination register from being the same as any of the source registers (including the mask register). I've modeled this as anearly_def, which seems to be correct based on what I've read from regalloc2 docs, but I'm not 100% sure.There are a few other instructions like this, but none that we have implemented yet.