80386 - How to choose a processor between movzbw and movzbl

Opcodes for movzbw and movzbl: OF B6. I do not understand how they can be distinguished by observing ModR / M bytes. From the Intel 80386 Programming Reference (1986) :

MOVZX  ── Move with Zero-Extend

Opcode    Instruction      Clocks   Description
0F B6 /r  MOVZX r16,r/m8   3/6       Move byte to word with zero-extend
0F B6 /r  MOVZX r32,r/m8   3/6       Move byte to dword, zero-extend
0F B7 /r  MOVZX r32,r/m16  3/6       Move word to dword, zero-extend

How does a processor distinguish between movzbw and movzbl?

+4
source share
2 answers

It looks like it uses a prefix byte:

66 0f b6 c0             movzx  ax,al
0f b6 c0                movzx  eax,al
0f b7 c0                movzx  eax,ax

Edit: note that in 64-bit mode the above is the same, but there is another prefix:

48 0f b6 c0             movzx  rax,al
48 0f b7 c0             movzx  rax,ax

Please note that movzx rax, eaxthere is no instruction .

(I'm completely new to this, so I can’t explain exactly why, I just throw the code into the compiler and see if it is accepted).

+4
source

, 66H. 16 32 .

+3

Source: https://habr.com/ru/post/1611139/


All Articles