[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] [PATCH] Make libm smaller using wrappers



On Mon, 12 Oct 2009, Maxim Kuvyrkov wrote:

> The following patch substitutes several double-precision libm functions with
> single-precision counterparts.  This transformation certainly degrades the
> precision of computations, but also reduces the size of the libm library by
> more than 50% on some architectures.

Although you and the documentation in option-groups.def say this, 
dbl-wrap.h would appear in fact to be using the long double versions where 
available.

> So far this work was tested on mips-linux-gnu with no changes when the feature
> is disabled.  When wrappers are used, several math tests expectedly fail.
> 
> I will also run tests on powerpc-linux-gnuspe configuration and will follow up
> in a couple of days.

It seems a good idea to test all the different long double configurations.  
mips-linux-gnu (o32) is one where long double is the same as double.  
powerpc-linux-gnuspe is one with IBM long double.  You also have IEEE 
extended long double (e.g. x86 or x86_64) and IEEE quad long double (e.g. 
MIPS64 (n32 or n64)) to cover.  Testing should make sure that the same set 
of symbols at the same versions is still exported from libm (before the 
patch, after the patch with the default configuration and after the patch 
with the new option group in use), as well as that there aren't problems 
with the fallback float or long double functions trying to call back to 
the double versions at any point.

> diff --git a/configure.in b/configure.in
> index af49d81..eed31a9 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -740,6 +740,10 @@ if test "$elf" = yes; then
>    sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
>  fi
>  
> +# Peek into option-groups.config to check if sysdeps/ieee754/dbl-wrap needs
> +# to be included into $sysnames.
> +grep "OPTION_EGLIBC_LIBM_BIG = n" option-groups.config
> +use_dbl_wrap=$?

This looks like it will cause an unwanted line of output on configure's 
stdout, as well as an error message from grep on configure's stderr if 
there is no option-groups.config file.  The result may still be correct - 
but the error message should be avoided.

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx