How do I write rotation Operation for the Risc-V(Assembly Language) Do we have any command for it like we have have in 8086?

雨燕双飞 提交于 2019-12-02 18:01:38

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!