vec_sra
Purpose
Performs an algebraic right shift for each element of a vector.
Syntax
d=vec_sra(a, b)
Result and argument types
The following tables describe the types of the returned value and the function arguments.
| d | a | b |
|---|---|---|
| vector signed char | vector signed char | vector unsigned char |
| vector unsigned char | vector unsigned char | |
| vector signed short | vector signed short | vector unsigned short |
| vector unsigned short | vector unsigned short | |
| vector signed int | vector signed int | vector unsigned int |
| vector unsigned int | vector unsigned int |
Note: The following types are valid when -mcpu is set to target POWER7
processors, or higher. However, compiling with POWER8
processors or higher yields more efficient code generation by utilizing the available POWER8 instructions.
| d | a | b |
|---|---|---|
| vector signed long long | vector signed long long | vector unsigned long long |
| vector unsigned long long | vector unsigned long long |
Result value
Each element of the result vector is the result of algebraically right shifting the corresponding
element of a by the number of bits specified by the value of the corresponding
element of b, modulo the number of bits in the element. The bits that are shifted
out are replaced by copies of the most significant bit of the element of a.