AnsweredAssumed Answered

Optimization Error - VisualDSP++ 5 update 10

Question asked by sepepep on Dec 30, 2013
Latest reply on Jan 7, 2014 by CraigG

hello ,

I am using adsp21161 with VisualDSP++ 5.0 update 10.

 

I have a strange problem.

please take a look at the following code :

************************************************************************************************************************

 

#pragma optimize_for_speed

#pragma diag(push)

#pragma diag(suppress: 1434) //remark: warning: loop would vectorize if alignment were known - consider

  // inserting vector_for pragma if all memory accesses are aligned on even-word boundaries

Float UTL_srvBUF_Get_Sum(const UTL_BUF_tsFloat_Sum_Buffer* psSum_Buff)

{

Uns uIndex;

Float fSum
= 0.0f;

for (uIndex = 0u ;uIndex < psSum_Buff->uBuffer_Size ; uIndex++)

{

fSum
+= psSum_Buff->pBuffer[uIndex];

}

return(fSum);

}

#pragma diag(pop)

#pragma optimize_off

*****************************************************************************************************

1. Not using any OS (using self scheduler)

2. This function is called from a regular function and from an interrupt. the input data is different buffers.

3. when:

a: Optimization is ON and interrupts are ON - the function sometimes gives the wrong answer (Not always).

b. Optimization is OFF and interrupts are ON - the functions always gives an OK answer.

c. Optimization is ON and interrupts are OFF - the functions always gives an OK answer.

 

does someone knows why ?

Outcomes