|Home > Compiling C and C++ Code > Preventing the use of floating-point instructions and registers|
You can instruct the compiler to prevent the use of floating-point instructions and floating-point registers.
Floating-point computations can be performed by:
fplib. This library provides functions that can be called to implement floating-point operations using no additional hardware.
Code that uses hardware floating-point instructions is more compact and offers better performance than code that performs floating-point arithmetic in software. However, hardware floating-point instructions require a VFP coprocessor.
Floating-point linkage controls which registers are used to pass floating-point parameters and return values:
When compiling for AArch64 state:
-mcpu= option to prevent the use of
both floating-point instructions and floating-point registers:
armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a53+nofp+nosimd test.c
Subsequent use of floating-point data types in this mode is unsupported.
When compiling for AArch32 state:
--target=arm-arm-none-eabi, the compiler uses hardware floating-point instructions and software floating-point linkage. This corresponds to the option
option to use software library functions for floating-point operations and
software floating-point linkage:
armclang --target=arm-arm-none-eabi -march=armv8-a -mfloat-abi=soft test.c
-mfloat-abi=hard option to use
hardware floating-point instructions and hardware floating-point
armclang --target=arm-arm-none-eabi -march=armv8-a -mfloat-abi=hard test.c