4 ms·
This is a cool concept! > Loop constants are written to the v hand. > There are eight callee-saved registers, which are written to the v hand, meaning that wh
by teraflop 3y ago
This is a cool concept!
> Loop constants are written to the v hand.
> There are eight callee-saved registers, which are written to the v hand, meaning that when it exits from a function, the values in v[0]–v[7] are not changed.
Any instruction whose destination is a hand will change the offsets of all previous values in that hand. So am I correctly understanding that with this calling convention, every function that includes a loop must end with eight "mv" instructions, to restore those eight callee-saved registers to the "top" of the v hand?
This seems like it would benefit enormously from a special instruction that allows you to decrement a hand's offset by a fixed amount.
- the8472 3y agoThere should be several ways to optimize around this without needing new instructions. Choosing different calling conventions for some functions (e.g. PreserveMost in llvm), amortizing the cost over multiple loops by inlining harder, using other hands instead if the register pressure inside the loop is low, ...
- chc4 3y agoThat immediately jumped out to me as well. I'm not sure their scheme can easily support a "hand decrement" instruction, either, since then the reused physical register might still have OoO instructions in flight using it and you're forced to stall, like they are doing if they loop around the hand ring buffer. You could have an instruction that pushes all of v[0]-v[7] to memory and restores it, like arm32 ldmia/stmdb, I guess?