Search code examples
carmworkload

Complexity for C code on ARM


I am trying to run my code on an ARM device. So far it's running and I also have a tool to measure complexity. Now I have lots of standard functions I am using to perform mathematical operations, like dividing, multiplying, adding and so an.

Is it easier (i.e. less complex) if I write those functions as e.g.

result = a + b;

or as

"qadd %0, %1, %4;"

which would be arm code for this operation if the values are in the respective registers. I am just wondering if writing everything in ARM code would really reduce the complexity. Also, how does that behave for conditionals (like If and Else).

Thank you.


Solution

  • Let the compiler take care of it, until you discover a bottleneck.

    Note that QADD is saturating arithmetic and has different behavior to the C code you show.