
7-22
SC100 C Compiler
Runtime Libraries
long L_msu(long L_var3,short var1,
short var2)
Multiply subtract. Multiplies
var1
by
var2
and shifts the
result left by 1. Subtracts the 32-bit result from
L_var3
with
saturation, and returns a 32-bit result. For example:
L_msu(L_var3,var1,var2) =
L_sub(L_var3,L_mult(var1,var2))
.
long L_mult(short var1,short var2)
Long multiply. The 32-bit result of the multiplication of
var1
by
var2
with one shift left, for example:
L_mult(var1,var2)= L_shl((var1*var2),1)
and L_mult(-32768,-32768) = 2147483647
.
long L_negate(long L_var1)
Long negate. Negates the 32-bit variable
L_var1
with
saturation. Saturates in cases where the value is
-2147483648(0x8000 0000)
.
long L_rol(long L_var1)
Long rotate left. Rotates the 32-bit variable
L_var1
left into
a 40-bit value, and returns a 32-bit result..
long L_ror(long L_var1)
Long rotate right. Rotates the 32-bit variable
L_var1
right
into a 40-bit value, and returns a 32-bit result.
long L_sat(long L_var1)
Saturates a 32-bit value.
long L_shl(long L_var1,short var2)
Long shift left. Arithmetically shifts the 32-bit
L_var1
left
var2
positions. Zero fills the
var2
LSB of the result. If
var2
is negative, arithmetically shifts
L_var1
right by
var2
with sign extension. Saturates the result in cases
where underflow or overflow occurs.
long L_shr(long L_var1,short var2)
Long shift right. Arithmetically shifts the 32-bit
L_var1
right
var2
positions with sign extension. If
var2
is negative,
arithmetically shifts
L_var1
left by
var2
and zero fills the
var2
LSB of the result. Saturates the result in cases where
underflow or overflow occurs.
long L_shr_r(long L_var1,short var2)
Long shift right and round. Same as
L_shr(L_var1,var2)
but with rounding. Saturates the
result in cases where underflow or overflow occurs.
long L_sub(long L_var1,long L_var2)
Long subtract. 32-bit subtraction of the two 32-bit variables
(L_var1-L_var2)
with overflow control and saturation.
The result is set at
+2147483647
when overflow occurs or
at
-2147483648
when underflow occurs.
short mac_r(long L_var3,short var1,
short var2)
Multiply accumulate and round. Multiplies
var1
by
var2
and shifts the result left by 1. Adds the 32-bit result to
L_var3
with saturation. Rounds the LS 16 bits of the result
into the MS 16 bits with saturation and shifts the result right
by 16. Returns a 16-bit result.
void mark()
Generates assembly instruction to write program counter to
trace buffer, if trace buffer enabled.
short max(short var1, short var2)
Compares the values of two 16-bit variables and returns
the higher value of the two.
short min(short var1, short var2)
Compares the values of two 16-bit variables and returns
the lower value of the two.
long mpyuu(long L_var1,long L_var2)
Multiplies the 16 LSB of two 32-bit variables, treating both
variables as unsigned values, and returns a 32-bit result.
Table 7-35. Built-in Intrinsic Functions (Continued)
Function
Purpose