📄 lesson3_c.c
字号:
/****************************************************************************//* *//* lesson3_c - Alignment info added for xptr & yptr *//* *//* Results for Release 4.00: *//* *//* When compiled with -k -mw -mh -o3: *//* 1 cycle per iteration - 4 MPYs 2 LDWs and 2 STHs each iteration *//* *//* Program info needed but not available: *//* None *//* *//* Program info available: *//* Potential pointer aliasing info (restrict type qualifier) *//* Loop count info - minimum trip count *//* Loop count info - max trip count factor *//* Alignment info - xptr and yptr aligned on a word boundary *//* *//* When compiled with -k -mw -mh -o3 -pm -op2 with tutor_d *//* 1 cycle per iteration - All info available *//* *//****************************************************************************/#define WORD_ALIGNED(x) (_nassert(((int)(x) & 0x3) == 0))void lesson3_c(short * restrict xptr, short * restrict yptr, short *zptr, short *w_sum, int N){ int i, w_vec1, w_vec2; short w1, w2; WORD_ALIGNED(xptr); WORD_ALIGNED(yptr); w1 = zptr[0]; w2 = zptr[1]; #pragma MUST_ITERATE(20, , 2); for (i = 0; i < N; i++) { w_vec1 = xptr[i] * w1; w_vec2 = yptr[i] * w2; w_sum[i] = (w_vec1 + w_vec2) >> 15; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -