https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94567
--- Comment #7 from Jeffrey A. Law <law at redhat dot com> --- I think it's trying to use smaller modes because the encodings can be smaller. In other cases it changes the mode to avoid partial register stalls. It's a bit of a mess. WRT the fragment you mentioned, I looked at that repeatedly trying to ascertain the real motivation and whether or not that code needed generalization to handle this case or was a misguided attempt to fix another instance of this issue. The conclusion I came to was that hunk of code may well be working around another instance of this same problem, but it was neither generalizable to this BZ nor would my approach totally fix that instance. We may be able to remove the hack in the testqi_ext_3 pattern, but I think the corresponding hack in testdi_1 would have to stay unless we found a way to merge testdi_1 into the more general test<mode>_1 pattern. Neither of those seems terribly appropriate right now.