The existing code has three different ways to try to lower a 64-bit immediate to an ORR+MOVK. The result is messy: it misses some possible sequences, and the order of the checks means we sometimes emit ORR+MOVK+MOVK instead of ORR+MOVK.
Instead, just use a simple loop to try all possible two-instruction ORR+MOVK sequences.