https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106888
--- Comment #7 from Vineet Gupta <vineetg at gcc dot gnu.org> --- (In reply to Roger Sayle from comment #5) > Created attachment 54905 [details] > proposed patch > > This patch should fix this problem, by adding another pattern the machine > description to also recognize zero_extend of clz/ctz/pcnt, matching the > current pattern that only matches sign_extend. Clearly for SI operands, the > result must always be 0..32, so sign extension and zero extension are > equivalent, and the zero extension is perhaps (now) the preferred canonical > form. Thx for the patch Roger, but as Jeff noted, it alone is not enough and generates same extra ANDI. Would you have expected combine to recog() the new pattern ?