Vol. 2A 3-123
INSTRUCTION SET REFERENCE, A-M
CMP—Compare Two Operands
CMP—Compare Two Operands
Opcode Instruction 64-Bit
Mode
Compat/
Leg Mode
Description
3C ib CMP AL, imm8 Valid Valid Compare imm8 with AL.
3D iw CMP AX, imm16 Valid Valid Compare imm16 with AX.
3D id CMP EAX, imm32 Valid Valid Compare imm32 with EAX.
REX.W + 3D id CMP RAX, imm32 Valid N.E. Compare imm32 sign-
extended to 64-bits with
RAX.
80 /7 ib CMP r/m8, imm8 Valid Valid Compare imm8 with r/m8.
REX + 80 /7 ib CMP r/m8
*
, imm8 Valid N.E. Compare imm8 with r/m8.
81 /7 iw CMP r/m16,
imm16
Valid Valid Compare imm16 with
r/m16.
81 /7 id CMP r/m32,
imm32
Valid Valid Compare imm32 with
r/m32.
REX.W + 81 /7 id CMP r/m64,
imm32
Valid N.E. Compare imm32 sign-
extended to 64-bits with
r/m64.
83 /7 ib CMP r/m16, imm8 Valid Valid Compare imm8 with r/m16.
83 /7 ib CMP r/m32, imm8 Valid Valid Compare imm8 with r/m32.
REX.W + 83 /7 ib CMP r/m64, imm8 Valid N.E. Compare imm8 with r/m64.
38 /r CMP r/m8, r8 Valid Valid Compare r8 with r/m8.
REX + 38 /r CMP r/m8
*
, r8
*
Valid N.E. Compare r8 with r/m8.
39 /r CMP r/m16, r16 Valid Valid Compare r16 with r/m16.
39 /r CMP r/m32, r32 Valid Valid Compare r32 with r/m32.
REX.W + 39 /r CMP r/m64,r64 Valid N.E. Compare r64 with r/m64.
3A /r CMP r8, r/m8 Valid Valid Compare r/m8 with r8.
REX + 3A /r CMP r8
*
, r/m8
*
Valid N.E. Compare r/m8 with r8.
3B /r CMP r16, r/m16 Valid Valid Compare r/m16 with r16.
3B /r CMP r32, r/m32 Valid Valid Compare r/m32 with r32.
REX.W + 3B /r CMP r64, r/m64 Valid N.E. Compare r/m64 with r64.
NOTES:
* In 64-bit mode, r/m8 can not be encoded to access the following byte registers if a REX prefix is
used: AH, BH, CH, DH.