Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z
4-292 Vol. 2B
INSTRUCTION SET REFERENCE, N-Z
Description
Sets the destination operand to 0 or 1 depending on the settings of the status flags
(CF, SF, OF, ZF, and PF) in the EFLAGS register. The destination operand points to a
byte register or a byte in memory. The condition code suffix (cc) indicates the condi-
tion being tested for.
The terms “above” and “below” are associated with the CF flag and refer to the rela-
tionship between two unsigned integer values. The terms “greater” and “less” are
associated with the SF and OF flags and refer to the relationship between two signed
integer values.
Many of the SETcc instruction opcodes have alternate mnemonics. For example,
SETG (set byte if greater) and SETNLE (set if not less or equal) have the same
opcode and test for the same condition: ZF equals 0 and SF equals OF. These alter-
nate mnemonics are provided to make code more intelligible. Appendix B, “EFLAGS
Condition Codes,” in the Intel
®
64 and IA-32 Architectures Software Developer’s
Manual, Volume 1, shows the alternate mnemonics for various test conditions.
Some languages represent a logical one as an integer with all bits set. This represen-
tation can be obtained by choosing the logically opposite condition for the SETcc
instruction, then decrementing the result. For example, to test for overflow, use the
SETNO instruction, then decrement the result.
In IA-64 mode, the operand size is fixed at 8 bits. Use of REX prefix enable uniform
addressing to additional byte registers. Otherwise, this instruction’s operation is the
same as in legacy mode and compatibility mode.
Operation
IF condition
THEN DEST ← 1;
ELSE DEST ← 0;
FI;
REX + 0F 9A SETPE r/m8* Valid N.E. Set byte if parity even (PF=1).
0F 9B SETPO r/m8 Valid Valid Set byte if parity odd (PF=0).
REX + 0F 9B SETPO r/m8* Valid N.E. Set byte if parity odd (PF=0).
0F 98 SETS r/m8 Valid Valid Set byte if sign (SF=1).
REX + 0F 98 SETS r/m8* Valid N.E. Set byte if sign (SF=1).
0F 94 SETZ r/m8 Valid Valid Set byte if zero (ZF=1).
REX + 0F 94 SETZ r/m8* Valid N.E. Set byte if zero (ZF=1).
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.
Opcode Instruction
64-Bit
Mode
Compat/
Leg Mode Description