
3-18
C Cross Compiler
3.5.1 Vector N-Intrinsics
The ZDCC compiler also provides N-Intrinsics for common vector
operations. They are shown in
Table 3.9
. The vector N-Instrinsics will
produce more efficient code than the equivalent non-vector code.
Important:
If you use vector N-Intrinsics at optimization level 3 (
-O3
),
you must also use the
-fno-inline
option. Functions with
vector N-Intrinsics must not be inlined, since these intrin-
sics create labels. If these labels are inlined, they are dupli-
cated and cause an error.
3.5.2 ETSI Functions
The SDCC’s N-Intrinsics also allow access to processor-supported ETSI
functionality, although the interface is different. For example, the ETSI
code:
y = norm_l(x);
can be rewritten with N-Intrinsics as:
N_norm_l(y,x);
Table 3.9
Vector N-Intrinsics
N-Intrinsic
1
Functionality
2
N_vc_mac(accum acc, int *vec1, int inc1,
int cnst, int len)
for
(i=0; i<len; i++) {
N_mac(acc,cnst,vec1[i*inc1]);
}
N_vc_macn(accum acc, int *vec1, int inc1,
int cnst, int len)
for (i=0; i<len; i++) {
N_macn(acc,cnst,vec1[i*inc1]);
}
N_vv_mac(accum acc, int *vec1, int inc1,
int *vec2, int inc2, int len)
for (i=0; i<len; i++) {
N_mac(acc,vec1[i*inc1],vec2[i*inc2])
}
N_vv_macn(accum acc, int *vec1, int inc1,
int *vec2, int inc2, int len)
for (i=0; i<len; i++) {
N_macn(acc,vec1[i*inc1],vec2[i*inc2]);
}
1. All increment values (
inc1
,
inc2
) must be
2,
1, 1, or 2.
2. The actual code generated will be more efficient than the functionally-equivalent code in this column.