This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Idea for compressed instructions: Use a special 32-bit VLIW format #103
Comments
Inspired by #104 and #110, the encoding could be changed as follows:
|
2 tasks
Here are the instruction frequencies for the entire Doom binary (some of these are "false" - e.g. many instances of addpchi would be eliminated by relaxation for instance):
...and for Quake:
|
Note: This issue is pretty much made void by #141 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Compressed instruction sets
Compressed instruction sets seem to be all the rage these days. The obvious advantages are increased instruction bandwidth and reduced I$ load.
Traditional compressed instruction sets, especially those with mixed instruction sizes, come with a few caveats though:
Alternative: VLIW
All of the problems mentioned above go away if we pack two instructions into a single 32-bit instruction word.
To simplify as much as possible, let the two instructions be treated as normal instructions that execute one after another (i.e. don't treat the instructions as independent concurrent instructions as in traditional VLIW ISA:s).
The obvious disadvantage with this approach is that it may not be possible to emit compressed/packed instructions in as many situations as with a traditional compressed ISA, and more work may be needed by the compiler to optimally schedule instructions in a way that maximizes the utilization of this encoding format.
Below is an example, assuming that we implement #104 (so that we effectively only need 3 bits for all current type D instructions), and can use a 4-bit prefix, e.g.
1110
or1111
, for compressed instructions.Encoding
Formats
Each instruction slot (14 bits) may have one of the following encodings (preliminary - exact configurations and bit positions may be changed):
Suggested instructions
The instructions that we should be able to encode in this more compact form should be common ones. We should compile some large software suite and check which instructions are most common - AND would fit together in pairs.
Based on preliminary findings and common sense, a few common instructions seem to be:
Table 1.7 in The RISC-V Compressed Instruction Set Manual v1.9 contains some information about the relative frequency of common instructions.
If instructions are chosen in such a way that there can be a 1:1 mapping between regular instructions and packed instructions, the decision of whether or not to pack instructions can be done at assembly time.
The most obvious thing that would benefit from a VLIW-style compact format is stack handling (function prologues and epilogues), since:
Some examples are given below:
Branches and PC
Suggested rules for the PC of packed instructions:
Open questions
The text was updated successfully, but these errors were encountered: