https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728
--- Comment #44 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Works for me. That would mean roughly applying the two patches, but instead of doing else if (res < 0) do if (res) (and something similar for aarch64).