This is the mail archive of the libc-alpha@sources.redhat.com 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: [rfc] alpha-linux changing to 128-bit long double


On Sat, Mar 13, 2004 at 09:08:06AM +0100, Jakub Jelinek wrote:
> On the other side, Alpha is not the only arch which want long double
> and changing SONAME is really painful.

I was noticing this.


> http://sources.redhat.com/ml/libc-hacker/2002-08/msg00102.html
> was my initial attempt to handle this (even including support for
> compilation with 64bit or 128bit long double), it just did not handle
> *printf/*scanf, but I wrote in there how could that be solved.

My thought for handling printf/scanf was to do something like

sysdeps/generic/ldouble-compat.h:
#define DOUBLE_LDOUBLE_SAME_P	(sizeof(double) == sizeof(long double))

sysdeps/alpha/ldouble-compat.h:
extern __thread int __libc_double_ldouble_same;
#define DOUBLE_LDOUBLE_SAME_P	__libc_double_ldouble_same

and then use that like so:

vfscanf.c:
	if (!DOUBLE_LDOUBLE_SAME_P && (flags & LONGDBL))
	  {
	    long double d = ...
	    ...
	  }
	else if (flags & (LONGDBL | LONG))
	  {
	    double d = ...
	    ...
	  }
	else
	  ...

which would even save a teeny bit of code for those targets that
do not plan to change to have different sized doubles.  vfprintf 
is somewhat more complex, since there are at least three places
where we look at va_arg, but otherwise conceptually the same.

The tls variable would get set properly by the actual user-visible
entry points.  That seemed slightly easier than passing this down
as a conditionalized parameter to the internal function.

> I can revive this patch, finish it and it could be then used on
> alpha/sparc32/ppc*.

That would be cool.


r~


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