https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129023
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Target Milestone|--- |17.0
Component|c |middle-end
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yeah, the code actually doesn't implement what the comment says:
T r = x;
for (unsigned i = 1; i < M; i = i + i)
r ^= r << i;
return r << N;
In C this doesn't evaluate the loop body if M is 1, but the normal RTL or later
GIMPLE is if (i < M) do { r ^= r << i; i = i + i; } while (i < M); and I've
only implemented the part without if (i < M). As M is always constant,
emitting a runtime loop doesn't make sense. Guess I should special case also
cnt == 2 because then we also don't need a runtime loop (although in that case
perhaps RTL optimizations optimize that out).