Using Built-In Functions In Code Optimization; Fractional Data - Analog Devices VISUALDSP++ 3.5 Manual

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

Achieving Optimal Performance from C/C++ Source Code
Using Built-In Functions in Code
Optimization
Built-in functions, also known as compiler intrinsics, provide a method
for the programmer to efficiently use low-level features of the DSP hard-
ware while programming in C. Although this section does not cover all the
built-in functions available (for more information, refer to
Built-In Functions" on page
implementation choices are available to the programmer.

Fractional Data

Fractional data, represented as an integral type, can be manipulated in two
ways: one way is the use of long promoted shifts and multiply constructs,
and the other is the use of compiler built-in functions. The built-in func-
tions are recommended as they give you the most control over your data.
Let's consider the fractional dot product algorithm. This may be written
as:
long dot_product (short *a, short *b) {
int i;
long sum=0;
for (i=0; i<100; i++) {
/* this line is performance critical */
sum += (((long)a[i]*b[i]) << 1);
}
return sum;
}
Bad: uses shifts to implement fractional multiplication.
This presents some problems to the optimizer. Normally, the code gener-
ated here would be a multiply, followed by a shift, followed by an
accumulation. However, the DSP hardware has a fractional multiply/accu-
mulate instruction that performs all these tasks in one cycle.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
1-94), it presents some code examples where
"Compiler
2-25

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents