Understanding Cortex M4F instructions timing

By: Michael S (already5chosen.delete@this.yahoo.com), June 2, 2020 9:48 am
Room: Moderated Discussions
Dan Fay (daniel.fay.delete@this.gmail.com) on June 2, 2020 9:19 am wrote:
> So this is what the ARM compiler is doing with an M4F (specific target is STM32F412ZG):
>
> "C++" code:
>
> float fptest(float val1, float val2, float val3) {
> float test = val3;
> test *= val1 + val2;
> return test;
> }
>
>
> Mbed Studio "Release" setting with ARMC6:
>
> 080073e0 :
> 80073e0: ee30 0a20 vadd.f32 s0, s0, s1
> 80073e4: ee20 0a01 vmul.f32 s0, s0, s2
> 80073e8: 4770 bx lr
>
>
> Mbed Studio "Develop" setting with ARMC6:
>
> 08007a18 :
> 8007a18: ee30 0a20 vadd.f32 s0, s0, s1
> 8007a1c: ee20 0a01 vmul.f32 s0, s0, s2
> 8007a20: 4770 bx lr
>
> Mbed Studio "Debug" setting with ARMC6:
>
> 0800749c :
> 800749c: ee30 0a20 vadd.f32 s0, s0, s1
> 80074a0: ee20 0a01 vmul.f32 s0, s0, s2
> 80074a4: 4770 bx lr
>
>
> As a point of comparison, here's what ARMC6 generates for the Cortex-M7
> (Mbed Studio "Release" setting, targeting STM32H743):
>
> 0800acc8 :
> 800acc8: ee30 0a20 vadd.f32 s0, s0, s1
> 800accc: ee20 0a01 vmul.f32 s0, s0, s2
> 800acd0: 4770 bx lr

You got order of FADD and FMUL wrong.
Try:
float my_fma(float x, float y, float acc)
{
return x*y+acc;
}
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Understanding Cortex M4F instructions timingMichael S2020/06/01 11:07 AM
  Understanding Cortex M4F instructions timinganon³2020/06/01 10:26 PM
  Understanding Cortex M4F instructions timingMichael S2020/06/02 08:23 AM
  Understanding Cortex M4F instructions timingDan Fay2020/06/02 08:37 AM
    Understanding Cortex M4F instructions timingDan Fay2020/06/02 09:19 AM
      Understanding Cortex M4F instructions timingMichael S2020/06/02 09:48 AM
        Understanding Cortex M4F instructions timingMichael S2020/06/02 11:56 AM
          Understanding Cortex M4F instructions timingMichael S2020/06/02 12:07 PM
            Understanding Cortex M4F instructions timingDan Fay2020/06/02 01:22 PM
          Understanding Cortex M4F instructions timingDan Fay2020/06/02 01:08 PM
            Understanding Cortex M4F instructions timingMichael S2020/06/02 01:20 PM
          Understanding Cortex M4F instructions timingWilco2020/06/02 03:02 PM
            Understanding Cortex M4F instructions timingMichael S2020/06/02 03:17 PM
            Understanding Cortex M4F - VLDMMichael S2020/06/04 02:28 PM
            The goal of Cortex-M4 FPUMichael S2020/06/04 02:30 PM
              The goal of Cortex-M4 FPUDan Fay2020/06/05 08:31 AM
      ARMC6 - Arm or clang ?Michael S2020/06/05 05:49 AM
        ARMC6 - Arm or clang ?Dan Fay2020/06/05 08:26 AM
          ARMC6 - Arm or clang ?Michael S2020/06/05 08:55 AM
            M4F - few convolution benchesMichael S2020/06/11 09:35 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell purple?