Texas Instruments TMS320C64X Security Camera User Manual


 
DSP_neg32
4-68
32-Bit Vector Negate
DSP_neg32
Function void DSP_neg32(int *x, int *r, short nx)
Arguments x[nx] Pointer to input data vector 1 of size nx with 32-bit elements.
Must be double-word aligned.
r[nx] Pointer to output data vector of size nx with 32-bit elements.
Must be double-word aligned.
nx Number of elements of input and output vectors. Must be a
multiple of 4 and 8.
Description This function negates the elements of a vector (32-bit elements). The input and
output arrays must not be overlapped except for where the input and output
pointers are exactly equal.
Algorithm This is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.
void DSP_neg32(int *x, int *r, short nx)
{
short i;
for(i=nx; i>0; i−−)
*(r++)=−*(x++);
}
Special Requirements
- nx must be a multiple of 4 and greater than or equal to 8.
- The arrays x[ ] and r[ ] must be double-word aligned.
Implementation Notes
- Bank Conflicts: No bank conflicts occur.
- Interruptibility: The code is interrupt-tolerant but not interruptible.
- The loop is unrolled twice and pipelined.
Benchmarks Cycles nx/2 + 19
Codesize 124 bytes