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] Support Cell SPU floating point



On Sep 5, 2007, at 05:04, Richard Guenther wrote:
Do you think adding a mode argument to the appropriate routines in
real.c (e.g., real_arithmetic, real_compare) is the correct approach?
That would allow me to model the hardware correctly.  Or do you have
another suggestion?

Well, in general I think that adding a mode argument to those functions
makes sense (and I see that would be necessary to do what you need).

Yes, I strongly believe we'll need mode arguments eventually anyway. We don't yet support C99, in particular support for Annex F (binding to IEEE 754) is currently lacking. However, when we do get around to implementing things like #pragma STDC FENV_ACCESS, fesetround, etc, we'll want to evaluate constant expressions in those contexts. For that we'll need to pass modes.

Even now, it would be much clearer to have things such as conversion
of float to integer be done properly by GCC, using a rounding mode that
can be specified by the caller. Right now, for x86, in order to perform
unbiased rounding from float to integer, we set the FPU to truncate, perform
rounding and then adjust based on the difference between the exact
value and the rounded value. However, if we left the FPU in
round-to-even, it could be done without any mode-switching or
compensation code at all.


-Geert


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