Comment by Reubensson
Comment by Reubensson 2 days ago
What do you mean that cpu does something different? Isnt cpu doing what is being asked, that being xor with consequence of zeroing when given two same values.
Comment by Reubensson 2 days ago
What do you mean that cpu does something different? Isnt cpu doing what is being asked, that being xor with consequence of zeroing when given two same values.
> with consequence of zeroing when given two same values
Right, it has the same consequence, but it doesn't actually perform the stated operation. ASM is just a now just a high level language that tells the computer to "please give me the same state that a PDP-11-like computer would give me upon executing these instructions."
Same consequence yes.
But it will not execute xor, nor will it actually zero out eax in most cases.
It'll do something similar to constant propagation with the information that whenever xor eax, eax occurs; all uses of eax go through a simpler execution path until eax is overwritten.
No.
It's emulating the zero result when it recognizes this pattern, usually by playing clever tricks with virtual registers.
I think OP means that it has come a long way from the simple mental model of µops being a direct execution of operations and with all the register renamings and so on