Electronic – How many cycles does an ARM Cortex M0 use to multiply floats

armembeddedfloating pointmicrocontroller

On an ARM cortex m0+:

How many cycles does it take to perform multiplication of single precision floats and store them into a float? i.e. x = a*b; Where x, a, and b are single precision IEEE 754 float point… and what if they were both double precision?

Bonus Question:
How many cycles does it take to shift an integer by 16 bits and store it into another integer. i.e. x = (y>>16); Where x and y are 32-bit signed integers.

EDIT:

Compiler I will be using is the ARM gcc compiler

The reason I ask this question, is I plan on using q31, but I wanted to see what the difference really would be

Best Answer

1 and 2: there's no hardware floating point unit on the M0, so it depends on your compiler alone. Expect on the order of tens to possibly low hundreds of cycles for single precision, with full IEEE compatibility. As for double precision, you're probably looking at high hundreds, maybe even breaking the thousand-cycle barrier, again assuming full IEEE compatibility.

3: single cycle.