The SADD Instruction

Name:

SADD $X,$Y,$Z

Specification:
s($X) ← s(∑ (v($Y)&˜ v($Z)))

Timing:

SADD: υ

Description:

This instruction (Sideways Add) counts the number of bit positions in which $y has a 1 and $Z has a 0. The result is stored in $X.

SADD: Each bit of register $Y is logically anded with the complement of the corresponding bit of register $Z or of the constant Z, and the number of 1 bits in the result is placed in register $X. In other words, register $X is set to the number of bit positions in which register $Y has a 1 and the other operand has a 0; in symbols, $X = υ($Y \ $Z) or $X = υ($Y \ Z). When the second operand is zero this operation is sometimes called “population counting,” because it counts the number of 1s in register Y.