linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Riedy <ejr@CS.Berkeley.EDU>
To: linux-kernel@vger.kernel.org
Subject: Re: RFC: changing precision control setting in initial FPU context
Date: Sat, 03 Mar 2001 13:00:08 -0800	[thread overview]
Message-ID: <200103032100.NAA22606@lotus.CS.Berkeley.EDU> (raw)
In-Reply-To: Your message of "Sat, 03 Mar 2001 15:04:01 EST." <200103032004.f23K417447302@saturn.cs.uml.edu>

And "Albert D. Cahalan" writes:
 - 
 - 2. Extra precision when it comes free. The precision control is set
 -    to 80-bit and the compiler tries to keep values in registers.
 -    This is usually the more useful behavior, and it performs better.

Even better is for gcc to spill intermediate results to 80 bits.
Unfortunately, these 80 bits have to be expanded to 128 for 
alignment, and this eats cache.  IIRC, this has been discussed
many times by gcc developers.  I don't recall the final verdict.
The original intent with the 8087 was that the compiler and/or
OS could transparently extend the stack into memory, but one
necessary feature was left out until the 80387.  By that point,
it was too late.  And then came caches...

 - What you are suggesting is a gross hybrid. You claim it has something
 - to do with IEEE, but it doesn't handle 32-bit math correctly. Your
 - proposal is NOT true IEEE math.

Note that getting what some people want to call `true' IEEE 754 
arithmetic on an x86 is frightfully tricky.  Changing the precision
does not shorten the exponent field, and that can have, um, fun
effects on and around under/overflow.  The mantissa and exponent 
lengths were chosen carefully to protect against those effects in 
many computations.

What Linux does presently on x86 is as right as right can be on 
this platform.  Compare with what MS's compilers do (die when you 
run out of the fp stack slots, telling users to simplify the 
expressions in the source code) and be happy.  The *BSD choice is 
valid by some lines of thought, but it also denies people the happy 
accident of computing with more precision and range than they thought 
they needed.  Overall, computing with x86 double-extended is a good
thing so long as you don't introduce multiple roundings.  That's a
compiler issue, not a kernel one.

Historical note:  According to one of the x87 designers, this all
boils down to the simple fact that there's no time when a pair of
collaborators in California and Israel can be both awake and lucid
enough to explain things well over a noisy telephone line.  Amazing
that it really wasn't long ago.  And if anyone's really interested,
keep checking
	http://www.cs.berkeley.edu/~wkahan/
as some of Dr. Kahan's older papers are slowly converted and added.
They give a great deal of insight into the choices that eventually
became the accepted IEEE 754 standard.

Jason

  reply	other threads:[~2001-03-03 21:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-03  7:12 RFC: changing precision control setting in initial FPU context Kevin Buhr
2001-03-03  9:31 ` Albert D. Cahalan
2001-03-03 10:26   ` Kevin Buhr
2001-03-03 20:04     ` Albert D. Cahalan
2001-03-03 21:00       ` Jason Riedy [this message]
2001-03-03 23:17         ` Kevin Buhr
2001-03-04  4:21           ` Jason Riedy
2001-03-03 22:34       ` Kevin Buhr
2001-03-03 10:47 Adam J. Richter
2001-03-03 23:29 ` Kevin Buhr
2001-03-03 23:37   ` Alan Cox
2001-03-04  0:27     ` Kevin Buhr
2001-03-04  0:45       ` Ulrich Drepper

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=200103032100.NAA22606@lotus.CS.Berkeley.EDU \
    --to=ejr@cs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    /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 NNTP newsgroup(s).