Please enter what you're looking for to continue your search
 

vec_rsqrt
ADD TO COMPARE ADDED TO COMPARE

 IBM Power 9 64-bit (64 bits)/ VSX  View official documentation
Purpose:

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.

Result:

vector double

Prototypes

Assembly Instruction:
xvrsqrtesp t,a xvmulsp u,t,a xvmulsp v,t,h xvnmsubmsp v,u,h xvmaddmsp r/v,t,t
Usage:
vector float output = vec_rsqrt( vector float a )
Example:
#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;
 }
Assembly Instruction:
xvrsqrtedp t,a xvmuldp u,t,a xvmuldp v,t,h xxlor w,h,h xvnmsubadp w,u,v xvmaddadp v,v,w xvmaddadp u,u,w xvnmsubmdp u,v,h xvmaddadp v,v,u xvadddp r,v,v
Usage:
vector double output = vec_rsqrt( vector double a )
Example:
#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