mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-10 19:47:40 +01:00

The computed value is only used when the register is equal to zero, so we can fully precompute it and materialize the constant instead. In other words, we change from ``` return reg == 0 ? (reg | 1ULL << 63) : reg; ``` to ``` return reg == 0 ? 1ULL << 63 : reg; ``` The number of instructions remains the same, but we eliminate an unnecessary dependency on the register value. Before: 0xb241037a orr x26, x27, #0x8000000000000000 0xeb1f037f cmp x27, xzr 0x9a9a137b csel x27, x27, x26, ne After: 0xd2f0001a mov x26, #-0x8000000000000000 ; =-9223372036854775808 0xeb1f037f cmp x27, xzr 0x9a9a137b csel x27, x27, x26, ne