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

vec_cmpgt
ADD TO COMPARE ADDED TO COMPARE

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

Purpose: Returns a vector containing the results of a greater-than comparison between each set of corresponding elements of two vectors.

Result value: For each element of output, the value of each bit is 1 if the corresponding element of a is greater than the corresponding element of b. Otherwise, the value of each bit is 0.

Endian considerations: None.

Result:

vector bool int

Prototypes

Assembly Instruction:
vcmpgtsb
Usage:
vector bool char output = vec_cmpgt( vector signed char a, vector signed char b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed char a = {
  1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
 };
 vector signed char b = {
  8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1
 };
 vector bool char result = vec_cmpgt(a, b);
 for (int i = 0; i < 16; i++) {
   printf("%d ", ((char*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtub
Usage:
vector bool char output = vec_cmpgt( vector unsigned char a, vector unsigned char b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned char a = {
  1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
 };
 vector unsigned char b = {
  8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1
 };
 vector bool char result = vec_cmpgt(a, b);
 for (int i = 0; i < 16; i++) {
   printf("%d ", ((char*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtsh
Usage:
vector bool short output = vec_cmpgt( vector signed short a, vector signed short b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed short a = {
  1, 2, 3, 4, 5, 6, 7, 8
 };
 vector signed short b = {
  8, 7, 6, 5, 4, 3, 2, 1
 };
 vector bool short result = vec_cmpgt(a, b);
 for (int i = 0; i < 8; i++) {
   printf("%d ", ((short*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtuh
Usage:
vector bool short output = vec_cmpgt( vector unsigned short a, vector unsigned short b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned short a = {
  1, 2, 3, 4, 5, 6, 7, 8
 };
 vector unsigned short b = {
  8, 7, 6, 5, 4, 3, 2, 1
 };
 vector bool short result = vec_cmpgt(a, b);
 for (int i = 0; i < 8; i++) {
   printf("%d ", ((short*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtsw
Usage:
vector bool int output = vec_cmpgt( vector signed int a, vector signed int b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed int a = {
  1, -2, 3, -4
 };
 vector signed int b = {
  8, 7, 6, 5
 };
 vector bool int result = vec_cmpgt(a, b);
 for (int i = 0; i < 4; i++) {
   printf("%d ", ((int*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtuw
Usage:
vector bool int output = vec_cmpgt( vector unsigned int a, vector unsigned int b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned int a = {
  5, 6, 7, 8
 };
 vector unsigned int b = {
  4, 3, 2, 1
 };
 vector bool int result = vec_cmpgt(a, b);
 for (int i = 0; i < 4; i++) {
   printf("%d ", ((int*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtsd
Usage:
vector bool long long output = vec_cmpgt( vector signed long long a, vector signed long long b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector signed long long a = {
  10, 20
 };
 vector signed long long b = {
  80, 70
 };
 vector bool long long result = vec_cmpgt(a, b);
 for (int i = 0; i < 2; i++) {
   printf("%lld ", ((long long*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
vcmpgtud
Usage:
vector bool long long output = vec_cmpgt( vector unsigned long long a, vector unsigned long long b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector unsigned long long a = {
  10, 20
 };
 vector unsigned long long b = {
  20, 10
 };
 vector bool long long result = vec_cmpgt(a, b);
 for (int i = 0; i < 2; i++) {
   printf("%lld ", ((long long*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
xvcmpgtsp
Usage:
vector bool int output = vec_cmpgt( vector float a, vector float b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector float a = {
  10.5, 20.3, 15.6, 8.2
 };
 vector float b = {
  5.4, 20.3, 18.0, 10.0
 };
 vector bool int result = vec_cmpgt(a, b);
 for (int i = 0; i < 4; i++) {
   printf("%d ", ((int*)&result)[i]);
  }

  return 0;
 }
Assembly Instruction:
XVCMPGTDP
Usage:
vector bool long long output = vec_cmpgt( vector double a, vector double b )
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
 vector double a = {
  10.5, 20.3
 };
 vector double b = {
  5.4, 20.3
 };
 vector bool long long result = vec_cmpgt(a, b);
 for (int i = 0; i < 2; i++) {
   printf("%lld ", ((long long*)&result)[i]);
  }

  return 0;
 }
DB statistics
SIMD Engines: 5
C Intrinsics: 10702
NEON: 4232
AVX2: 462
AVX512: 4955
SSE4.2: 652
VSX: 401