spin2cpp
spin2cpp copied to clipboard
P2ASM opt: SKIPF as fast forward branch
This is just something I thought of today, that, from a cursory glance, the optimizer isn't doing yet. I'm not familiar with the ASM optimizer and it's past midnight, so I'm just throwing this out here RN.
Basically, when optimizing hubexec code, a forward JMP that goes over 6 or less instructions can be replaced by a SKIP/SKIPF with constant pattern to mitigate the FIFO flush (skipping 6 ops is 14 cycles, branch is 13..20 => save up to 6 cycles, more when skipping less than 6).
Similar thing works in cog code, skipping over up to 6 ops is 2 cycles faster than a branch, but one unrelated instruction has to be reordered after the SKIPF since the first instr can not be fast skipped. That's harder to implement, I think, and the gain is lower, so idk.
That's a good idea, thanks!
I'm not sure SKIPF will be as helpful any more, since the conditional execution changes to make that more aggressive.