https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106585
--- Comment #13 from Jeffrey A. Law <law at gcc dot gnu.org> --- Yea, I definitely explored the ext-dce approach before for a different testcase. But I think it's really the only viable path I see. A quick POC results in: bclr a0,a0,a1 # 12 [c=4 l=4] *bitmanip.md:751 sext.w a0,a0 # 18 [c=4 l=4] *extendsidi2_internal/0 ret # 27 [c=0 l=4] simple_return My notes indicate that the transformation mucked up other bitmanip cases, so I'd fully expect the POC to fail in fun and interesting ways. But as I said, it's the only viable path I see. Making it work would help other cases, so I'll poke at it a bit more in my copious spare time.