问题
I have worked with assembly language of 8086 previously, rotation operation in 8086 was just a command. But I can't find a specific keyword for rotation operation in Risc-V assembly language.
回答1:
It looks like extension "B" should define such an instruction eventually.
Until then you have to compose it using left and right shifts.
Here's an equivalent of the MIPS32R2 rotrv instruction (rotate right by variable count):
rotrv:
subu neg_count, zero, count
srlv tmp1, src, count
sllv tmp2, src, neg_count
or dst, tmp1, tmp2
You can do the same on riscv.
来源:https://stackoverflow.com/questions/55394123/how-do-i-write-rotation-operation-for-the-risc-vassembly-language-do-we-have-a