vec_msum
Purpose
Returns a vector containing the results of performing a multiply-sum operation using given vectors.
This built-in function is valid only when you include the altivec.h file.
Syntax
d=vec_msum(a, b, c)
Result and argument types
The following tables describe the types of the returned value and the function arguments.
| d | a | b | c |
|---|---|---|---|
| vector signed int | vector signed char | vector unsigned char | vector signed int |
| vector unsigned int | vector unsigned char | vector unsigned char | vector unsigned int |
| vector signed int | vector signed short | vector signed short | vector signed int |
| vector unsigned int | vector unsigned short | vector unsigned short | vector unsigned int |
Result value
For each element n of the result vector, the value is obtained as follows:
- If a is of type vector signed char or vector unsigned char,
multiply element p of a by element p of b where p is
from 4n to 4n+3, and then add the
sum of these products and element n of c.
d[0] = a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + c[0] d[1] = a[4]*b[4] + a[5]*b[5] + a[6]*b[6] + a[7]*b[7] + c[1] d[2] = a[8]*b[8] + a[9]*b[9] + a[10]*b[10] + a[11]*b[11] + c[2] d[3] = a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15] + c[3] - If a is of type vector signed short or vector unsigned short,
multiply element p of a by element p of b where p is
from 2n to 2n+1, and then add the
sum of these products and element n of c.
d[0] = a[0]*b[0] + a[1]*b[1] + c[0] d[1] = a[2]*b[2] + a[3]*b[3] + c[1] d[2] = a[4]*b[4] + a[5]*b[5] + c[2] d[3] = a[6]*b[6] + a[7]*b[7] + c[3]
All additions are performed by using 32-bit modular arithmetic.


