vec_sqrtADD TO COMPARE ADDED TO COMPARE
IBM Power 9 64-bit (64 bits)/ VSX
View official documentation
Location:
Math Functions
>
Vector Square Root
Purpose:
Purpose: Returns a vector containing the square root of each element in the source vector.
Result value: Each element of output is the square root of the corresponding element of a.
Endian considerations: None.
Result:
vector double
Prototypes
Assembly Instruction:
XVSQRTSP
Usage:
vector float output =
vec_sqrt(
vector float a
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector float a = {
16.0f, 9.0f, 4.0f, 1.0f
};
vector float result = vec_sqrt(a);
float res[4];
vec_st(result, 0, res);
printf("%f %f %f %f\n", res[0], res[1], res[2], res[3]);
return 0;
}
Assembly Instruction:
XVSQRTDP
Usage:
vector double output =
vec_sqrt(
vector double a
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector double a = {
16.0, 9.0
};
vector double result = vec_sqrt(a);
double res[2];
vec_st(result, 0, res);
printf("%lf %lf\n", res[0], res[1]);
return 0;
}
DB statistics
SIMD Engines: | 5 |
C Intrinsics: | 10702 |
NEON: | 4232 |
AVX2: | 462 |
AVX512: | 4955 |
SSE4.2: | 652 |
VSX: | 401 |