This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82325] worse code generated compared to clang when using a constexpr array


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]