https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97459
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I plan to work on this early in stage3. And we really shouldn't use any tables, GCC should figure it all out. So, for double-word modulo by constant that would be expanded using a libcall, go for x from the word bitsize to double-word bitsize and check if (1max << x) % cst is 1 (and prefer what we've agreed on for 3), and fall back to multiplications (see #c8) if there aren't any other options and the costs don't say it is too costly.