vec_sum4s

Purpose

Returns a vector containing the results of performing a sum across 1/4 vector operation on two given vectors.

This built-in function is valid only when you include the altivec.h file.

Syntax

d=vec_sum4s(a, b)

Result and argument types

The following table describes the types of the returned value and the function arguments.

Table 1. Types of the returned value and function arguments
d a b
vector signed int vector signed char vector signed int
vector unsigned int vector unsigned char vector unsigned int
vector signed int vector signed short vector signed 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, the value is the saturated addition of elements 4n through 4n+3 of a and element n of b.
    d[0] = a[0]  + a[1]  + a[2]  + a[3]  + b[0]
    d[1] = a[4]  + a[5]  + a[6]  + a[7]  + b[1]
    d[2] = a[8]  + a[9]  + a[10] + a[11] + b[2]
    d[3] = a[12] + a[13] + a[14] + a[15] + b[3]
  • If a is of type vector signed short, the value is the saturated addition of elements 2n through 2n+1 of a and element n of b.
    d[0] = a[0] + a[1] + b[0]
    d[1] = a[2] + a[3] + b[1]
    d[2] = a[4] + a[5] + b[2]
    d[3] = a[6] + a[7] + b[3]


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us