This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
alpha vs complex functions
- From: Richard Henderson <rth at twiddle dot net>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 8 Jan 2004 15:56:17 -0800
- Subject: alpha vs complex functions
GCC 3.4 fixed an ABI conformance problem with complex values, which
means that all functions that take single-precision complex parameters
are incompatible with previous versions of GCC.
I'm trying to figure out what I want to do about this in glibc.
I was thinking that one possibility for letting gcc 3.3 and 3.4
live together on the same machine would be to do stuff like
#if __GNUC_PREREQ(3, 4)
float cabsf (_Complex float) __asm__("__c2_cabsf");
#endif
or something, in some alpha-specific version of some math.h or
complex.h header file.
It is possible to write code by hand in gcc 3.3 that will inter-operate
with gcc 3.4 (so that we could be forward compatible),
float __c2_cabsf (float xreal, float ximag)
{
_Complex float x;
__real__ x = xreal;
__imag__ x = ximag;
return __cabsf (x);
}
It *might* be possible to do the reverse, but I'm not sure. If it's
possible the solution would look like
float __cabsf (double junk)
{
union {
double d;
float f[2];
} u;
u.d = junk;
return __c2_cabsf (u.f[0], u.f[1]);
}
Thoughts? I'm particularly interested in what to do about the
header files. The rest should be moderately straightforward
additions of files under sysdeps/alpha/ that include the normal
file and massage its contents with preprocessor ugliness.
r~