https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71336
--- Comment #12 from Jeffrey A. Law <law at gcc dot gnu.org> --- So a note for RV64. I think this case could be improved into something like this: andi a0,a0,1 slli a0,a0,2 addi a0,a0,3 That's the most straightforward improvement and probably suitable for match.pd. Further improvement would be to: li t0,3 andi a0,a0,1 sh2add a0,a0,t0 That's marginally better as the "li" can issue whenever is convenient for an OoO core (and gives sched freedom to hoist it as well). This would be absolutely target dependent.
