This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Implement fma in soft-fp


On 06/22/2013 10:17 AM, Joseph S. Myers wrote:
> * Using this code on an architecture that detects tininess after
>   rounding may require soft-fp support for after-rounding tininess
>   detection to be added to avoid failures of fma tests for that
>   particular case.  (In particular, this is relevant for alpha.  It's
>   not currently relevant for MIPS because of the general lack of
>   exceptions support in the cases where this code gets used.)

I'll give this a bit o testing for alpha and see what happens.

> -#define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y)				\
> +#define _FP_MUL_MEAT_DW_1_hard(wfracbits, R, X, Y)			\
>    do {									\
> -    _FP_W_TYPE _xh, _xl, _yh, _yl, _z_f0, _z_f1, _a_f0, _a_f1;		\
> +    _FP_W_TYPE _xh, _xl, _yh, _yl;					\
> +    _FP_FRAC_DECL_2(_a);						\
>  									\
>      /* split the words in half */					\
>      _xh = X##_f >> (_FP_W_TYPE_SIZE/2);					\
> @@ -172,17 +184,23 @@ do {							\
>      _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1);		\
>  									\
>      /* multiply the pieces */						\
> -    _z_f0 = _xl * _yl;							\
> +    R##f0 = _xl * _yl;							\
>      _a_f0 = _xh * _yl;							\
>      _a_f1 = _xl * _yh;							\
> -    _z_f1 = _xh * _yh;							\
> +    R##f1 = _xh * _yh;							\

Missing _ before f[01] there.

I've been wondering from time to time about replacing all of this macro
nonsense with c++.  Overloaded functions in some cases, templates in others.
It might eliminate silly typos like this.  And be easier to debug.

I believe that all of this code pre-dates the SRA pass by a large margin,
so it's possible the compiler could do the same good structure splitting
job that we did here by hand.

Of course, that would require glibc to build parts with the c++ compiler,
so that may be a non-starter...


r~


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