From: "Albert D. Cahalan" <acahalan@cs.uml.edu>
To: buhr@stat.wisc.edu (Kevin Buhr)
Cc: linux-kernel@vger.kernel.org, adam@yggdrasil.com, drepper@cygnus.com
Subject: Re: RFC: changing precision control setting in initial FPU context
Date: Sat, 3 Mar 2001 04:31:57 -0500 (EST) [thread overview]
Message-ID: <200103030931.f239Vvo124697@saturn.cs.uml.edu> (raw)
In-Reply-To: <vbaelwfwcky.fsf@mozart.stat.wisc.edu> from "Kevin Buhr" at Mar 03, 2001 01:12:13 AM
Kevin Buhr writes:
> It boils down to the fact that, under i386 Linux, the FPU control word
> has its precision control (PC) set to 3 (for 80-bit extended
> precision) while under i386 FreeBSD, NetBSD, and others, it's set to 2
> (for 64-bit double precision). On other architectures, I assume
> there's usually no mismatch between the C "double" precision and the
> FPU's default internal precision.
...
> Initially, I was quick to dismiss the whole thing as symptomatic of a
> severe floating-point-related cluon shortage. However, the more I
> think about it, the better the case seems for changing the Linux
> default:
>
> 1. First, PC=3 is a dangerous setting. A floating point program
> using "double"s, compiled with GCC without attention to
> FPU-related compilation options, won't do IEEE arithmetic running
> under this setting. Instead, it will use a mixture of 80-bit and
> 64-bit IEEE arithmetic depending rather unpredictably on compiler
> register allocations and optimizations.
>
> 2. Second, PC=3 is a mostly *useless* setting for GCC-compiled
> programs. There can obviously be no way to guarantee reliable
> IEEE 80-bit arithmetic in GCC-compiled code when "double"s are
> only 64 bits, so our only hope is to guarantee reliable IEEE
> 64-bit arithmetic. But, then we should have set PC=2 in the first
> place.
So you change it to 2... but what about the "float" type? It gets
a mixture of 64-bit and 32-bit IEEE arithmetic depending rather
unpredictably on compiler register allocations and optimizations???
If a "float" will have excess precision, then a "double" might
as well have it too. Usually it helps, but sometimes it hurts.
This is life with C on x86.
> So, on a related note, is it reasonable to consider resurrecting the
> "sys_setfpucw" idea at this point, to push the decision on the correct
> initial control word up to the C library level where it belongs? (For
> those who don't remember the proposal, the idea is that the C library
> can use "sys_setfpucw" to set the desired initial control word.
Ugh, more start-up crud.
next prev parent reply other threads:[~2001-03-03 9:32 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 [this message]
2001-03-03 10:26 ` Kevin Buhr
2001-03-03 20:04 ` Albert D. Cahalan
2001-03-03 21:00 ` Jason Riedy
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=200103030931.f239Vvo124697@saturn.cs.uml.edu \
--to=acahalan@cs.uml.edu \
--cc=adam@yggdrasil.com \
--cc=buhr@stat.wisc.edu \
--cc=drepper@cygnus.com \
--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).