title: "PUSH" "POP" Or "MOVE"?
body: <p>When it comes to temporarily storage for an existing value in a register, all modern compilers(at least the ones I experienced) do PUSH and POP instructions. But why not store the data in another register if it's available?</p>
  
  <p><strong>So, where should the temporarily storage for an existing value goes? Stack Or Register</strong>?</p>
  
  <p>Consider the following 1st Code:</p>
  
  <pre><code>MOV ECX,16
  LOOP:
  PUSH ECX    ;Value saved to stack       
  ...     ;Assume that here's some code that must uses ECX register
  POP ECX     ;Value released from stack  
  SUB ECX,1
  JNZ LOOP
  </code></pre>
  
  <p>Now consider the 2st Code:</p>
  
  <pre><code>MOV ECX,16
  LOOP:
  MOV ESI,ECX ;Value saved to ESI register    
  ...     ;Assume that here's some code that must uses ECX register
  MOV ECX,ESI ;Value returned to ECX register
  SUB ECX,1
  JNZ LOOP
  </code></pre>
  
  <p>After all, which one of the above code is better and why?</p>
  
  <p>Personally I think the first code is better on size since PUSH and POP only takes 1 bytes while MOV takes 2; and second code is better on speed because data moving between registers is faster than memory access.</p>