glibc/sysdeps/ieee754/ldbl-128
Florian Weimer e88b9f0e5c stdio-common: Convert vfprintf and related functions to buffers
vfprintf is entangled with vfwprintf (of course), __printf_fp,
__printf_fphex, __vstrfmon_l_internal, and the strfrom family of
functions.  The latter use the internal snprintf functionality,
so vsnprintf is converted as well.

The simples conversion is __printf_fphex, followed by
__vstrfmon_l_internal and __printf_fp, and finally
__vfprintf_internal and __vfwprintf_internal.  __vsnprintf_internal
and strfrom* are mostly consuming the new interfaces, so they
are comparatively simple.

__printf_fp is a public symbol, so the FILE *-based interface
had to preserved.

The __printf_fp rewrite does not change the actual binary-to-decimal
conversion algorithm, and digits are still not emitted directly to
the target buffer.  However, the staging buffer now uses bytes
instead of wide characters, and one buffer copy is eliminated.

The changes are at least performance-neutral in my testing.
Floating point printing and snprintf improved measurably, so that
this Lua script

  for i=1,5000000 do
      print(i, i * math.pi)
  end

runs about 5% faster for me.  To preserve fprintf performance for
a simple "%d" format, this commit has some logic changes under
LABEL (unsigned_number) to avoid additional function calls.  There
are certainly some very easy performance improvements here: binary,
octal and hexadecimal formatting can easily avoid the temporary work
buffer (the number of digits can be computed ahead-of-time using one
of the __builtin_clz* built-ins). Decimal formatting can use a
specialized version of _itoa_word for base 10.

The existing (inconsistent) width handling between strfmon and printf
is preserved here.  __print_fp_buffer_1 would have to use
__translated_number_width to achieve ISO conformance for printf.

Test expectations in libio/tst-vtables-common.c are adjusted because
the internal staging buffer merges all virtual function calls into
one.

In general, stack buffer usage is greatly reduced, particularly for
unbuffered input streams.  __printf_fp can still use a large buffer
in binary128 mode for %g, though.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-12-19 18:56:54 +01:00
..
bits Update _FloatN header support for C++ in GCC 13 2022-09-28 20:10:08 +00:00
e_acoshl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
e_acosl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_asinl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_atan2l.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
e_atanhl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
e_coshl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_exp10l.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
e_expl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
e_fmodl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
e_gammal_r.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
e_hypotl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
e_ilogbl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
e_j0l.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_j1l.c Ensure calculations happen with desired rounding mode in y1lf128 2022-08-18 12:32:18 +12:00
e_jnl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_lgammal_r.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_log2l.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_log10l.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_logl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_powl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_rem_pio2l.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
e_remainderl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
e_sinhl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
float128-abi.h Move __isnanf128 to libc.so 2021-03-30 14:58:19 +05:30
gamma_productl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ieee754.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
k_cosl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
k_sincosl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
k_sinl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
k_tanl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ldbl2mpn.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
lgamma_negl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
lgamma_productl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
Makeconfig Add _Float64x function aliases. 2017-11-27 14:16:47 +00:00
Makefile Fix build with GCC 13 _FloatN, _FloatNx built-in functions 2022-10-31 23:20:08 +00:00
math_ldbl.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
math-nan-payload-ldouble.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
mpn2ldbl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
printf_fphex_macros.h stdio-common: Convert vfprintf and related functions to buffers 2022-12-19 18:56:54 +01:00
printf_fphex.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_asinhl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_atanl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
s_cbrtl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
s_ceill.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_copysignl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_cosl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_daddl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_ddivl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_dfmal.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_dmull.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_dsqrtl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_dsubl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_erfl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
s_expm1l.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
s_f64xaddf128.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_f64xdivf128.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_f64xfmaf128.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_f64xmulf128.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_f64xsqrtf128.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_f64xsubf128.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fabsl.c math: Add math-use-builtins-fabs (BZ#29027) 2022-05-23 17:49:18 -03:00
s_faddl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fdivl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_ffmal.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_finitel.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_floorl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_fma.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fmal.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fmull.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fpclassifyl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_frexpl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_fromfpl_main.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fromfpl.c Use libm_alias_ldouble for ldbl-128 functions. 2017-10-06 17:45:05 +00:00
s_fromfpxl.c Use libm_alias_ldouble for ldbl-128 functions. 2017-10-06 17:45:05 +00:00
s_fsqrtl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_fsubl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_getpayloadl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_isinfl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_isnanl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_issignalingl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_llrintl.c Use GCC builtins for llrint functions if desired. 2022-11-29 16:00:28 +08:00
s_llroundl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_log1pl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
s_logbl.c Use GCC builtins for logb functions if desired. 2022-11-29 16:00:28 +08:00
s_lrintl.c Use GCC builtins for lrint functions if desired. 2022-11-29 16:00:28 +08:00
s_lroundl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_modfl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_nearbyintl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_nextafterl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_nexttoward.c ldbl-128ibm-compat: Provide nexttoward functions 2020-02-28 08:20:02 -06:00
s_nexttowardf.c ldbl-128ibm-compat: Provide nexttoward functions 2020-02-28 08:20:02 -06:00
s_nextupl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_remquol.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_rintl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_roundevenl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_roundl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_scalblnl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_scalbnl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_setpayloadl_main.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_setpayloadl.c Use libm_alias_ldouble for ldbl-128 functions. 2017-10-06 17:45:05 +00:00
s_setpayloadsigl.c Use libm_alias_ldouble for ldbl-128 functions. 2017-10-06 17:45:05 +00:00
s_signbitl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_sincosl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_sinl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_tanhl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_tanl.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
s_totalorderl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_totalordermagl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_truncl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s_ufromfpl.c Use libm_alias_ldouble for ldbl-128 functions. 2017-10-06 17:45:05 +00:00
s_ufromfpxl.c Use libm_alias_ldouble for ldbl-128 functions. 2017-10-06 17:45:05 +00:00
strtold_l.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
t_expl.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
t_sincosl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
x2y2m1l.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00