RISC-V: no-match parse_(x|f)register

What

Remove match statements when parsing x/f registers, replacing with a cast.

This improves (on my machine):

  • parsing benchmark on jstz from ~34 -> ~44 million I/s
  • TPS from ~0.185 -> ~0.195
  • time spent in parse / step from ~23 -> ~16 %

Why

This significantly reduces the number of instructions used, allowing the functions to be inlined. See godbolt for a showcase of how much of a difference this can make

This additionally allows the two parse functions to be inlined.

How

We ensure that we convert the to-be-parsed value into a valid variant, and then transmute.

NB the x0 variant has been changed to usize::MAX as the wrapping sub becomes much more efficient.

Manually testing the MR

CI.

Merge request reports

Loading