This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Embedded assembly function problem

Hello all,

I wrote end embedded assembly function for an ARM Cortex A9 (the specific device is Zynq, from Xilinx) as follow

float my_fun(float x)

{

                asm volatile ("vdup.f32 d0, r0                     \n\t");

                my_neon_fun(x);

                asm volatile ("vmov.f32 r0, s0                     \n\t");

};

my_neon_fun(x) is another already tested and working function that uses NEON assembly instructions and returns its result in S0. According to ARM convention, I copy the return value in R0 as last operation. However, when I compile the entire project, the compiler add to the generated assembly code, the following instruction as last instruction of my_fun

"mov r0, r3"

This causes that the R0 register, which should contain the return value, is overwritten with a wrong value.

Please note that it ONLY happen when I DO NOT activate the compiler optimization (-O0). Does anyone know why it happens?

Thanks in advance

Regards,

Andrea