4 ms·
It's dozens of cycles to do a DIV. On Skylake the various DIV instructions range from 23 to 95 cycles. That's longer than a pipeline stall. In the case of a
by kwillets 10y ago
It's dozens of cycles to do a DIV. On Skylake the various DIV instructions range from 23 to 95 cycles. That's longer than a pipeline stall.
In the case of a switch like this I would try something horrible like a template for each prime, so that the code is inlined.