By: Anon (no.delete@this.spam.com), June 7, 2022 9:58 pm
Room: Moderated Discussions
Brett (ggtgp.delete@this.yahoo.com) on June 7, 2022 6:04 pm wrote:
> Add/sub from memory would be the biggest gain in code size reduction combining instructions, and x86 has it.
The problem with add/sub in x86 is that it's destructive, a value in register was loaded there likely because it was going to be reused, by destroying it add reg, [mem] can only be used when it's the last usage of reg, in the case of add [mem], reg it is used, but the nature of this sequence make it rare anyway.
> Add/sub from memory would be the biggest gain in code size reduction combining instructions, and x86 has it.
The problem with add/sub in x86 is that it's destructive, a value in register was loaded there likely because it was going to be reused, by destroying it add reg, [mem] can only be used when it's the last usage of reg, in the case of add [mem], reg it is used, but the nature of this sequence make it rare anyway.