This is the mail archive of the gcc@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: Ideas for Google Summer of Code


On Mon, 30 Mar 2009, Ross Ridge wrote:

> >2) half-precision floats;
> 
> Do you mean just conversion only support, like Sandra Loosemore's
> proposed ARM patch, or full arithmetic support like any other scalar or
> vector type?

Arithmetic via converting to float, doing arithmetic on that and 
converting back to half-precision gives you the same semantics as IEEE 
arithmetic directly on half-precision, except for the special case of 
converting double to half-precision where you can get double rounding if 
you go via float.  (This is because the precision of float is strictly 
more than twice that of half-precision.  Of course the above only applies 
to single arithmetic operations; more complicated combinations would need 
truncation to half-precision at each step rather than doing everything in 
float.)

So if you have hardware float operations but not hardware half-precision 
you probably want to use those hardware float operations for arithmetic 
rather than having any separate half-precision arithmetic implementation.  
There are at least three possibilities for semantics: the ARM semantics 
where promotion to float happens at the language level; full IEEE 
arithmetic with every operation having a result in the range and precision 
of half-precision; or C99 excess precision where the semantic type is 
half-precision but the values are expressed to the range and precision of 
float.

-- 
Joseph S. Myers
joseph@codesourcery.com


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