Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Apr 1, 2025

No description provided.

#### 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
Copy link
Contributor

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.

Suggested change
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.

Copy link

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
Copy link
Contributor

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
Copy link

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.

4player90

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants