www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1998/03/14/03:37:21

X-pop3-spooler: POP3MAIL 2.1.0 b 3 961213 -bs-
Delivered-To: pcg AT goof DOT com
Message-ID: <19980314021754.03003@cerebro.laendle>
Date: Sat, 14 Mar 1998 02:17:54 +0100
From: Marc Lehmann <pcg AT goof DOT com>
To: beastium <beastium-list AT Desk DOT nl>
Subject: Re: paranoia & extra precision [was -fno-float-store in pgcc]
References: <19980312234128 DOT 63392 AT cerebro DOT laendle> <Pine DOT SOL DOT 3 DOT 96 DOT 980313133308 DOT 249A-100000 AT stekt10>
Mime-Version: 1.0
X-Mailer: Mutt 0.88
In-Reply-To: <Pine.SOL.3.96.980313133308.249A-100000@stekt10>; from Tuukka Toivonen on Fri, Mar 13, 1998 at 01:43:54PM +0200
X-Operating-System: Linux version 2.1.85 (root AT cerebro) (gcc version pgcc-2.91.06 980129 (gcc-2.8.0 release))
Status: RO
Lines: 79

On Fri, Mar 13, 1998 at 01:43:54PM +0200, Tuukka Toivonen wrote:
> On Thu, 12 Mar 1998, Marc Lehmann wrote:
> 
> >> There seems to be annother way, but involes the unducumented functions
> >> __getfpucw and __setfpucw.
> 
> Undocumented????

Please quote correctly! I didn't write this!

> Those functions has nothing to do with the _hardware_ -> they are some
> OS/GCC thingies I don't know about -> GCC/OS is undocumented
> -> GCC/OS is broken (not really... with GNU software they're documented in
> source code, at least)
> 
> These functions probably use FPU instructions fstenv/fldenv

fnstcw, fnldcw

> true. Does anyone _know_ what IEEE says? It's difficult for me to believe
> that if IEEE would actually require it, Intel wouldn't honor them _even if_
> they honor them with add/sub/div/mul etc...

the problem is that implementing this in the compiler will
generate far too many instruction. gcc already does this
on occasion:

double x;
int i = x;

will (correctly) generate:

        fldl 16(%esp)
        fnstcw 8(%esp)
        movl 8(%esp),%edx
        movb $12,%dh
        movl %edx,(%esp)
        fldcw (%esp)
        fistpl (%esp)
        movl (%esp),%eax
        fldcw 8(%esp)

I don't understand how people can publicly state that this is a __compiler__
problem....

> >- the compiler cannot know when to set it, i.e. the same fundamental problem
> >  than with mmx, the compiler had to set the cw on almost every procedure
> >  entry etc...
> 
> Yep, the user must tell it.
> 
> >x86 fpu = hopelessly broken. by design.
> 
> Except for maybe transcendental instructions, it is not. Just set low

> precision at bootup and don't change it later -> you'll have IEEE

I have to set low precision on almost every statement involving floats,
since the intructions don't encode a size. Sure, you can ONLY
use floats, or ONLY use double, or ONLY use long double, but
the compiler CANNOT know this.

What you are saying is that forcing the user to tell the compiler wether
he intends to use some datatypes (where the hardware should provide it)
is NOT broken. This might be your opinion, but it definitely isn't mine.

If anybody wants it, no problem, hacking an fpu-soft emulator
into libgcc is no problem. The compiler then solves it's
problems by simply not using the fpu at all.

I don't think this is sane.

      -----==-                                              |
      ----==-- _                                            |
      ---==---(_)__  __ ____  __       Marc Lehmann       +--
      --==---/ / _ \/ // /\ \/ /       pcg AT goof DOT com       |e|
      -=====/_/_//_/\_,_/ /_/\_\                          --+
    The choice of a GNU generation                        |
                                                          |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019