https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94956
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |uros at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- VRP knows that the argument must be non-zero: # RANGE ~[0, 0] x.0_1 = (int) x_3(D); # RANGE [1, 32] NONZERO 63 _2 = __builtin_ffs (x.0_1); # RANGE [0, 31] NONZERO 31 _4 = _2 + -1; return _4; in *.optimized dump, but the comparison and conditional move is emitted by the ffssi2 i386.md expander. Unfortunately, from what that expander sees there is no way to find out the argument is non-zero. So, I wonder if for these optabs where whether the argument must be nonzero might matter (anything but ffs? I mean, clz, ctz have undefined values for zero) we shouldn't add further optab, like ffsnonzero, where the code which still can query VRP info of the argument could be used and use the other optab in expand_direct_optab_fn.