SPRUIG8J January 2018 – March 2024
The first set of intrinsics provided by the C7000 compiler pertains to operations for which multiple scalar and vector types apply. As such, for each operation to which they apply, these intrinsics have the same name and are overloaded based on the input type(s). Because they are overloaded, these intrinsics are the most abstract and high-level of all of the supported intrinsics.
For example, the C7000 ISA defines a set of absolute value instructions for vectors of bytes (VABSB for up to 64 elements), vectors of half-words (VABSH for up to 32 elements), vectors of words (VABSW for up to 16 elements), vectors of double-words (VABSD for up to 8 elements), vectors of single-precision floating point (VABSSP for up to 16 elements), and vectors of double-precision floating point (VABSDP for up to 8 elements). In spite of this variability, the same intrinsic name is used to access all operations, and the operation is distinguished solely based upon input operand type. This is contained in
c7x.h
as follows:
/*-----------------------------------------------------------------------------
* ID: __abs
*-----------------------------------------------------------------------------*/
VABSB
char = __abs(char);
char2 = __abs(char2);
char3 = __abs(char3);
char4 = __abs(char4);
char8 = __abs(char8);
char16 = __abs(char16);
char32 = __abs(char32);
char64 = __abs(char64);
VABSH
short = __abs(short);
short2 = __abs(short2);
short3 = __abs(short3);
short4 = __abs(short4);
short8 = __abs(short8);
short16 = __abs(short16);
short32 = __abs(short32);
VABSW
int = __abs(int);
int2 = __abs(int2);
int3 = __abs(int3);
int4 = __abs(int4);
int8 = __abs(int8);
int16 = __abs(int16);
VABSD
long = __abs(long);
long2 = __abs(long2);
long3 = __abs(long3);
long4 = __abs(long4);
long8 = __abs(long8);
VABSSP
float = __abs(float);
float2 = __abs(float2);
float3 = __abs(float3);
float4 = __abs(float4);
float8 = __abs(float8);
float16 = __abs(float16);
VABSDP
double = __abs(double);
double2 = __abs(double2);
double3 = __abs(double3);
double4 = __abs(double4);
double8 = __abs(double8);
As long as the intrinsic name is used (
__abs(…)
in this case), the compiler generates the correct corresponding instruction for the input type used. See
c7x.h
for a complete list.