^

AR# 31409 13.1 EDK - Why does my software application still use software libraries for double precision floating point numbers, even though I have enabled the FPU and all of my functions and numbers are single precision types?

Why does my software application still use software libraries for double precision floating point numbers, even though I have enabled the FPU and all of my functions and numbers are single precision (float) types?


There are exceptions for which the GNU C Compiler (GCC) will check when there are no numerical representations in GCC, such as imaginary numbers (the square root of a negative number) or a division by 0.0. Such checks will occur when the sqrtf function is used and will increase certain operations by 70+ CPU cycles since the double precision software library of the sqrt function will be included.

If you are confident that your software application will not encounter any exceptions, you can add the following switch to the extra compiler options:

-ffast-math

Constant values that have not been declared as a variable of float type will default to type double, and as such will promote the single precision mathematical operations to double precision. You can add the following switch to keep all constant values as single precision (float) types:

-fsingle-precision-constant

Descriptions for the above options can be found on GCC's Web site:

http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Optimize-Options.html


There is a problem with MicroBlaze's CPU driver in that when the extended FPU function is being used (C_USE_FPU=2), the software libraries were being used instead of MicroBlaze's FPU core.

MicroBlaze's CPU driver has been fixed in EDK 11.3, available at:

http://www.xilinx.com/support/download/index.htm
AR# 31409
Date Created 12/08/2008
Last Updated 03/22/2011
Status Active
Type
Feed Back