https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95867
--- 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:9a6c37e6ae520534993ef76dd45d016c8c86db21 commit r11-6581-g9a6c37e6ae520534993ef76dd45d016c8c86db21 Author: Jakub Jelinek <ja...@redhat.com> Date: Mon Jan 11 10:35:10 2021 +0100 reassoc: Reassociate integral multiplies [PR95867] For floating point multiply, we have nice code in reassoc to reassociate multiplications to almost optimal sequence of as few multiplications as possible (or library call), but for integral types we just give up because there is no __builtin_powi* for those types. As there is no library routine we could use, instead of adding new internal call just to hold it temporarily and then lower to multiplications again, this patch for the integral types calls into the sincos pass routine that expands it into multiplications right away. 2021-01-11 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/95867 * tree-ssa-math-opts.h: New header. * tree-ssa-math-opts.c: Include tree-ssa-math-opts.h. (powi_as_mults): No longer static. Use build_one_cst instead of build_real. Formatting fix. * tree-ssa-reassoc.c: Include tree-ssa-math-opts.h. (attempt_builtin_powi): Handle multiplication reassociation without powi_fndecl using powi_as_mults. (reassociate_bb): For integral types don't require -funsafe-math-optimizations to call attempt_builtin_powi. * gcc.dg/tree-ssa/pr95867.c: New test.