Bug 73782 - libc is missing the _Qp_cmp function
Summary: libc is missing the _Qp_cmp function
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: sparc64 (show other bugs)
Version: 5.3-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Stefan Farfeleder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-10 17:00 UTC by Dan Nelson
Modified: 2005-07-01 17:59 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Nelson 2004-11-10 17:00:40 UTC
gcc will generate calls to _Qp_cmp when doing some long-double math
operations.  I don't know exactly what C code triggers it, but pike 7.6
configured with --with-long-double-precisionfails to link because it
can't find _Qp_cmp.

Fix: 

Add _Qp_cmp support to /usr/src/lib/libc/sparc64/fpu/fpu_qp.c .  NetBSD
has working code (although a different way of going about it) at
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/arch/sparc64/softfloat/qp.c
, and the official description of the function is at
http://www.sparc.com/standards/SCD.2.4.1.ps (although I can't seem to
get to it right now)
How-To-Repeat: 
I'm reporting this secondhand, but downloading
http://pike.ida.liu.se/pub/pike/latest-stable/Pike-v7.6.24.tar.gz and
running "make CONFIGUREARGS=--with-long-double-precision" should be
enough to trigger it.
Comment 1 tyler 2004-12-23 01:18:35 UTC
Isn't the functionality of the _Qp_cmp function from NetBSD done by our
_Qp_f function (found on line 90 of fpu_qp.c)

Along those lines, how come that file defines the macro _QP_CMP and then
the function 'int _Qp_f(u_int *a, u_int *b)' from what I can tell by
glancing over the code, it's got the functionalty of the _Qp_cmp
function, why is it not named as such (especially if it's defined in the
sparc standard, i'm looking for it in there now)

-R. Tyler Ballance
Comment 2 Dan Nelson 2004-12-24 06:37:34 UTC
In the last episode (Dec 22), R. Tyler Ballance said:
> Isn't the functionality of the _Qp_cmp function from NetBSD done by
> _our Qp_f function (found on line 90 of fpu_qp.c)

Probably.  It looks like _Qp_cmp does them all in one function, and can
also tell you whether two floads are unordered relative to each other. 
If gcc can be told to never emit calls to _qp_cmp, maybe it won't be
needed.

Here's a testcase that at least on Solaris 9/gcc-3.4.2 generates a call
_to Qp_cmp.  The C99 unordered() function from <math.h> is probably
what is generating the call in Pike.

main()
{
	long double a, b;
	return __builtin_isunordered(a,b);
}

> Along those lines, how come that file defines the macro _QP_CMP and
> then the function 'int _Qp_f(u_int *a, u_int *b)' from what I can
> tell by glancing over the code, it's got the functionalty of the
> _Qp_cmp function, why is it not named as such (especially if it's
> defined in the sparc standard, i'm looking for it in there now)

That's just a macro definition; it pastes the first argument of the
macro onto "_Qp_f", so _QP_CMP(eq,0,FCC_EQ) generates a function named
_Qp_feq.

-- 
	Dan Nelson
	dnelson@allantgroup.com
Comment 3 Stefan Farfeleder freebsd_committer freebsd_triage 2005-06-04 17:13:05 UTC
Responsible Changed
From-To: freebsd-sparc64->stefanf

I'll take it.
Comment 4 Stefan Farfeleder freebsd_committer freebsd_triage 2005-06-21 22:19:44 UTC
State Changed
From-To: open->patched

Fix committed to -current.
Comment 5 Stefan Farfeleder freebsd_committer freebsd_triage 2005-07-01 17:58:54 UTC
State Changed
From-To: patched->closed

Merged to stable.  Thanks for the report.