-
Notifications
You must be signed in to change notification settings - Fork 145
SIMD-0272: SBPF Encoding Efficiency #272
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
base: main
Are you sure you want to change the base?
Conversation
#### Two Source Register Operands | ||
|
||
For the 32 and 64 bit immediate-less variants of the following instructions: | ||
add, sub, xor, or, and, lsh, rsh, arsh, udiv, urem, sdiv, srem, lmul, uhmul, shmul |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest arbitrarily renaming some of the mnemonics while we have the chance.
add, sub, xor, or, and, lsh, rsh, arsh, udiv, urem, sdiv, srem, lmul, uhmul, shmul | |
add, sub, xor, or, and, sll, srl, sra, divu, remu, mul, mulhu, mulhsu |
Changing mnemonics would also discourage developers from writing dangerously fast programs in assembler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are our existing mnemonics.
| `r6` to `r17` | GPR | Callee-saved | ||
| `r18` to `r30` | GPR | Caller-saved | ||
| `r31` | Frame pointer | System register | ||
| `pc` | Program counter | Hidden register |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to burn one register and have it point to a "small data section" (.sdata) to improve the encoding efficiency of 64-bit loads.
| name | kind | Solana ABI | ||
|---------------:|:----------------|:---------- | ||
| `r0` | GPR | Return value | ||
| `r1` to `r5` | GPR | Argument registers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen many function calls use more than five registers to store arguments, so allocating more registers here (six or seven) would be beneficial to avoid stack spills.
No description provided.