Analog Devices VISUALDSP++ 3.5 Manual page 244

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

Advertisement

Using Built-In Functions in Code Optimization
Bad: may not be able to use circular buffer to access
In this case, the compiler does not know if
it is, then the access may be correctly implemented as a hardware circular
buffer. On the other hand, if it is greater than 20, a circular buffer incre-
ment may not yield the same results as the C code.
The programmer has two options here. One is to compile with the
-force-circbuf
access of the form
using this switch, you should check that this assumption is valid for your
application.
The preferred option, however, is to use builtins to perform the circular
buffering. Two are provided for this purpose. To make it clear to the com-
piler that a circular buffer should be used, you may write either
for (i=0, j=0; i<1000; i+=n) {
sum += a[i] * b[j];
j = __builtin_circindex(j, n, 20);
}
Good: explicit use of circular buffer via
or
int *p = b;
for (i=0, j=0; i<1000; i+=n) {
sum += a[i] * (*p);
p = __builtin_circptr(p, n, b, 20);
}
Good: explicit use of circular buffer via
For more information, see "Compiler Built-In Functions" on page 1-94.
2-28
switch
(on page
1-27). This tells the compiler that any
should be considered as a circular buffer. Before
a[i%n]
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
.
b
is positive and less than 20. If
n
__builtin_circindex
__builtin_circptr
for ADSP-219x DSPs
.
.

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?

Subscribe to Our Youtube Channel

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents