https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96696
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:3dcd1334b4f522352b80814513fdca902fc2a207 commit r12-150-g3dcd1334b4f522352b80814513fdca902fc2a207 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Apr 27 14:45:45 2021 +0200 expand: Expand x / y * y as x - x % y if the latter is cheaper [PR96696] The following patch tests both x / y * y and x - x % y expansion for the former GIMPLE code and chooses the cheaper of those sequences. 2021-04-27 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/96696 * expr.c (expand_expr_divmod): New function. (expand_expr_real_2) <case TRUNC_DIV_EXPR>: Use it for truncations and divisions. Formatting fixes. <case MULT_EXPR>: Optimize x / y * y as x - x % y if the latter is cheaper. * gcc.target/i386/pr96696.c: New test.