User Guide

General-Purpose Programming 55
24592—Rev. 3.15—November 2009 AMD64 Technology
because these instructions operate directly on bits rather than larger data types, the semaphore arrays
can be smaller than is possible when using XCHG. In such semaphore applications, bit-test
instructions should be preceded by the LOCK prefix.
Set Byte on Condition
SETcc—Set Byte if condition
The SETcc instructions store a 1 or 0 value to their byte operand depending on whether their condition
(represented by certain rFLAGS bits) is true or false, respectively. Table 3-5 shows the rFLAGS values
required for each SETcc instruction.
Table 3-5. rFLAGS for SETcc Instructions
Mnemonic Required Flag State Description
SETO O F = 1 Set byte if overflow
SETNO OF = 0 Set byte if not overflow
SETB
SETC
SETNAE
CF=1
Set byte if below
Set byte if carry
Set byte if not above or equal (unsigned operands)
SETAE
SETNB
SETNC
CF=0
Set byte if above or equal
Set byte if not below
Set byte if not carry (unsigned operands)
SETE
SETZ
ZF=1
Set byte if equal
Set byte if zero
SETNE
SETNZ
ZF=0
Set byte if not equal
Set byte if not zero
SETBE
SETNA
CF=1orZF=1
Set byte if below or equal
Set byte if not above (unsigned operands)
SETA
SETNBE
CF = 0 and ZF = 0
Set byte if not below or equal
Set byte if not below or equal (unsigned operands)
SETS SF = 1 Set byte if sign
SETNS SF = 0 Set byte if not sign
SETP
SETPE
PF=1
Set byte if parity
Set byte if parity even
SETNP
SETPO
PF=0
Set byte if not parity
Set byte if parity odd
SETL
SETNGE
SF <> OF
Set byte if less
Set byte if not greater or equal (signed operands)
SETGE
SETNL
SF=OF
Set byte if greater or equal
Set byte if not less (signed operands)
SETLE
SETNG
ZF=1orSF<>OF
Set byte if less or equal
Set byte if not greater (signed operands)
SETG
SETNLE
ZF = 0 and SF = OF
Set byte if greater
Set byte if not less or equal (signed operands)