This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] define WIDEST_HARDWARE_FP_SIZE on mips


On Oct 9, 2007, at 16:01, Richard Sandiford wrote:
Hmm.  Do you mean that GNAT doesn't support software floating point?
In other words, would this also happen on -msoft-float targets for
WIDEST_HARDWARE_FP_SIZE == 64?

(I hope this doesn't sound awkward.  I'm just trying to understand the
issue better.)

GNAT does support software floating point. The WIDEST_HARDWARE_FP_SIZE is there to prevent implicit use of software floating point for the widest FP types. Most targets claiming support for 128-bit floating point do so in ways that would make them unsuitable for use by Ada programs.

A standard idiom in Ada is to declare types with the
maximum floating-point precision supported, like:

type My_Float is new digits System.Max_Digits;

One of the reasons for declaring such a type is to prevent
implicit extra precision due to the FPU using wider
hardware registers such as happens with x87 and IEEE
single or double precision. Using the widest hardware
type, every operation is correctly rounded to a machine
number. This is an important property for numerical analysis.
Sometimes, 128-bit types are implemented using non-IEEE
semantics with very poor numerical properties ("double double").

Another reason is to use the widest HW FP type is get the
best accuracy that is still efficient. Many Ada applications
are used in  strict real-time environments, and it would
be disastrous to have performance of certain calculations
drop down a  cliff because the compiler decides to use
a 128-bit soft-float type, instead of a 64-bit or 80-bit hardware
type. The performance difference here would be about 2 to
3 orders of magnitude.

-Geert


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]