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

vec_splats
ADD TO COMPARE ADDED TO COMPARE

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

Returns a vector with the value of each element set to the value of the scalar input parameter.

Result:

Each element of output is set to the value of a.

Prototypes

Assembly Instruction:
MULTILINE
Usage:
vector signed short result = vec_splats( signed short a )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed short r = vec_splats((signed short)-15);
 for (int i = 0; i < 8; i++) {
   printf("%d ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector signed int result = vec_splats( int a )
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed int r = vec_splats((signed int)-15);
 for (int i = 0; i < 4; i++) {
   printf("%d ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector unsigned int result = vec_splats( unsigned int a )
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned int r = vec_splats((unsigned int)16);
 for (int i = 0; i < 4; i++) {
   printf("%u ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector unsigned short result = vec_splats( unsigned short a )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned short r = vec_splats((unsigned short)16);
 for (int i = 0; i < 8; i++) {
   printf("%u ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector float result = vec_splats( float a )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector float r = vec_splats((float)-15.5);
 for (int i = 0; i < 4; i++) {
   printf("%f ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector unsigned long long result = vec_splats( unsigned long long a )
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned long long r = vec_splats((unsigned long long)16);
 for (int i = 0; i < 2; i++) {
   printf("%llu ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector signed long long result = vec_splats( signed long long a )
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed long long r = vec_splats((signed long long)-15);
 for (int i = 0; i < 2; i++) {
   printf("%lld ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
xxpermdi
Usage:
vector double result = vec_splats( double a )
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector double r = vec_splats((double)16.25);
 for (int i = 0; i < 2; i++) {
   printf("%lf ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector unsigned char result = vec_splats( unsigned char a )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned char r = vec_splats((unsigned char)16);
 for (int i = 0; i < 16; i++) {
   printf("%u ", r[i]);
  }

  return 0;
 }
Assembly Instruction:
MULTILINE
Usage:
vector signed char result = vec_splats( signed char a )
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed char r = vec_splats((signed char)-15);
 for (int i = 0; i < 16; i++) {
   printf("%d ", r[i]);
  }

  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