mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-10 11:37:43 +01:00

You can encode a shifted 12-bit immediate in a SUB instruction on ARM64. We exploit this to avoid materializing the immediate. This approach saves an instruction if it does not need to be materialized in a register afterwards. Otherwise, we just materialize it later and the total number of instructions stays the same. Before: 0x52a00218 mov w24, #0x100000 ; =1048576 0xcb180379 sub x25, x27, x24 After: 0xd1440379 sub x25, x27, #0x100, lsl #12 ; =0x100000