Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jun 2008 16:07:16 GMT
From:      Satoshi Kimura <satosi.kimura@nifty.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/125012: ports/math/ldouble for 128bit long double on i386
Message-ID:  <200806261607.m5QG7GjN070533@www.freebsd.org>
Resent-Message-ID: <200806261610.m5QGA86S058384@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         125012
>Category:       i386
>Synopsis:       ports/math/ldouble for 128bit long double on i386
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 26 16:10:08 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Satoshi Kimura
>Release:        6.2
>Organization:
private use
>Environment:
FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC 2007
    root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP

>Description:
1. problem
  On FreeBSD/i386 and /pc98, some functions of ports/math/ldouble
did not work at 128bit "long double", i.e "long double" compiled
by gcc with -m128bit-long-double option.

>How-To-Repeat:
(1) add in makefile to make test code "mtstl"
  all: mtstl

make it, and run it. This program makes no trouble.

% mtstl

(2) add the line of "CFLAGS=" of makefile
 -m128bit-long-double

make mtstl again, and run it. This program makes troubles.

>Fix:
2. patch
  Following patches are available to solve this problem.
These modifications did not effect to 96bit long double,
so we did not need to prepare two kind of sources and libraries. 

(1) patch for libml

--- floorl.c.org        Mon May 29 00:19:17 2000
+++ floorl.c    Tue Jun  3 00:24:43 2008
@@ -116,7 +116,7 @@
 union
   {
     long double d;
-    short i[6];
+    short i[8];
   } u;
 
 u.d = x;
@@ -189,7 +189,7 @@
 union
   {
     long double y;
-    unsigned short sh[6];
+    unsigned short sh[8];
   } u;
 int e;
 
@@ -260,7 +260,7 @@
 union
   {
     long double y;
-    unsigned short sh[6];
+    unsigned short sh[8];
   } u;
 int i, k;
 short *q;
@@ -349,7 +349,7 @@
 union
   {
     long double y;
-    unsigned short sh[6];
+    unsigned short sh[8];
   } u;
 unsigned short *q;
 long e;--- isnanl.c.org        Mon Jun 15 21:16:45 1998
+++ isnanl.c    Tue Jun  3 00:30:48 2008
@@ -58,8 +58,8 @@
 union
        {
        long double d;
-       short s[6];
-       int i[3];
+       short s[8];
+       int i[4];
        } u;
 
 u.d = x;
@@ -94,8 +94,8 @@
 union
        {
        long double d;
-       unsigned short s[6];
-       unsigned int i[3];
+       unsigned short s[8];
+       unsigned int i[4];
        } u;
 
 u.d = x;
@@ -149,8 +149,8 @@
 union
        {
        long double d;
-       unsigned short s[6];
-       unsigned int i[3];
+       unsigned short s[8];
+       unsigned int i[4];
        } u;
 
 u.d = x;
--- ldrand.c.org        Mon May 29 00:17:29 2000
+++ ldrand.c    Tue Jun  3 00:29:13 2008
@@ -114,7 +114,11 @@
 unkans.d -= r;
 unkans.d += 1.0L;
 
+#ifdef __FreeBSD__
+if( 0 )
+#else
 if( sizeof(long double) == 16 )
+#endif  /*  __FreeBSD__  */
   {
 #ifdef MIEEE
     ranwh();
--- nantst.c.org        Sun May 28 06:17:31 2000
+++ nantst.c    Tue Jun  3 00:33:16 2008
@@ -14,7 +14,7 @@
 union
   {
     long double f;
-    unsigned int i[3];
+    unsigned int i[4];
   }u;
 int k;
 
--- testvect.c.org      Sun Jun 14 02:30:29 1998
+++ testvect.c  Tue Jun  3 00:32:34 2008
@@ -374,7 +374,7 @@
   union
     {
       long double d;
-      char c[12];
+      char c[16];
     } u, v;
 
     /* This masks off fpu exceptions on i386.  */

(2) patch for mtstl (not used in ldouble as ports)

--- mtstl.c.org Sun Nov 12 09:24:27 2000
+++ mtstl.c     Tue Jun  3 00:25:43 2008
@@ -35,6 +35,11 @@
 Copyright 1984, 1987, 1988, 1995 by Stephen L. Moshier
 */
 
+#include <stdio.h>
+#ifdef __FreeBSD__
+#include <floatingpoint.h>
+#endif
+
 #include "mconf.h"
 
 /* C9X spells lgam lgamma.  */
@@ -239,7 +244,7 @@
 static double da, db, dc, dd;
 
 int ldrand();
-int printf();
+/* int printf(); */
 
 int
 main()
@@ -249,6 +254,11 @@
 struct fundef *d;
 int i, k, itst;
 int m, ntr;
+
+#if defined __FreeBSD__
+   fpsetprec(FP_PE);                /*  set double to 64 bit mode  */
+   fputs("** set double to 64 bit mode\n",stdout);
+#endif
 
 ntr = NTRIALS;
 printf( "Consistency test of math functions.\n" );


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806261607.m5QG7GjN070533>