sandpile.org -- x86 architecture -- bits (original) (raw)

bit manipulation

CPUID

official
mnemonic

operation

description

example

better mnemonic
from description

better mnemonic
from operation

TBM

BLCS

X | (X+1)

turn on rightmost 0-bit

10101011 => 10101111

BM SET RM0

ADD1OR

BMI

BLSR

X & (X-1)

turn off rightmost 1-bit -- test if X is 2^n

10101000 => 10100000

BM CLR RM1

SUB1AND

TBM

BLCFILL

X & (X+1)

right-propagate rightmost 0-bit -- test if X is 2^n-1

10100111 => 10100000

BM RPR RM0

ADD1AND

TBM

BLSFILL

X | (X-1)

right-propagate rightmost 1-bit

10101000 => 10101111

BM RPR RM1

SUB1OR

TBM

BLCMSK

X ^ (X+1)

form mask of rightmost 0 and trailing 1s

10101011 => 00000111

BM FM RM0 T1S

ADD1XOR

BMI

BLSMSK

X ^ (X-1)

form mask of rightmost 1 and trailing 0s

10101000 => 00001111

BM FM RM1 T0S

SUB1XOR

BMI

BLSI

X & -X

form mask of rightmost 1-bit

10100100 => 00000100

BM FM RM1

NEGAND

TBM

BLCIC

~X & (X+1)

form mask of rightmost 0-bit

10101011 => 00000100

BM FM RM0

ADD1ANDN

TBM

TZMSK

~X & (X-1)

form mask of trailing 0s

10101000 => 00000111

BM FM T0S

SUB1ANDN

TBM

BLCI

X | ~(X+1)

form complemented mask of rightmost 0-bit

10101011 => 11111011

BM FCM RM0

ADD1NOTOR

TBM

BLSIC

~X | (X-1)

form complemented mask of rightmost 1-bit

10101100 => 11111011

BM FCM RM1

SUB1ORN

TBM

T1MSKC

~X | (X+1)

form complemented mask of trailing 1s

10101011 => 11111100

BM FCM T1S

ADD1ORN