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.

Problems declaring data alignment with nassert under C67x and C67x+ DSP

By using Code Composer Studio v.5 I have noted some problems in the recognition of the nassert intrinsic for declaring data alignment.

In order to highlight the problem, I have selected to following (simple) code, given as example on the “Optimizing Compiler v7.6 User's Guide” (pag. 235):

 

int dot_product(short *x, short *y, short z)

{

int sum = 0, i;

 

_nassert (((int)(x) & 0x3) == 0);

_nassert (((int)(y) & 0x3) == 0);

 

#pragma MUST_ITERATE(32, , 2);

#pragma UNROLL(2);

for (i = 0; i < z; i++) sum += x[i] * y[i];

 

return sum;

}

 

According to the manual, this loop should be implemented with an iteration interval (ii) equal to 1 (with 2x Unrolling) thanks to _nassert intrinsics which allows the employ of LDW instructions to load the data of the two arrays. By using the latest version of the TI Compiler (v.7.4.11) the behavior is on the other hand the following:

- On C64x DSP and its extensions (C64x+, C674x, C66x) the code is optimally implemented with ii=1 and 2x unrolling

- On C67x and C67x+ DSP the above example is implemented with ii=2. Reason: 4 LDH instructions are used to load arrays data. In this case the compiler seems ignoring the _nassert declarations.

 

I have tested the above code also in Code Composer Studio v.3.3. In this case the old compiler version 6.0 (e.g. v.6.0.8) optimally compile the code, also on DSP C67x, by using ii=1 and LDW instructions. The newest compiler version 6.1 (e.g. v.6.1.23), on the other hand, similarly to v.7.4.11 uses LDH instructions and ii=2 on C67x DSP. In this last case, again, the problem is not present by compiling the code for C64x DSP.

 

In conclusion it seems that under C67x DSP the old compiler v.6.0 works much better than all new compiler versions from v.6.1 to v.7.4.11.

 

Is there something that I have not considered to justify the behavior of the novel compiler versions ?

Or do I have discovered a compiler bug iterated from v.6.1 up to v.7.4 ?

  • Davide De Caro said:
    Or do I have discovered a compiler bug iterated from v.6.1 up to v.7.4 ?

    I think you have.  I can reproduce your results.  I filed SDSCM00051288 in the SDOWP system to have this investigated.  Feel free to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George