Bitwise Operations
Bitwise instructions operate on individual bits of register values.
AND
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
AND | Reg | Reg/Imm | OP1 &= OP2 |
OR
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
OR | Reg | Reg/Imm | OP1 |= OP2 |
XOR
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
XOR | Reg | Reg/Imm | OP1 ^= OP2 |
NOT
| Instruction | Operand 1 | Operation |
|---|
NOT | Reg | OP1 = ~OP1 |
SHL
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
SHL | Reg | Reg/Imm | OP1 <<= OP2 |
SHR
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
SHR | Reg | Reg/Imm | OP1 >>= OP2 |
ROL
Rotate left - bits shifted out from the left wrap around to the right.
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
ROL | Reg | Reg/Imm | OP1 = (OP1 << OP2) | (OP1 >> (N-OP2)) |
ROR
Rotate right - bits shifted out from the right wrap around to the left.
| Instruction | Operand 1 | Operand 2 | Operation |
|---|
ROR | Reg | Reg/Imm | OP1 = (OP1 >> OP2) | (OP1 << (N-OP2)) |
POPCNT
Counts the number of set bits (1s) in a register and stores the result back.
| Instruction | Operand 1 | Operation |
|---|
POPCNT | Reg | OP1 = popcnt(OP1) |
BSF
Bit scan forward - returns the index of the lowest set bit plus one, or zero if the operand is zero.
| Instruction | Operand 1 | Operation |
|---|
BSF | Reg | OP1 = OP1 ? BitScanForward(OP1) + 1 : 0 |
BSR
Bit scan reverse - returns the index of the highest set bit plus one, or zero if the operand is zero.
| Instruction | Operand 1 | Operation |
|---|
BSR | Reg | OP1 = OP1 ? BitScanReverse(OP1) + 1 : 0 |