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.

Compiler/TMS320F28069F: Best way to do memcpy in CLA C code

Part Number: TMS320F28069F


Tool/software: TI C/C++ Compiler

Is there a recommended way to memcpy in C in the CLA? Setting a struct equal generates a slow loop:

struct S { float a,b,c } s1, s2;
s1 = s2;

generates a loop with many MNOPs and for some reason chooses 16 bit movs.

          C$L5:
000093da:   75A20001    MMOVZ16    MR2, *MAR1++
000093dc:   7CE00010    MSUB32     MR0, MR0, MR1
000093de:   7FA00000    MNOP       
000093e0:   7FA00000    MNOP       
000093e2:   75E10001    MMOV16     *MAR0++, MR2
000093e4:   7980FFF6    MBCNDD     0xfff6, NEQ
000093e6:   7FA00000    MNOP       
000093e8:   7FA00000    MNOP       
000093ea:   7FA00000    MNOP    

An unrolled array:

float a[3], b[3];

#pragma MUST_ITERATE(3)
#pragma UNROLL(3)
for (i = 0; i < 3; i++) {
  a[i] = b[i];
}

works pretty well but seems kind of non standard. Is there a recommended library or anything that does an efficient memcpy?

  • Thank you for notifying us about this issue.  I filed CODEGEN-1983 in the SDOWP system to have this addressed.  This is filed as a request for a performance enhancement, and not as a bug.  That is because the code generated by the compiler is correct, but could be faster.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George