riscv64: Add Zvbb (Vector Basic Bit-manipulation) extension support#13738
Open
rajeshgangam wants to merge 1 commit into
Open
riscv64: Add Zvbb (Vector Basic Bit-manipulation) extension support#13738rajeshgangam wants to merge 1 commit into
rajeshgangam wants to merge 1 commit into
Conversation
Add support for the RISC-V Zvbb extension in the Cranelift backend. This adds the `has_zvbb` feature flag and implements instruction selection for the following Zvbb instructions: Two-operand (VecAluOpRRR): - vandn.vv / vandn.vx — vector AND-NOT - vrol.vv / vrol.vx — vector rotate left - vror.vv / vror.vx — vector rotate right Immediate (VecAluOpRRImm5): - vror.vi — vector rotate right by immediate Single-operand (VecAluOpRR, VXUNARY0 encoding): - vbrev.v — bit reverse - vbrev8.v — bit reverse within bytes - vrev8.v — byte reverse - vclz.v — count leading zeros - vctz.v — count trailing zeros - vcpop.v — population count Lowering rules (gated by has_zvbb): - band(x, bnot(y)) → vandn.vv / vandn.vx - popcnt → vcpop.v - rotl → vrol.vx - rotr → vror.vx Resolves bytecodealliance#7187
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "cranelift", "cranelift:meta", "isle"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
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.
Summary
Add support for the RISC-V Zvbb extension in the Cranelift backend, implementing instruction selection and encoding for 13 vector bit-manipulation instructions.
has_zvbbfeature flag for the riscv64 ISAvandn,vrol,vror(two-operand),vror.vi(immediate), andvbrev,vbrev8,vrev8,vclz,vctz,vcpop(single-operand VXUNARY0)has_zvbb:band(x, bnot(y))→vandn,popcnt→vcpop,rotl→vrol.vx,rotr→vror.vxInstructions implemented
vandn.vv/.vxband(x, bnot(y))vrol.vv/.vxrotl(vec, scalar)vror.vv/.vx/.virotr(vec, scalar)vbrev.vvbrev8.vvrev8.vvclz.vvctz.vvcpop.vpopcnt(vec)Note:
vclz,vctz,vbrev,vbrev8,vrev8have ISLE helpers and correct encoding but no lowering rules yet becauseclz,ctz,bitrev,bswapare scalar-only in Cranelift IR. They are ready for use when vector-typed versions of these ops are added.vwsll(widening shift left) is deferred to a follow-up PR due to the large number of widening combination rules needed.Resolves #7187
Test plan
test compile precise-outputtests verify correct instruction selection and encoding across i8x16, i32x4, i64x2 element types (zvbb.clif)test runruntime tests verify correctness under QEMU riscv64 withzvbb=true(zvbb-run.clif)has_zvbbis not set