On Tue, 22 Aug 2023, Jakub Jelinek via Gcc-patches wrote: > +significant limb if @var{N} is not divisible by
@var{N} should be @var{n}, throughout. > +@deftypefn {Runtime Function} void __bid_fixsdbitint (@code{UBILtype} > *@var{r}, int32_t @var{rprec}, _Decimal32 @var{a}) > +@deftypefnx {Runtime Function} void __bid_fixddbitint (@code{UBILtype} > *@var{r}, int32_t @var{rprec}, _Decimal64 @var{a}) > +@deftypefnx {Runtime Function} void __bid_fixtdbitint (@code{UBILtype} > *@var{r}, int32_t @var{rprec}, _Decimal128 @var{a}) > +These functions convert @var{a} to bit-precise integer @var{r}, rounding > toward zero. > +If @var{rprec} is positive, it converts to unsigned bit-precise integer and > +negative values all become zero, if @var{rprec} is negative, it converts > +to signed bit-precise integer. > +@end deftypefn > + > +@deftypefn {Runtime Function} _Decimal32 __bid_floatbitintsd > (@code{UBILtype} *@var{i}, int32_t @var{iprec}) > +@deftypefnx {Runtime Function} _Decimal64 __bid_floatbitintdd > (@code{UBILtype} *@var{i}, int32_t @var{iprec}) > +@deftypefnx {Runtime Function} _Decimal128 __bid_floatbitinttd > (@code{UBILtype} *@var{i}, int32_t @var{iprec}) > +These functions convert bit-precise integer @var{i} to decimal floating > point. If > +@var{iprec} is positive, it is conversion from unsigned bit-precise integer, > +otherwise from signed bit-precise integer. > +@end deftypefn The documentation for __bid_* should say explicitly that these functions are for BID format (assuming it's intended that functions for DPD format should use __dpd_* when support is added for an architecture using DPD). > +/* Common final part of __fix?fbitint conversion functions. > + The A floating point value should have been converted using > + soft-fp macros into RV, U##DI##type DI##_BITS precise normal > + integral type and SHIFT, how many bits should that value be > + shifted to the left. R is pointer to limbs array passed to the > + function, RN number of limbs in it, ARPREC absolute value of > + RPREC argument passed to it, RSIZE number of significant bits in RV. > + RSIGNED is non-zero if the result is signed bit-precise integer, > + otherwise zero. If OVF is true, instead of storing RV shifted left > + by SHIFT bits and zero or sign extended store minimum or maximum > + of the signed or unsigned bit-precise integer type depending on if > + RV contains the minimum or maximum signed or unsigned value. */ As I understand it, OVF is also for the case of a zero result from input close to zero, for signed types (when that's not the maximum or minimum) in addition to unsigned types. > +/* Common initial part of __floatbitint?f conversion functions. > + I and IPREC are arguments passed to those functions, convert that > + into a pair of DI##type IV integer and SHIFT, such that converting > + IV to floating point and multiplicating that by pow (2, SHIFT) > + gives the expected result. IV size needs to be chosen such that > + it is large than number of bits in floating-point mantissa and "large than" -> "larger than". This patch is OK with those fixes. -- Joseph S. Myers jos...@codesourcery.com