https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94956
--- Comment #4 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:df569f7da567af4996821dc0a1871eec79957d04 commit r11-194-gdf569f7da567af4996821dc0a1871eec79957d04 Author: Jakub Jelinek <ja...@redhat.com> Date: Fri May 8 09:33:55 2020 +0200 match.pd: Optimize ffs of known non-zero arg into ctz + 1 [PR94956] The ffs expanders on several targets (x86, ia64, aarch64 at least) emit a conditional move or similar code to handle the case when the argument is 0, which makes the code longer. If we know from VRP that the argument will not be zero, we can (if the target has also an ctz expander) just use ctz which is undefined at zero and thus the expander doesn't need to deal with that. 2020-05-08 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/94956 * match.pd (FFS): Optimize __builtin_ffs* of non-zero argument into __builtin_ctz* + 1 if direct IFN_CTZ is supported. * gcc.target/i386/pr94956.c: New test.