c/c++语言开发共享如何告诉GCC循环自动矢量化没有指针别名? (限制不起作用)

我在让GCC对这个循环进行矢量化时遇到了问题:

register int_fast8_t __attribute__ ((aligned)) * restrict fillRow = __builtin_assume_aligned(rowMaps + query[i]*rowLen,8); register int __attribute__ ((aligned (16))) *restrict curRow = __builtin_assume_aligned(scoreMatrix + i*rowLen,16), __attribute__ ((aligned (16))) *restrict prevRow = __builtin_assume_aligned(curRow - rowLen,16); register unsigned __attribute__ ((aligned (16))) *restrict shiftCur = __builtin_assume_aligned(shiftMatrix + i*rowLen,16), __attribute__ ((aligned (16))) *restrict shiftPrev = __builtin_assume_aligned(shiftCur - rowLen,16); unsigned j; unsigned *restrict diagShift = shiftPrev - 1; int *restrict diagScore = prevRow - 1; for (j=1; j < rs; ++j) { curRow[j] = diagScore[j] + fillRow[j]; shiftCur[j] = diagShift[j]; } 

这些变量来自两个矩阵(scoreMatrix和shiftMatrix,它们被声明为对齐并保证每个“行”开始对齐),以及一个8位数组(fillRow)。 GCC一直告诉我:

 prog.c:600:4: note: === vect_analyze_data_ref_dependences === prog.c:600:4: note: versioning for alias required: can't determine dependence between *_90 and *_89 prog.c:600:4: note: mark for run-time aliasing test between *_90 and *_89 prog.c:600:4: note: versioning for alias required: can't determine dependence between *_98 and *_97 prog.c:600:4: note: mark for run-time aliasing test between *_98 and *_97 

其中第600行是有问题的循环。 我不知道如何更明确地说明没有混叠。 以前我省略了diagShift和diagScore行,并且只有循环索引,例如prevRow [j-1]而不是“diagShift [j]” – 完全相同的结果。 我能做什么?

      以上就是c/c++开发分享如何告诉GCC循环自动矢量化没有指针别名? (限制不起作用)相关内容,想了解更多C/C++开发(异常处理)及C/C++游戏开发关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/c-cdevelopment/518953.html

      (0)
      上一篇 2020年12月5日
      下一篇 2020年12月5日

      精彩推荐