This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

bug report: bad SPLOOP synthesis



Hello,

I would like to report a C6x 7.4.2 (and earlier) compiler bug, which seems related to the (fixed) SDSCM00044775 one.

You'll find test code and compiler options in the attached file. The function "TestFilt8A" compiles in a bad way with option -o2 only (bad SPLOOP configuration).

Jakez

// cl6x v7.4.2
// ok    with Compiler Options=-g -q -o0 --silicon_version=6740
// ok    with Compiler Options=-g -q -o1 --silicon_version=6740
// error with Compiler Options=-g -q -o2 --silicon_version=6740
// ok    with Compiler Options=-g -q -o3 --silicon_version=6740


typedef unsigned char uint8_t;

#define  LOG2_BPP_MAX 3
#define  BUFF_SIZE    0x100

#define  BPP_MAX      (1<<(LOG2_BPP_MAX))


// unsigned bpp : => bad SPLOOP code with -o2
static void TestFilt8A( uint8_t *pBuff, int n, unsigned int bpp )
 { int      i;
   uint8_t *rp = pBuff + bpp;  

   for ( i = n - bpp; (i>0); i-- )
    { *rp = (*rp + *( rp - bpp )) & 0xFF;
      rp++;
    }
 } 

// signed bpp : always ok
static void TestFilt8B( uint8_t *pBuff, int n, int bpp )
 { int      i;
   uint8_t *rp = pBuff + bpp;  

   for ( i = n - bpp; (i>0); i-- )
    { *rp = (*rp + *( rp - bpp )) & 0xFF;
      rp++;
    }
 } 



int TestFilter( int bpp )
 { static uint8_t   pBuff8A[BUFF_SIZE];
   static uint8_t   pBuff8B[BUFF_SIZE];  
   int              i;
   int              err = 0;

   for ( i=0; (i<BUFF_SIZE); i++ )
      pBuff8B[i] = pBuff8A[i] = (uint8_t)(i & 0xFF);

   TestFilt8A( pBuff8A, BUFF_SIZE, bpp );
   TestFilt8B( pBuff8B, BUFF_SIZE, bpp );

   for ( i=0; (i<BUFF_SIZE); i++ )
      if ( pBuff8A[i] != pBuff8B[i] )
         err++;

   return err;
 }


// return !=0 if error detected
int main( void )
 { int bpp;
   int err = 0;
   
   for (bpp = 1; (bpp < BPP_MAX); bpp++ ) 
      err += TestFilter( bpp );
      
   return err;      
 }