The "Operation" section contains an algorithmic description of the instruction which uses a notation similar to the Algol or Pascal language. The algorithms are composed of the following elements:
The following identifiers are used in the algorithmic descriptions:
IF instruction = CMPSW THEN OperandSize 16;
ELSE
IF instruction = CMPSD
THEN OperandSize 32;
FI;
FI;
indicates that the operand-size attribute depends on the form of the CMPS instruction used. Refer to the explanation of address-size and operand-size attributes at the beginning of this chapter for general guidelines on how these attributes are determined.
The following functions are used in the algorithmic descriptions:
Pop ST is used on floating-point instruction pages to mean pop the FPU register stack.
If the base operand is a register, the offset can be in the range 0..31.
This offset addresses a bit within the indicated register. An example, 'BIT[EAX,
21]' is illustrated in the following figure.
Bit Offset for BIT[EAX,21]
┌──────────────────────────────────────────────────────┐ │ 31 21 0 │ │ ┌──────────────┬──┬────────────────────────────┐ │ │ └──────────────┴──┴────────────────────────────┘ │ │ │ │ │ │ │ │ └────────BITOFFSET=21─────────┘ │ │ │ └──────────────────────────────────────────────────────┘
If BitBase is a memory address, BitOffset can range from -2 gigabits to
2 gigabits. The addressed bit is numbered (Offset MOD 8) within the byte
at address (BitBase + (BitOffset DIV 8)), where DIV is signed division with
rounding towards negative infinity, and MOD returns a positive number. This
is illustrated in the following figure.
Memory Bit Indexing
┌──────────────────────────────────────────────────────┐ │ 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 │ │ ┌──┬──┬────────┬────────────────┬──────────────┐ │ │ └──┴──┴────────┴────────────────┴──────────────┘ │ │ │ BITBASE+1 │ BITBASE │ BITBASE-1 │ │ │ │ │ │ └──────OFFSET=+13───────────┘ │ │ │ │ │ │ 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 │ │ ┌──────────────┬────────────────┬──────────────┐ │ │ └──────────────┴────────────────┴──────────────┘ │ │ │ BITBASE │ BITBASE-1 │ BITBASE-2 │ │ │ │ │ │ └─────OFFSET=-11───────┘ │ │ │ └──────────────────────────────────────────────────────┘