https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109592
--- Comment #9 from Jeffrey A. Law <law at gcc dot gnu.org> --- Weird, I don't see the attachment either. I'll extract & upload it again. WRT costing. fwprop and combine will both query the target rtx costs and will reject when the target costing model indicates the change isn't actually profitable. As you'd noted before, combine will internally transform a sign/zero extension into a pair of shifts. The whole point of that internal canonicalization is to expose cases where the shifts can combine with other nearby operations. So there's no significant risk to detecting and creating the extension form earlier.