GNU Compiler Collection (GCC) Internals: Vectors

Previous: Unary and Binary Expressions, Up: Expression trees [Contents][Index]

#### 10.6.4 Vectors

`VEC_LSHIFT_EXPR`
`VEC_RSHIFT_EXPR`

  These nodes represent whole vector left and right shifts, respectively. The first operand is the vector to shift; it will always be of vector type. The second operand is an expression for the number of bits by which to shift. Note that the result is undefined if the second operand is larger than or equal to the first operand’s type size.

`VEC_WIDEN_MULT_HI_EXPR`
`VEC_WIDEN_MULT_LO_EXPR`

  These nodes represent widening vector multiplication of the high and low parts of the two input vectors, respectively. Their operands are vectors that contain the same number of elements (`N`) of the same integral type. The result is a vector that contains half as many elements, of an integral type whose size is twice as wide. In the case of `VEC_WIDEN_MULT_HI_EXPR` the high `N/2` elements of the two vector are multiplied to produce the vector of `N/2` products. In the case of `VEC_WIDEN_MULT_LO_EXPR` the low `N/2` elements of the two vector are multiplied to produce the vector of `N/2` products.

`VEC_UNPACK_HI_EXPR`
`VEC_UNPACK_LO_EXPR`

  These nodes represent unpacking of the high and low parts of the input vector, respectively. The single operand is a vector that contains `N` elements of the same integral or floating point type. The result is a vector that contains half as many elements, of an integral or floating point type whose size is twice as wide. In the case of `VEC_UNPACK_HI_EXPR` the high `N/2` elements of the vector are extracted and widened (promoted). In the case of `VEC_UNPACK_LO_EXPR` the low `N/2` elements of the vector are extracted and widened (promoted).

`VEC_UNPACK_FLOAT_HI_EXPR`
`VEC_UNPACK_FLOAT_LO_EXPR`

  These nodes represent unpacking of the high and low parts of the input vector, where the values are converted from fixed point to floating point. The single operand is a vector that contains `N` elements of the same integral type. The result is a vector that contains half as many elements of a floating point type whose size is twice as wide. In the case of `VEC_UNPACK_HI_EXPR` the high `N/2` elements of the vector are extracted, converted and widened. In the case of `VEC_UNPACK_LO_EXPR` the low `N/2` elements of the vector are extracted, converted and widened.

`VEC_PACK_TRUNC_EXPR`

  This node represents packing of truncated elements of the two input vectors into the output vector. Input operands are vectors that contain the same number of elements of the same integral or floating point type. The result is a vector that contains twice as many elements of an integral or floating point type whose size is half as wide. The elements of the two vectors are demoted and merged (concatenated) to form the output vector.

`VEC_PACK_SAT_EXPR`

  This node represents packing of elements of the two input vectors into the output vector using saturation. Input operands are vectors that contain the same number of elements of the same integral type. The result is a vector that contains twice as many elements of an integral type whose size is half as wide. The elements of the two vectors are demoted and merged (concatenated) to form the output vector.

`VEC_PACK_FIX_TRUNC_EXPR`

  This node represents packing of elements of the two input vectors into the output vector, where the values are converted from floating point to fixed point. Input operands are vectors that contain the same number of elements of a floating point type. The result is a vector that contains twice as many elements of an integral type whose size is half as wide. The elements of the two vectors are merged (concatenated) to form the output vector.

`VEC_COND_EXPR`

  These nodes represent `?:` expressions. The three operands must be vectors of the same size and number of elements. The second and third operands must have the same type as the entire expression. The first operand is of signed integral vector type. If an element of the first operand evaluates to a zero value, the corresponding element of the result is taken from the third operand. If it evaluates to a minus one value, it is taken from the second operand. It should never evaluate to any other value currently, but optimizations should not rely on that property. In contrast with a `COND_EXPR`, all operands are always evaluated.

`SAD_EXPR`

  This node represents the Sum of Absolute Differences operation. The three operands must be vectors of integral types. The first and second operand must have the same type. The size of the vector element of the third operand must be at lease twice of the size of the vector element of the first and second one. The SAD is calculated between the first and second operands, added to the third operand, and returned.

Previous: Unary and Binary Expressions, Up: Expression trees [Contents][Index]