I have code (borrowed from another platform )that attempts to optimize by using assembly code. The function is an addition of arrays and is a C function such as uint32_t AddNumbers ( uint32_t *p_addResult , uint32_t *p_left , uint32_t *p_right , const uint ARRAY_SIZE)
Can I get pointed to a syntax where the passed variables can be assigned to registers and assembly variables.
uint32_t AddNumbers ( uint32_t *p_addResult , uint32_t *p_left , uint32_t *p_right , const uint ARRAY_SIZE) { uint32_t l_counter = ARRAY_SIZE; uint32_t l_carry = 0; uint32_t l_left; uint32_t l_right; __asm( .. "ldmia %[lptr]!, {%[left]} \n\t" "ldmia %[rptr]!, {%[right]} \n\t" "lsrs %[carry], #1 \n\t" "adcs %[left], %[right] \n\t" ... : [dptr] "+l" (p_addResult), [lptr] "+l" (p_left), [rptr] "+l" (p_right), [ctr] "+l" (l_counter), [carry] "+l" (l_carry), [left] "=l" (l_left), [right] "=l" (l_right) }
I am getting syntax errors for the part above that assigns the C variables to registers and assembly variables.
Thanks
Take a closer look at the ! used by some of the instructions.