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.

how to use 2 restrict at time

Hi

we (galileo sat) are using the 6748 for GSP localition I have this prog:

double * restrict Src1Ptr;

double * restrict Src2Ptr; 

int * Des1Ptr;

int aJ;

Src1Ptr = (double *)(MyMem_1);

Src2Ptr = (double *)(MyMem_2);

Des1Ptr = (int *)(MyMem_3);

/* Loop1 */

for(aJ = 0; aJ <N ;++aJ) {

  *Des1Ptr++ = (_lo(*Src1Ptr) ^ _lo(*Src2Ptr));

  *Des1Ptr++ = (_hi(*Src1Ptr) ^ _lo(*Src2Ptr));

  ++Src1Ptr;

  *Des1Ptr++ = (_lo(*Src1Ptr) ^ _hi(*Src2Ptr));

  *Des1Ptr++ = (_hi(*Src1Ptr) ^ _hi(*Src2Ptr));

   ++Src1Ptr;

   ++Src2Ptr;

 }

 /* Loop2 */

  Src1Ptr = (double *)(MyMem_3);

 Src2Ptr = (double *)(MyMem_2);

Des1Ptr = (int *)(MyMem_3);

for(aJ = 0; aJ < N ;++aJ) {

  *Des1Ptr++ = _sub2(_lo(*Src1Ptr),_lo(*Src2Ptr));

  *Des1Ptr++ = _sub2(_hi(*Src1Ptr),_lo(*Src2Ptr));

  ++Src1Ptr;

  *Des1Ptr++ =_sub2(_lo(*Src1Ptr),_hi(*Src2Ptr));

  *Des1Ptr++ =_sub2(_hi(*Src1Ptr),_hi(*Src2Ptr));

   ++Src1Ptr;

   ++Src2Ptr;

 }

Please It is possible to joint the 2 loop in one ?

and how?

thanks

  • This is a C programming question for the C Compiler Forum and not a device question for this C67x Single Core DSP Forum. A moderator will move this thread there for your convenience, this time. You will get better answers more quickly in that forum from the compiler experts.

    Do you understand what the use of the restrict keyword guarantees to the compiler?

    Why did you choose not to use restrict for the declaration of Des1Ptr?

    If Des1Ptr and Src1Ptr are both assigned to the beginning of MyMem_3, can they both point to overlapping ranges of memory? If so, then the use of the restrict keyword gives incorrect information to the compiler and as the C Compiler User Guide says, the program will be undefined.

    Regards,
    RandyP

  • Thanks  RandyP

    >>then the use of the restrict keyword gives incorrect information to the compiler and as the C Compiler User Guide says, the program will be undefined.

    That is exactly my question !!!!

    I want to know if this possible to use the output of the first loop (LOOP1) for the input of the second loop (LOOP2) ?

    may be can I use the some kind on pipline (spool)? (how??)

    Thanks again

    PF Melamed

  • Hi,

    Moved your post to TI C/C++ Compiler Forum.

     

    Regards,

    Shankari.

     

  • See http://processors.wiki.ti.com/index.php/Restrict_Type_Qualifier, and follow the link 'Performance Tuning with the "Restrict" Keyword.'  Pay particular attention to section 4, "Using restrict effectively with TI’s compiler tools," which describes some similar scenarios.