https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82325
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- To unroll the loop completely with gcc, one needs to use --param max-completely-peel-times=32 because the loop has more than 16 iterations, which is the default limit for the complete unrolling. That said, neither of the compilers figures out that after unrolling the intervals are really adjacent, but disjoint, it would be much better to build a binary decision tree rather than a loop from smallest to largest. But you can handle that at the source level by doing a binary search in the array (and you could as well ignore bits there too, just look at the base values).