To be clear, `li rx, 4096' isn't unsupported: it's a very-much-supported idiom for `lui rx, 1`.
On Mon, Jul 11, 2022 at 11:45 PM rguenth at gcc dot gnu.org via Gcc-bugs <gcc-bugs@gcc.gnu.org> wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106265 > > --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- > So why do we even emit unsupported 'li 4096' and leave it to the linker to > "optimize(?)"? At least the cost of this should be reflected - IIRC powerpc > recently got improvements for similar cases by changing the targets rtx_cost > hook to properly const SET from CONST_INT so that CSE doesn't leave so many > sets from constants around. > > OTOH LRA rematerialization also could be the culprit, thinking rematerializing > the constant is cheaper than spilling a register holding it.