https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124630
Hongtao Liu <liuhongt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
--- Comment #1 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
+/* popcount (X ^ (X - 1)) - 1 is CTZ (X) when X is nonzero. */
+(simplify
+ (minus (POPCOUNT (bit_xor:c tree_expr_nonzero_p@0
+ (plus @0 integer_minus_onep)))
+ integer_onep)
+ (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ && direct_internal_fn_supported_p (IFN_CTZ, TREE_TYPE (@0),
+ OPTIMIZE_FOR_SPEED))
+ (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
+ (CTZ:type (convert:utype @0)))))