https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82325

--- Comment #2 from David <dvd at gnx dot it> ---
(In reply to Jakub Jelinek from comment #1)
> 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.

Thanks! change the param to 32 did the trick (even if the resulting code is
larger than the one produced by clang)

> 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).

The rewrite as a binary search result a more compact code, I'll profile it to
understand if it will be also faster.

Do you prefer to keep this bug open or can I mark it as resolved?

Reply via email to