5 ms·
MSVC can do this for x86 if the cases are densely packed and the default is blocked: https://gcc.godbolt.org/z/GPo9fMx8G https://gcc.godbolt.org/z/GPo9fMx8G Ho
by ack_complete 3mo ago
MSVC can do this for x86 if the cases are densely packed and the default is blocked:
https://gcc.godbolt.org/z/GPo9fMx8G https://gcc.godbolt.org/z/GPo9fMx8G
However, this optimization is less effective on modern CPUs with more powerful indirect predictors using global history.