https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18233
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |94956 Resolution|--- |FIXED Target Milestone|--- |11.2 Status|NEW |RESOLVED --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So this is fixed in a few different ways but fully with r11-194. For x86 with cmov (!=i386), this was fixed in GCC 4.5.0 where the ffs is expanded at expand time to use ctz and cmov. without cmov, this was only fixed in GCC 11 with r11-194 which changes ffs to ctz if ctz has a known 0 alrgument which x86 has. So closing as fixed for GCC 11; There is already a testcase for this too; gcc.target/i386/pr94956.c . Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94956 [Bug 94956] Unable to remove impossible ffs() test for zero