With C extension, li with a 6 bit immediate followed by slli is 4 bytes.
The lui+addi(w) sequence is at least 6 bytes.
The two sequences probably have similar execution latency. The exception
being if the target supports lui+addi(w) macrofusion.
Since the execution latency is probably the same I didn't restrict
this to C extension.
This is confusing, LI is a pseudo implemented using this function but here you mean it to be what C.LI expands to. Though it doesn’t help there’s the LI alias that’s deemed canonical (which I don’t like but came from binutils).