vec_rsqrtADD TO COMPARE ADDED TO COMPARE
Purpose: Returns a vector containing a refined approximation of the reciprocal square roots of the corresponding elements of the source vector. This function provides an implementation-dependent greater precision than vec_rsqrte.
Result value: Each element of output contains a refined approximation of the reciprocal square root of the corresponding element of a.
Endian considerations: None.
Notes:
-
The example implementations assume that a register h initially contains the floating-point value 0.5 in each element (single- or double-precision as appropriate).
-
For finite square roots, this intrinsic guarantees at least 23 bits of accuracy for single-precision floating point, and at least 52 bits of accuracy for double-precision floating point.
vector double
Prototypes
vector float output =
vec_rsqrt(
vector float a
)
#include <altivec.h>
#include <stdio.h>
int main() {
vector float a = {
4.0f, 9.0f, 16.0f, 25.0f
};
vector float r = vec_rsqrt(a);
float resultArray[4];
vec_st(r, 0, resultArray);
for (int i = 0; i < 4; i++) {
printf("%f ", resultArray[i]);
}
printf("\n");
return 0;
}
vector double output =
vec_rsqrt(
vector double a
)
#include <altivec.h>
#include <stdio.h>
int main() {
vector double a = {
4.0, 9.0
};
vector double r = vec_rsqrt(a);
double resultArray[2];
vec_st(r, 0, resultArray);
for (int i = 0; i < 2; i++) {
printf("%f ", resultArray[i]);
}
printf("\n");
return 0;
}
DB statistics
SIMD Engines: | 5 |
C Intrinsics: | 10702 |
NEON: | 4232 |
AVX2: | 462 |
AVX512: | 4955 |
SSE4.2: | 652 |
VSX: | 401 |