title: Any way to move 2 bytes in 32-bit x86 using MOV without causing a mode switch or cpu stall?
body: <p>If I want to move 2 unsigned bytes from memory into a 32-bit register, can I do that with a <code>MOV</code> instruction and no mode switch?</p>
  
  <p>I notice that you CAN do that with the <code>MOVSE</code> and <code>MOVZE</code> instructions. For example, with <code>MOVSE</code> the encoding <code>0F B7</code> moves 16 bits to a 32 bit register. It is a 3 cycle instruction, though.</p>
  
  <p>Alternatively I guess I could move 4 bytes into the register and then somehow CMP just two of them somehow.</p>
  
  <p>What is the fastest strategy for retrieving and comparing 16-bit data on 32-bit x86? Note that I am mostly doing 32-bit operations so I can't switch to 16-bit mode and stay there.</p>
  
  <hr>
  
  <p>FYI to the uninitiated: the issue here is that 32-bit Intel x86 processors can <code>MOV</code> 8-bit data and 16-bit OR 32-bit data depending on what mode they are in. This mode is called the "D-bit" setting. You can use special prefixes 0x66 and 0x67 to use a non-default mode. For example, if you are in 32-bit mode, and you prefix the instruction with 0x66 this will cause the operand to be treated as 16-bit. The only problem is that doing this causes a big performance hit.</p>