MMIX LOGO

MMIX Instruction Set

Table of Content

Content

Bytewise Operations

Name:

BDIF $X,$Y,$ZBDIF $X,$Y,Z
WDIF $X,$Y,$ZWDIF $X,$Y,Z
TDIF $X,$Y,$ZTDIF $X,$Y,Z
ODIF $X,$Y,$ZODIF $X,$Y,Z

Specification:

x ← y-˙z = max (0,y - z)
Here x,y,z are corresponding elements of the vectors $X, $Y, and $Z.

Timing:

Description:

Saturated Difference. An Octa byte is regarded as a vector of eight byte, four Wyde, or two Tetra respectively.

BDIF | WDIF | TDIF | ODIFFor each (byte | wyde | tetra | octa) position j, the jth (byte | wyde | tetra | octa) register $X is set to (byte | wyde | tetra | octa) j of register $Y minus (byte | wyde | tetra | octa) j of the other operand $Z or Z, unless that difference is negative; in the latter case, (byte | wyde | tetra | octa) j of $X is set to zero.

The BDIF and WDIF commands are useful in applications to graphics or video; TDIF and ODIF are also present for reasons of consistency. For example, if a and b are registers containing 8-byte quantities, their bytewise maxima c and bytewise minima d are computed by

BDIF x,a,b; ADDU c,x,b; SUBU d,a,x;

similarly, the individual "pixel differences" e, namely the absolute values of the differences of corresponding bytes, are computed by

BDIF x,a,b; BDIF y,b,a; OR e,x,y;

To add individual bytes of a and b while clipping all sums to 255 if they don't fit in a single byte, one can say

NOR acomp,a,0; BDIF x,acomp,b; NOR clippedsums,x,0;

in other words, complement a, apply BDIF, and complement the result. The operations can also be used to construct efficient operations on strings of bytes or wydes.

Please help to keep this site up to date! If you want to point out important material or projects that are not listed here, if you find errors or want to suggest improvements, please send email to email