https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98982
--- Comment #2 from Julian Andres Klode <j...@jak-linux.org> --- clang works perfectly, fwiw. I was told it has a separate pass dedicated to just recognizing loop idioms and optimizing them. I have no idea if gcc has that, but it seems useful.