How do I get the compiler to generate VFP instructions?

Question

How do I get the compiler to generate VFP instructions?

Answer

Use the compiler options -mfpu=vfp -mfloat-abi=softfp to enable VFP instructions.

If you have a VFPv3 target you may use -mfpu=vfp3 -mfloat-abi=softfp to enable VFPv3 instructions.

Code compiled with these options is ABI-compatible with soft-float code for processors without VFP, so your program will work fine if part of your code is compiled with software floating point and other parts are compiled with the options given above.

Using -mfloat-abi=hard generates code that is not ABI-compatible with other floating-point options. This is probably not the correct choice unless you must link with third-party libraries using the hard float ABI. In this case, your entire program must use the hard float ABI, and you must link with C libraries that use the hard float ABI. These libraries are available to Sourcery CodeBench Standard and Professional Edition subscribers, but are not included with CodeSourcery's Lite or Personal Edition toolchains.


This entry was last updated on 8 March 2013.