So for some targets (like stm8), SDCC uses a jump table, for others it uses an if-else chain. Neither is optimal here, but let's ignore that for now. A jump table would already be an improvement for z80.

  • The if-else chain then takes more time in (G)CSE. (G)CSE being slow for large control-flow graphs is a known issue.
  • On the other hand, a jump table should be much better than an if-else chain here, so I wonder what goes wrong in the heuristic making the jump table vs. if/else chain choice.