Refining C/C++ Code
3-22
Table 3–6. TMS320C6000 C/C++ Compiler Intrinsics (Continued)
C Compiler Intrinsic
Device
Description
Assembly
Instruction
unsigned _shlmb (uint
src1, uint src2);
unsigned _shrmb (uint
src1, uint src2);
SHLMB
SHRMB
Shifts src2 left/right by one byte, and the
most/least significant byte of src1 is
merged into the least/most significant byte
position.
’C64x
int _shr2 (int
src2, uint src1);
unsigned _shru2 (uint
src2, uint src1);
SHR2
SHRU2
For each 16-bit quantity in src2, the quanti-
ty is arithmetically or logically shifted right
by src1 number of bits. src2 can contain
signed or unsigned values.
’C64x
int _smpy(int
src1, int src2);
int _smpyh(int
src1, int src2);
int _smpyhl(int
src1, int src2);
int _smpylh(int
src1, int src2);
SMPY
SMPYH
SMPYHL
SMPYLH
Multiplies src1 by src2, left shifts the result
by one, and returns the result. If the result
is 0x8000 0000, saturates the result to
0x7FFF FFFF.
double _smpy2 (int
src1, int src2);
SMPY2
Performs 16-bit multiplication between
pairs of signed packed 16-bit values, with
an additional 1 bit left–shift and saturate
into a double result.
’C64x
int _spack2 (int
src1, int src2);
SPACK2
Two signed 32–bit values are saturated to
16–bit values and packed into the return
value.
’C64x
unsigned _spacku4 (int
src1, int src2);
SPACKU4
Four signed 16–bit values are saturated to
8–bit values and packed into the return
value.
’C64x
int _spint(float);
SPINT
Converts 32-bit float to 32-bit signed inte-
ger, using the rounding mode set by the
CSR register.
’C67x
int _sshvl (int
src2, int src1);
int _sshvr (int
src2, int src1);
SSHVL
SSHVR
Shifts src2 to the left/right of src1 bits. Sat-
urates the result if the shifted value is
greater than MAX_INT or less than
MIN_INT
’C64x
int
_sshl (int
src2, uint src1);
SSHL
Shifts src2 left by the contents of src1, sat-
urates the result to 32 bits, and returns the
result.
int _ssub(int
src1, int src2);
long lss b(int
src1 long src2):
SSUB
Subtracts src2 from src1, saturates the re-
sult size and returns the result
long _lssub(int
src1, long src2):
sult size, and returns the result.
uint _subc(uint
src1, uint src2);
SUBC
Conditional subtract divide step.
Note:
Instructions not specified with a device apply to all ’C6000 devices.