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: [Patch soft-fp] Add support for various half-precision conversion routines


On Wed, 7 Sep 2016, James Greenhalgh wrote:

> What I'm not clear about is whether this patch is sufficient on the glibc
> side, or if I also need to wire something up in a Makefile over here?

No, it's not expected to be wired up in a Makefile, and testing in GCC is 
appropriate in this case.

> In the patch below, soft-fp/half.h is derived from soft-fp/single.h .

You are, correctly, not including the various macros for arithmetic 
operations not using this code, but I think that means a comment to that 
effect as in <https://gcc.gnu.org/ml/gcc-patches/2009-04/msg01132.html> is 
appropriate.

> +#define _FP_FRACTBITS_H		(_FP_W_TYPE_SIZE / 2)

No, that's not right.  FRACTBITS needs to be the total number of bits in 
the internal representation of the mantissa, to work right with the CLZ 
macros.  So it must be _FP_W_TYPE_SIZE, because the representation is 
always a multiple of that.  I'd expect your present code to get extensions 
of HFmode subnormals to wider types wrong because of this.

> +#if _FP_W_TYPE_SIZE < 64
> +# define _FP_FRACTBITS_DW_H	(_FP_W_TYPE_SIZE)
> +#else
> +# define _FP_FRACTBITS_DW_H	(_FP_W_TYPE_SIZE / 2)
> +#endif

And then this must be _FP_W_TYPE_SIZE unconditionally as well (since a 
double-width multiplication result for fma can always fit in a single 
word).

> +#if _FP_W_TYPE_SIZE < 64
> +#define _FP_FRAC_HIGH_DW_H(X)	_FP_FRAC_HIGH_2 (X)
> +#else
> +#define _FP_FRAC_HIGH_DW_H(X)	_FP_FRAC_HIGH_1 (X)
> +#endif

And this should always use _FP_FRAC_HIGH_1 (though it's not actually used 
in the 1-word case).

-- 
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]