[DSP]?编译器自动打包技术

来源:百度文库 编辑:神马文学网 时间:2024/10/02 01:21:49

编译器自动打包技术是指当编译器能判定待访问的数组是字(或双字)边界且循环次数是偶数次时,编译器将自动采用数据打包技术进行编译优化。

The _nassert intrinsic can convey information about the alignment of pointers and arrays.
void vecsum(short *a, const short *b, const short *c)

 {

_nassert(((int) a & 0x3) == 0);/* a is word aligned */

_nassert(((int) b & 0x3) == 0);/* b is word aligned */

 _nassert(((int) c & 0x7) == 0);/* c is doubleword aligned */

. . .

 }

_nassert 不会产生任何的代码,其作用是告诉编译优化器,其括号内的表达式为真,因而隐含的提示编译优化器,某种优化可能有效。

在C6000的C/C++编译器里规定,所有的全局数组都要设置成字边界的,对于这类数组的边界,不需要特别的说明。(在选用-pm、-o3的情况下,编译器就有了关于数组边界和循环执行次数的信息,它将自动采用数据打包处理技术)。