riscv / riscv-bitmanip

Working draft of the proposed RISC-V Bitmanipulation extension

Home Page:https://jira.riscv.org/browse/RVG-122

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a instruction to implement bit reverse??

yuyang-ok opened this issue · comments

or there is a cheap way to implement bit reverse?
current now I only can do this using iteration.

You can use the Zbb rev8 from instruction to swap the bytes and then use shifts, ands, and ors to reverse the bits within each byte. https://godbolt.org/z/5onMsrq7r

Or you can use rev8 and brev8 from Zbkb to reverse bytes and bits within bytes. https://godbolt.org/z/5zh6dbjM7

ok,thanks you.