We have handled the constants with many trailing zeros like i64 5228199936 ( 0b100110111101000000000000000000000) , which can be materialized by 2 instructions:
li 3, 2493 sldi 3, 3, 21
Inspired by this, we considered another case where the constant has many trailing ones. We can take advantage of li/lis's sign-extension to generate leading ones, and then mask extra bits off after rotation.
For example, without such ISEL pattern we need 4 instructions to materialize i64 10460594175 (0b1001101111011111111111111111111111)
li 3, 2 sldi 3, 3, 32 oris 3, 3, 28543 ori 3, 3, 65535
Now we only need 2 instructions after this patch:
li 3, -31522 rldicl 3, 3, 23, 30
selectI64ImmInstrCount need to be updated to return 2 for your pattern.