35.3.6.8. INTEGER COMPARES AND CONDITIONAL JUMPS ON X86




	(Compare ) =================
CMP	AL,imm8			3C 	ib
CMP	AX,imm16		3D 	iw
CMP	EAX,imm32		3D	id
CMP	r/m8,imm8		80/7	ib
CMP	r/m16,imm16		81/7	iw
CMP	r/m32,imm32		81/7	id
CMP	r/m16,imm8		83/7	iw
CMP	r/m32,imm8		83/7	iw
CMP	r/m8,r8			38/r
CMP	r/m16,r16		39/r
CMP	r/m32,r32		39/r
CMP	r8,r/m8			3A/r
CMP	r16,r/m16		3B/r
CMP	r32,r/m32		3B/r

	Set_Flags(DEST - SRC)


	(Logical Compare ) =================
TEST	AL,imm8			A8 ib
TEST	AX,iim16		A9 iw
TEST	EAX,imm32		A9 id
TEST	r/m8,imm8		F6 /0 ib
TEST	r/m16,imm16		F7 /0 iw
TEST	r/m32,imm32		F7 /0 id
TEST	r/m8,r8			84 /r
TEST	r/m16,r16		85 /r
TEST	r/m32,r32		85 /r

	
	(Condition Jump) ====================
JA	rel8			77 cb
JAE	rel8			73 cb
JB	rel8			72 cb
JBE	rel8			76 cb
JC	rel8			72 cb
JE	rel8			74 cb
JG	rel8			7F cb
JGE	rel8			7D cb
JL	rel8			7C cb
JLE	rel8			7E cb
JNA	rel8			76 cb
JNAE	rel8			72 cb 
JNB	rel8			73 cb
JNBE	rel8			77 cb
JNC	rel8			73 cb
JNE	rel8			75 cb
JNG	rel8			7E cb
JNGE	rel8			7C cb
JNL	rel8			7D cb	
JNLE	rel8			7F cb
JNO	rel8			71 cb
JNP	rel8			7B cb
JNS	rel8			79 cb 
JNZ	rel8			75 cb
JO	rel8			70 cb
JP	rel8			7A cb
JPE	rel8			7A cb	
JPO	rel8			7B cb
JS	rel8			78 cb
JZ	rel8			74 cb	
JA	rel16/32		0F 87 cw/cd
JAE	rel16/32		0F 83 cw/cd
JB	rel16/32		0F 82 cw/cd
JBE	rel16/32		0F 86 cw/cd
JC	rel16/32		0F 82 cw/cd
JE	rel16/32		0F 84 cw/cd
JG	rel16/32		0F 8F cw/cd
JGE	rel16/32		0F 8D cw/cd
JL	rel16/32		0F 8C cw/cd
JLE	rel16/32		0F 8E cw/cd
JNA	rel16/32		0F 86 cw/cd
JNAE	rel16/32		0F 82 cw/cd
JNB	rel16/32		0F 83 cw/cd
JNBE	rel16/32		0F 87 cw/cd
JNC	rel16/32		0F 83 cw/cd
JNE	rel16/32		0F 85 cw/cd
JNG	rel16/32		0F 8E cw/cd
JNGE	rel16/32		0F 8C cw/cd
JNL	rel16/32		0F 8D cw/cd	
JNLE	rel16/32		0F 8F cw/cd
JNO	rel16/32		0F 81 cw/cd
JNP	rel16/32		0F 8B cw/cd
JNS	rel16/32		0F 89 cw/cd
JNZ	rel16/32		0F 85 cw/cd
JO	rel16/32		0F 80 cw/cd
JP	rel16/32		0F 8A cw/cd
JPE	rel16/32		0F 8A cw/cd	
JPO	rel16/32		0F 8B cw/cd
JS	rel16/32		0F 88 cw/cd
JZ	rel16/32		0F 84 cw/cd	


	if (condition)	EIP <- EIP + sign_extend(rel)

					
cc		condition		description		S	US	
A/NBE		(CF = 0) AND (ZF = 0)	Above				>
AE/JNB/JNC	(CF = 0)		Equal				>=
B/NAE/JC	(CF = 1)		Below				<
BE/NA		(CF = 1) OR  (ZF = 1)   Below Equal			<=
E/Z		(ZF = 1)		Equal			==	==
G/NLE		(SF = OF) AND (ZF = 0)  Greater			>
GE/NL		(SF = OF)		Greater Equal		>=
L/NGE		(SF <> OF)		Less			<
LE/NG		(SF <> OF) OR (ZF = 1)	Less Equal		<=
NE/NZ		(ZF = 0)		Not Equal		!=	!=
NO		(OF = 0)		No Overflow		XX		   
NP/PO		(PF = 0)		Parity Odd
NS		(SF = 0)		No Sign (Positive)	XX
O		(OF = 1)		Overlow			XX
P/PE		(PF = 1)		Parity Even
S		(SF = 1)		Sign (Negative)		XX
	


	(Jump if CX zero) ====================
JCXZ	rel8			E3	cb
JECXZ	rel8			E3	cb

	if (E)CX == 0)	  EIP <- EIP + sign_extend(rel)


	(Loop Control with CX counter) =======
LOOP		rel8		E2	cb
LOOPE/LOOPZ	rel8		E1	cb	
LOOPNE/LOOPNZ	rel8		E0	cb

	TO DO: Insert Description Later




Index Prev Next