cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between arm_mult_f32 function and a normal multiplication

Pedro Oliveira
Associate II

Hi everyone,

I expected to get a faster multiplication processing using the arm_mult_f32 function than a normal multiplication like val1*val2. However, when I tested it using the SysTick->VAL I get a bigger processing time for the arm_mult_f32 function.

Any idea what is going on?

Below is a code snippet to exemplify the test.

float32_t result = 0;
float32_t val1 = 1.5;
float32_t val2 = 1.5;
uint32_t start_t, stop_t, cont_t;
 
start_t = SysTick->VAL;
arm_mult_f32(&val1, &val2, &result, 1);  
stop_t = SysTick->VAL;
cont_t = start_t - stop_t; // Gets cont_t = 85
 
start_t = SysTick->VAL;
result = val1 * val2; //
stop_t = SysTick->VAL;
cont_t = start_t - stop_t; // Gets cont_t = 23

1 REPLY 1
TDK
Guru

Calling a function introduces overhead. Overhead becomes less significant when you convert many values at once, but you're only doing a single one.

The function arm_mult_f32 still multiplies things together. It's not doing a faster version of multiplication than what you get with `val1 * val2`.

If you feel a post has answered your question, please click "Accept as Solution".