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 double result =
vec_rsqrt(
vector double a
)
📊 Unlock Performance Insights
Get access to detailed performance metrics including latency, throughput, and CPU-specific benchmarks for this intrinsic.
#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;
}
vector float result =
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;
}
SIMD Intrinsics Summary
| SIMD Engines: | 6 |
| C Intrinsics: | 10444 |
| NEON: | 4353 |
| AVX2: | 405 |
| AVX512: | 4717 |
| SSE4.2: | 598 |
| VSX: | 192 |
| IBM-Z: | 179 |