Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Could shift by 0 on vsll/vsrl/vsra.vi be used to encode shift of 32 instead? #614

Open
topperc opened this issue Dec 16, 2020 · 3 comments
Labels
Resolve after v1.0 Does not need to be resolved for v1.0 draft

Comments

@topperc
Copy link
Contributor

topperc commented Dec 16, 2020

Since shifting by 0 is useless, could this encoding be used to increase the shift amount range to include 32? I believe RV128C does something similar with C.SLLI to encode a shift of 64.

This came up in a conversation about supporting SEW=64 on RV32. @Hsiangkai had a prototype patch for LLVM that used this sequence to put a 64-bit value from two scalar registers into a vector.

vmv.v.x VHi, Hi
vsll.vx VHiShift, VHi, 32. <- This shift amount doesn't fit in vsll.vi so will need a GPR register.
vadd.vx VOp, VHiShift, Lo
vop.vv vd, vs2, VOp
@nick-knight
Copy link
Contributor

That's a cool idea. In fact, there's a whole list of arithmetic operations that are no-ops with zero immediate that could benefit from a similar trick.

@kasanovic
Copy link
Collaborator

There should a later vector extension that covers more bit manipulation operations including shifts/rotates, so don't want to complicate base instructions as these operations will get subsumed.

The example is somewhat niche, and putting immediate in scalar register is not a big overhead.

The NOPs will be repurposed as HINTs.

@kasanovic kasanovic added the Resolve after v1.0 Does not need to be resolved for v1.0 draft label Jun 8, 2021
@David-Horner
Copy link
Contributor

@kasanovic The NOPs will be repurposed as HINTs.

As a probable strategy, I agree. However, we may find a preferred purpose for them .... just sayin'.

IMHO it is correct that we keep them open for future use.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolve after v1.0 Does not need to be resolved for v1.0 draft
Projects
None yet
Development

No branches or pull requests

4 participants