public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: rth@redhat.com
Cc: aoliva@redhat.com, gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org,
	gcc@gcc.gnu.org, libstdc++@gcc.gnu.org, oldham@codesourcery.com,
	ro@TechFak.Uni-Bielefeld.DE
Subject: Irix6 native long double libcalls progress report (and problem)
Date: Thu, 30 Jan 2003 23:31:00 -0000	[thread overview]
Message-ID: <200301302151.QAA12389@caip.rutgers.edu> (raw)
In-Reply-To: <20030129170727.GB21507@redhat.com>

I got pretty far getting Irix6 to use it's native libc long double
routines.  I managed to come up with a patch and run some timing
tests, for long double ops in isolation I'm getting speedups from 5x
to 20x over the gcc routines depending on the operation performed.

So far so good.  In the case of the comparison ops, they don't have
the same return values that gcc expects, so I commented them out.  And
in another case, the gcc routines are better, so I commented out those
too.  What's left is in the patch at the end of this message.

When I ran the testsuite however, I get one new failure in
execute/conversion.c.  The problem boils down to this:

 > long double
 > ull2ld(u)
 >      unsigned long long int u;
 > {
 >   return u;
 > }
 > 

Then we crash on this code:

 >   if (ull2ld(~0ULL) != (long double) ~0ULL)
 >     abort();

I.e. supposedly the value passed through and converted in a function
is different than the same constant cast inline.

I added some code to check out what we're actually getting:


 > #include <stdio.h>
 > extern void abort(void);
 > 
 > long double
 > ull2ld(u)
 >      unsigned long long int u;
 > {
 >   return u;
 > }
 > 
 > int main()
 > {
 >   fprintf (stderr, "%.25Le\n%.25Le\n%Le\n", ull2ld(~0ULL),
 > 	   (long double) ~0ULL, ull2ld(~0ULL) - (long double) ~0ULL);
 >   {
 >     union f { long double ld; unsigned long long ll[2]; }
 >     f1 = { ull2ld(~0ULL) }, f2 = { (long double) ~0ULL };
 >     
 >     fprintf (stderr, "%llx %016llx\n%llx %016llx\n",
 > 	     f1.ll[0], f1.ll[1], f2.ll[0], f2.ll[1]);
 >   }
 > 
 >   if (ull2ld(~0ULL) != (long double) ~0ULL)
 >     abort();
 >   
 >   return 0;
 > }
 >  

With gcc-3.3 from last night plus the patch, it yields:

1.8446744073709551615000000e+19
1.8446744073709551615000000e+19
0.000000e+00
43f0000000000000 bff0000000000000
43efffffffffffff 409ffc0000000000
Abort (core dumped)

As you can see, the numbers are equal in value.  To see whether the
value was different in some far out Nth decimal place, I subtracted
them and it results in zero point zero.

But the bit patterns are different!  And I'm guessing that this
confuses the gcc comparison function.

What's going on here?  Ideas?

		Thanks,
		--Kaveh


2003-01-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* mips/iris6.h (INIT_NATIVE_TFP_OPTABS): Define.
	* config.gcc: Set INIT_SUBTARGET_OPTABS to INIT_NATIVE_TFP_OPTABS
	for irix6 when not enabling "gofast" routines.

diff -rup orig/egcc-3.3-CVS20030129/gcc/config/mips/iris6.h egcc-3.3-CVS20030129/gcc/config/mips/iris6.h
--- orig/egcc-3.3-CVS20030129/gcc/config/mips/iris6.h	Mon Jan 27 22:31:46 2003
+++ egcc-3.3-CVS20030129/gcc/config/mips/iris6.h	Thu Jan 30 08:56:54 2003
@@ -511,3 +511,35 @@ do {									 \
 %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"
 
 #define MIPS_TFMODE_FORMAT ibm_extended_format
+
+/* Faster long double routines from irix6 libc.  */
+#define INIT_NATIVE_TFP_OPTABS \
+do { \
+  add_optab->handlers[(int) TFmode].libfunc = init_one_libfunc ("__q_add"); \
+  sub_optab->handlers[(int) TFmode].libfunc = init_one_libfunc ("__q_sub"); \
+  smul_optab->handlers[(int) TFmode].libfunc = init_one_libfunc ("__q_mul"); \
+  sdiv_optab->handlers[(int) TFmode].libfunc = init_one_libfunc ("__q_div"); \
+  neg_optab->handlers[(int) TFmode].libfunc = init_one_libfunc ("__q_neg"); \
+\
+  extendsftf2_libfunc = init_one_libfunc ("__q_ext"); \
+  extenddftf2_libfunc = init_one_libfunc ("__q_extd"); \
+  trunctfsf2_libfunc = init_one_libfunc ("__sngl_q"); \
+  trunctfdf2_libfunc = init_one_libfunc ("__dble_q"); \
+\
+  /* These routines return 0/1, we need tri-state -1,0.1.  */ \
+  /*eqtf2_libfunc = init_one_libfunc ("__q_eq");*/ \
+  /*netf2_libfunc = init_one_libfunc ("__q_ne");*/ \
+  /*gttf2_libfunc = init_one_libfunc ("__q_gt");*/ \
+  /*getf2_libfunc = init_one_libfunc ("__q_ge");*/ \
+  /*lttf2_libfunc = init_one_libfunc ("__q_lt");*/ \
+  /*letf2_libfunc = init_one_libfunc ("__q_le");*/ \
+\
+  /* These two routines are actually slower.  */ \
+  /*fixtfsi_libfunc = init_one_libfunc ("__ji_qint");*/ \
+  /*fixunstfsi_libfunc = init_one_libfunc ("__ji_quint");*/ \
+  fixtfdi_libfunc = init_one_libfunc ("__ki_qint"); \
+  fixunstfdi_libfunc = init_one_libfunc ("__ki_quint"); \
+\
+  floatsitf_libfunc = init_one_libfunc ("__q_flotj"); \
+  floatditf_libfunc = init_one_libfunc ("__q_flotk"); \
+} while (0)
diff -rup orig/egcc-3.3-CVS20030127/gcc/config.gcc egcc-3.3-CVS20030127/gcc/config.gcc
--- orig/egcc-3.3-CVS20030127/gcc/config.gcc	2003-01-04 17:00:25.000000000 -0500
+++ egcc-3.3-CVS20030127/gcc/config.gcc	2003-01-28 14:39:51.670349000 -0500
@@ -2879,6 +2879,7 @@ mips*-*-*)
 		tm_file="gofast.h $tm_file"
 		tmake_file="mips/t-gofast $tmake_file"
 	else
+		tm_defines="INIT_SUBTARGET_OPTABS=INIT_NATIVE_TFP_OPTABS $tm_defines"
 		tmake_file="mips/t-mips $tmake_file"
 	fi
 	;;

  reply	other threads:[~2003-01-30 21:51 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-14 14:09 Irix6 long doubles implemented wrong? (27_io/ostream_inserter_arith) Kaveh R. Ghazi
2002-12-16  9:24 ` Rainer Orth
2002-12-16  9:51 ` Alexandre Oliva
2002-12-16  9:52   ` Rainer Orth
2002-12-16 12:23     ` Eric Christopher
2002-12-16 21:58   ` Kaveh R. Ghazi
2002-12-21 10:45     ` Alexandre Oliva
2002-12-22  6:02       ` Kaveh R. Ghazi
2002-12-22 10:24       ` Alexandre Oliva
2002-12-22 10:35         ` Alexandre Oliva
2002-12-23  9:46         ` Alexandre Oliva
2002-12-24 11:07           ` Kaveh R. Ghazi
2002-12-25  8:04             ` Alexandre Oliva
2002-12-26 13:48               ` Alexandre Oliva
2002-12-27  7:06                 ` Alexandre Oliva
2002-12-29  0:22                   ` Kaveh R. Ghazi
2002-12-29  6:06                     ` Alexandre Oliva
2003-01-07 22:57                   ` Richard Henderson
2003-01-08 18:16                     ` Alexandre Oliva
2003-01-08 22:19                       ` Richard Henderson
2003-01-09  9:29                         ` Alexandre Oliva
2003-01-09  9:38                           ` Alexandre Oliva
2003-01-10  1:18                     ` Alexandre Oliva
2003-01-10  2:29                       ` Richard Henderson
2003-01-19 21:02                         ` Kaveh R. Ghazi
2003-01-19 22:15                           ` Alexandre Oliva
2003-01-26 13:00                             ` Alexandre Oliva
2003-01-28 17:32                               ` Alexandre Oliva
2003-01-28 23:38                                 ` Alexandre Oliva
2003-01-26 15:20                             ` Alexandre Oliva
2003-01-26 16:14                               ` Alexandre Oliva
2003-01-26 18:40                                 ` Kaveh R. Ghazi
2003-01-26 21:24                                 ` Kaveh R. Ghazi
2003-01-26 21:25                                   ` Alexandre Oliva
2003-01-27  9:17                                   ` Kaveh R. Ghazi
2003-01-27 10:40                                     ` Alexandre Oliva
2003-01-28  4:52                                       ` Kaveh R. Ghazi
2003-01-28 17:31                                         ` Alexandre Oliva
2003-01-28 19:11                                           ` Kaveh R. Ghazi
2003-01-28 19:23                                             ` Kaveh R. Ghazi
2003-01-28 19:47                                               ` Rainer Orth
     [not found]                                               ` <15926.49701.3! 59482.666471@xayide.TechFak.Uni-Bielefeld.DE>
2003-01-29  6:56                                                 ` Kaveh R. Ghazi
2003-01-29 10:07                                                   ` Richard Henderson
2003-01-29 13:39                                                     ` Alexandre Oliva
2003-01-29 17:26                                                     ` Kaveh R. Ghazi
2003-01-29 18:10                                                       ` Richard Henderson
2003-01-30 23:31                                                         ` Kaveh R. Ghazi [this message]
2003-01-30 23:49                                                           ` Irix6 native long double libcalls progress report (and problem) Richard Henderson
2003-02-03 13:22                                                             ` Alexandre Oliva
2003-01-30  8:05                                                     ` Irix6 long doubles implemented wrong? (27_io/ostream_inserter_arith) Kaveh R. Ghazi
2003-02-03 13:07                                                       ` Alexandre Oliva
2003-02-03 15:18                                                         ` Kaveh R. Ghazi
2003-02-03 16:37                                                           ` Alexandre Oliva
2003-01-27 10:41                                     ` Alexandre Oliva
2003-01-26 21:54                                 ` Richard Henderson
2003-01-10  1:37                     ` Alexandre Oliva
2003-01-26 10:07                     ` Alexandre Oliva
2003-01-26 10:42                     ` Alexandre Oliva
2003-01-26 10:45                     ` Alexandre Oliva
2003-01-26 10:53                     ` Alexandre Oliva
2003-01-26 12:07                     ` Alexandre Oliva
2003-01-26 12:20                     ` Alexandre Oliva
2003-01-26 12:50                     ` Alexandre Oliva
2002-12-24 18:15           ` Kaveh R. Ghazi
2003-01-07 22:16             ` Richard Henderson
2003-01-07 22:40           ` Richard Henderson
2003-01-08 18:04             ` Alexandre Oliva
2003-01-08 22:29               ` Richard Henderson
2003-01-08 22:46                 ` Zack Weinberg
2003-01-08 23:13                   ` Richard Henderson
2003-01-09  7:27                 ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301302151.QAA12389@caip.rutgers.edu \
    --to=ghazi@caip.rutgers.edu \
    --cc=aoliva@redhat.com \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=oldham@codesourcery.com \
    --cc=ro@TechFak.Uni-Bielefeld.DE \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).