Achieving Optimal Performance from C/C++ Source Code
piler, or to allow access to system support functions. A complete list of
compiler's built-in functions is given in
page
1-94.
Use of these builtins is much preferred to using inline
Since the compiler knows what each builtin does, it can easily optimize
around them. Conversely, since the compiler does not parse asm state-
ments, it does not know what they do, and so is hindered in optimizing
code that uses them. Note also that errors in the text string of an
ment will be caught by the assembler and not the compiler.
Examples of efficient use of built-in functions are given in
port Built-In Functions" on page
Memory Usage
The compiler, in conjunction with the use of the linker description file
(
), allows the programmer control over where data is placed in mem-
.LDF
ory. This section describes how to best lay out data for maximum
performance.
Tip: Try to put arrays into different memory sections.
The DSP hardware can support two memory operations on a single
instruction line, combined with a compute instruction. However, two
memory operations will only complete in one cycle if the two addresses are
situated in different memory blocks; if both access the same block, then a
stall will be incurred.
Take as an example the dot product loop below. Because data is loaded
from both array
ful to ensure that these arrays are located in different blocks.
for (i=0; i<100; i++)
sum += a[i] * b[i];
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
2-26.
and array
in every iteration of the loop, it may be use-
a
b
"Compiler Built-In Functions" on
asm
statements.
state-
asm
"System Sup-
2-15
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers