-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: No bit-field extract/insert instructions? #169
Comments
Many instructions were proposed in the bitmanip spec, and only a subset of them made them through the approval process. The full proposal did include some bitfield extract and insert instructions. You can find this info on the main-history branch. See bcompress/bdecompress in later versions, or bext/bdep in earlier versions. I don't know the exact reasons why bitfield extract/insert didn't make it into the final spec. Maybe someone thought they weren't useful enough. Maybe someone thought that they were too hard to implement in hardware. Maybe the compiler patches weren't good enough to show how useful they were. Maybe someone thought that the bitmanip spec was using too much of the opcode encoding space. Or maybe something else. It is possible that more instructions from the bitmanip spec will be added in future ISA updates. With about 16 ISA extensions approved last year, there were simply too many extensions in flight to get everything through the approval process. |
I get that. I was just surprised to find out that bit-field instructions had been dropped, especially when reading this in the latest RISC-V spec (chapter 18, "B" extension):
I get the feeling that the Zbs extension (single-bit instructions) is the reduced functionality version of full bit-field instructions (i.e. bit-field instructions with a fixed Last year I discovered how versatile the bit-field instructions are (the M88K-style ones), so I went ahead and replaced ASR/LSR/LSL in my MRISC32 ISA with EBF/EBFU/MKBF (I also added IBF - Insert BitField). They are really basic building blocks of an ISA as they can replace several other instructions. As it turns out that most ISA:s end up including bit-field instructions (ARMv7, AArch64, POWER, x86 (SIMD), etc, all have them to some extent), I figure that the sooner you add them to the ISA, the better (otherwise you will end up with lots of overlapping functionality that wastes opcode space). |
What is the rationale for not including proper bit-field manipulation instructions in the bitmanip extension?
Besides being very useful for extracting / inserting bit-fields from / to integer registers, they can also be used for:
ANDI rd, rs, (2^N-1)
).Note: The versatility of bit-field manipulation instructions in RISC machines was recognized in the late-80's M88K ISA, that only needed three instructions (EXT, EXTU, MAK) to cover for all shifting, sign/zero-extension and bit-field operations.
The text was updated successfully, but these errors were encountered: