This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[DS-5] How to use the compiler intrinsic __softfp?

Note: This was originally posted on 8th September 2013 at http://forums.arm.com

It's good to know that it's possible to override the global compiler option --fpu=vfpv4 for specific functions with the compiler intrinsic __softfp.

http://infocenter.arm.com/help/topic/com.arm.doc.dui0491i/BABGAEBD.html

But for some reason, I cannot get it to work.


__softfp void myFunction(float a, float B)
{
..
..
..
}


When I declare a function like above it's time for a syntax error. I must be doing something wrong.

Could someone tell me how to use the __softfp intrinsic properly?

Thanks in advance
Parents
  • Note: This was originally posted on 10th September 2013 at http://forums.arm.com


    __softfp float add(float a, float  B)
    {
      return a + b;
    }

    Compiled with "armcc --cpu=cortex-m4 --fpu=vfpv4 -S" should produce:

    add PROC
            VMOV  s1,r0
            VMOV  s0,r1
            VADD.F32 s0,s1,s0
            VMOV  r0,s0
            BX    lr
            ENDP

    hth
    s.


    [Edited to remove emoticon induced error in code snippet]


    sim, you are saving my day again. :)

    It must be an eclipse bug showing a big question mark ("syntax error") at the line with __softfp that distracted me so much that I overlooked the parameters being passed to ARM registers.

    Thank you!
Reply
  • Note: This was originally posted on 10th September 2013 at http://forums.arm.com


    __softfp float add(float a, float  B)
    {
      return a + b;
    }

    Compiled with "armcc --cpu=cortex-m4 --fpu=vfpv4 -S" should produce:

    add PROC
            VMOV  s1,r0
            VMOV  s0,r1
            VADD.F32 s0,s1,s0
            VMOV  r0,s0
            BX    lr
            ENDP

    hth
    s.


    [Edited to remove emoticon induced error in code snippet]


    sim, you are saving my day again. :)

    It must be an eclipse bug showing a big question mark ("syntax error") at the line with __softfp that distracted me so much that I overlooked the parameters being passed to ARM registers.

    Thank you!
Children
No data