Compiler Getting Started GuidePreface Getting Started Getting Started with the SVE features in Arm Compi Using Common Compiler Options Mandatory armclang options Common Arm Compiler toolchain options Selecting source language options Selecting optimization options Building to aid debugging Linking object files to produce an executable Linker options for mapping code and data to target Passing options from the compiler to the linker Controlling diagnostic messages Selecting floating-point options Compilation tools command-line option rules Writing Optimized Code Assembling Assembly Code Using Assembly and Intrinsics in C or C++ Code SVE Coding Considerations with Arm Compiler Mapping Code and Data to the Target Overlays Embedded Software Development Building Secure and Non-secure Images Using Armv8‑ Overview of the Linker Getting Image Details SysV Dynamic Linking Overview of the fromelf Image Converter Using fromelf Overview of the Arm Librarian Overview of the armasm Legacy Assembler Supporting reference information Arm Compiler User Guide Changes
Selecting floating-point options
3.10 Selecting floating-point options
Arm® Compiler supports floating-point arithmetic and floating-point data types in your source code or application.
Arm Compiler supports floating-point arithmetic by using one of the following:
You can use various options that determine how Arm Compiler generates code for floating-point arithmetic. Depending on your target, you might need to specify one or more of these options to generate floating-point code that correctly uses floating-point hardware or software libraries.
Table 3-13 Options for floating-point selection
To improve performance, the compiler can use floating-point registers
instead of the stack. You can disable this feature with the [COMMUNITY]
Avoid specifying both the
Note:The -mfpu option is ignored with AArch64 targets, for example aarch64-arm-none-eabi. Use the -mcpu option to override the default FPU for aarch64-arm-none-eabi targets. For example, to prevent the use of floating-point instructions or floating-point registers for the aarch64-arm-none-eabi target use the -mcpu=name+nofp+nosimd option. Subsequent use of floating-point data types in this mode is unsupported.
Benefits of using floating-point hardware versus software floating-point libraries
Code that uses floating-point hardware is more compact and faster than code that uses software libraries for floating-point arithmetic. But code that uses the floating-point hardware can only be run on processors that have the floating-point hardware. Code that uses software floating-point libraries can run on Arm-based processors that do not have floating-point hardware, for example the Cortex®‑M0 processor. Therefore, using software floating-point libraries makes the code more portable. You might also disable floating-point hardware to reduce power consumption.
Enabling and disabling the use of floating-point hardware
By default, Arm Compiler uses the available floating-point hardware that is based on
the target you specify for
When compiling for AArch64:
When compiling for AArch32:
Floating-point linkage refers to how the floating-point arguments are passed to and returned from function calls.
For AArch64, Arm Compiler always uses hardware linkage. When using hardware linkage, Arm Compiler passes and returns floating-point values in hardware floating-point registers.
For AArch32, Arm Compiler can use hardware linkage or software linkage. When using
software linkage, Arm Compiler passes and returns floating-point values in general-purpose registers. By
default, Arm Compiler uses
software linkage. You can use the
Table 3-14 Floating-point linkage for AArch32
Code with hardware linkage can be faster than the same code with software linkage. However, code with software linkage can be more portable because it does not require the hardware floating-point registers. Hardware floating-point is not available on some architectures such as Armv6‑M, or on processors where the floating-point hardware might be powered down for energy efficiency reasons.
Note:In AArch32 state, if you specify
See the Arm Compiler Reference Guide for more information on the -mfloat-abi option.
Note:All objects to be linked together must have the same type of linkage. If you link object files that have hardware linkage with object files that have software linkage, then the image might have unpredictable behavior. When linking objects, specify the
See the Arm Compiler Reference Guide for more information on how the --fpu option specifies the linkage type and floating-point hardware.
of your data.