[Patch] Peephole optimizations for case with jumptables
Original Reporter info from Mantis: Martok @martok
-
Reporter name:
Original Reporter info from Mantis: Martok @martok
- Reporter name:
Description:
Building on top of 0033038, this patch adds a peephole optimization for the heads of "case Ordinal of", if checked jumptables are used.
The effect is that register loading and masking is unified to just 3 instructions with no latency between them (the same that most other compilers generate for jumptables), saving up to 4 cycles in microbenchmarks.
I have intentionally submitted a patch containing a commented-out check for the instruction after the AND on i386. I believe this check is unneccessary (as the comment above describes), but have left it in case it may not be. Need a second opinion on this.
Mantis conversion info:
- Mantis ID: 33093
- Monitored by: » @CuriousKit (J. Gareth Moreton)