https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109040
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 54809 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54809&action=edit gcc13-pr109040.patch The following patch seems to fix it at least when eyeballing the testcase in a cross-compiler, it achieves exactly what we want, & 0x84c to perform the zero extension. But I have no way to actually test this on riscv.