https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65220
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- See r164593. expand_divmod works just fine, but here we aren't dividing by CONST_INT, but virtual reg. One way to improve this, if crtl->preferred_stack_boundary is always a power of two, would be to add another virtual register, virtual_preferred_stack_boundary_log_rtx, which would be substituted with exact_log2 (crtl->preferred_stack_boundary / BITS_PER_UNIT). Another possibility is to tweak i?86 udivmod* patterns, so that they would accept non-immediates and power of two CONST_INTs, but because that patterns computes both division and modulus, we'd need to split that into LSHIFTRT and AND. As i?86 is the only target with SUPPORTS_STACK_ALIGNMENT support, perhaps this change would be more kind to all other targets.