Hello,

I have the loop below and I want to pass to gcc that src1 and src2 never
alias with dst; so I used the restrict keyword as below; however I still
see that there are dependence edges between dst and src1 and src2 in
the DDG created by SMS and I wonder how can I resolve this.
(I used GCC -v167637 and compiled for powerpc)

Thanks,
Revital

Original version:

void foo(unsigned char  ***dst,
    unsigned char *src1,
    unsigned char  *src2, int row)
{
    int x;

    for( x = 0; x < 100; x+=1)
      {
        dst[0][row][x] = ( src1[x] * src2[x]);
      }
}

version 1 with restrict:

void foo(unsigned char  ***__restrict__ dst,
    unsigned char *__restrict__ src1,
    unsigned char  *__restrict__ src2, int row)
{
    int x;

    for( x = 0; x < 100; x+=1)
      {
        dst[0][row][x] = ( src1[x] * src2[x]);
      }
}

version 2 with restrict:

void
foo(unsigned char  *** __restrict__ dst,
    unsigned char * __restrict__ src1,
    unsigned char  * __restrict__ src2, int row)
{
    int x;
    unsigned char  **__restrict__ dst1 = dst[0];
    unsigned char  * __restrict__ dst2 = dst1[row];

    for( x = 0; x < 100; x+=1)
      {
        dst2[x] = (src1[x] * src2[x]);
      }
}


Reply via email to