title: Why the conditional move doesn't work properly
body: <p>After I compiling the codes below, the function doesn't seem to work as expected.</p>
  
  <pre><code>int cread(int *xp){
  
       return (xp?*xp:0);
  
  }
  </code></pre>
  
  <p>I extract the counterpart in the assembly version as below.</p>
  
  <p><code>xp</code> in register <code>%edx</code></p>
  
  <pre><code>movl $0, %eax
  testl  %edx, %edx
  cmovne (%edx), %eax
  </code></pre>
  
  <p>Could anyone tell me why the pointer <code>xp</code> still got de-referenced by the <code>cmovne</code> even when the test fails? isn't the <code>ZF</code> set to <code>1</code> by <code>testl</code> instruction when <code>%edx</code> is <code>0</code>?</p>