如何告诉GCC循环自动矢量化没有指针别名? (限制不起作用)

时间:2015-07-22 23:25:32

标签: c gcc auto-vectorization

我在让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]” - 完全相同的结果。我该怎么办?

0 个答案:

没有答案