Microsoft DirectX 8.0 (C++)

mad

Loads the first source register added to the product of the two colors in the last two source operand registers.

mad   tDest, tSrc0, tSrc1, tSrc2

Registers

tDest
Destination register, holding the result of the operation.
tSrc0
Source register, specifying the input argument.
tSrc1
Source register, specifying the input argument.
tSrc2
Source register, specifying the input argument.

Remarks

This instruction performs a multiply-accumulate operation. It takes the last two arguments, multiplies them together, and adds them to the remaining input/source argument, and places that into the result register.

This instruction performs the multiply-add based on the following formula.

tSrc0 + tSrc1 * tSrc2

The following example shows how this instruction might be used.

mad  d, s0, s1, s2    ; d = s0 + s1*s2