Neccessity of push and pop operands on CPUs
- by Hawken
Why do we have commands like push and pop?
From what I understand pop and push are basically the same as doing a (mov then add) and (sub then mov) on esp respectively.
For example wouldn't:
pushl %eax
be equivalent to:
subl $4, %esp
movl %eax, (%esp-4)
please correct me if stack access is not (%esp-4), I'm still learning assembly
The only true benefit I can see is if doing both operation simultaneously offers some advantage; however I don't see how it could.