https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120434
--- Comment #5 from Kang-Che Sung <Explorer09 at gmail dot com> --- Note that I only report this as a bug for x86-64 targets. I've also tested an RISC-V (64-bit) and on that target the zero-extension would make larger code. So I can say such an optimization would be target specific - using sign-extension might be better on some architectures while using zero-extension might be better on others.