VEC_CMPLT
Mike Acton
April 26, 2006
April 26, 2006
Description
vec_cmplt( arg1, arg2 )
An unsigned int vector of the same compenent width of arg1 and arg2 will be returned. e.g. For if arg1 and arg2 are vector unsigned short, a vector unsigned short will be returned. If arg1 and arg2 are vector float, a vector unsigned int will be returnedFor each component of the return value:
The value -1 (NEGATIVE ONE) i.e. all bits on, will be stored if the corresponding component of arg1 is less than the corresponding component of arg2. Otherwise the value 0 (ZERO) i.e. all bits off, will be stored.
Header Files
On the PPU:
#include <altivec.h>
On the SPU:
#include <vmx2spu.h>
PPU Instruction Mapping
The intrinsic is mapped to the following instructions depending on the type of arg1 and arg2:
vector unsigned char | vcmpgtub.
vector signed char | vcmpgtsb.
vector unsigned short | vcmpgtuh
vector signed short | vcmpgtsh
vector unsigned int | vcmpgtuw
vector signed int | vcmpgtsw
vector float | vcmpgtfp
Example Instruction Sequence:
unsigned short vec_cmp_gt( unsigned short a, unsigned short b );
vcmpgtuh 2,3,2
SPU Instruction Mapping
The intrinsic is mapped to the following instructions depending on the type of arg1 and arg2:
vector unsigned char | clgtb
vector signed char | cgtb
vector unsigned short | clgth
vector signed short | cgth
vector unsigned int | clgt
vector signed int | clg
vector float | fclg
Example Instruction Sequence:
unsigned short vec_cmp_gt( unsigned short a, unsigned short b );
clgth $5,$4,$3
gbh $2,$5
ceqi $3,$2,0
sfi $3,$3,0