delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/10/08/10:35:33

Date: Fri, 8 Oct 93 10:21:42 -0400
From: DJ Delorie <dj AT ctron DOT com>
To: CZIWKGA AT vmsfe DOT ulcc DOT ac DOT uk
Cc: DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Novice question on FP use and emulation

> (1)  The manual says that the compiler shouldn't issue floating
> point instructions unless you compile floating point code.
> But I find that, even if I compile the classic "hello world"
> program, the compiler bombs out with an exception unless I
> set the 387 enviroment variable to cause an emulator to be used.

I think the statement is no longer true.  Gcc uses floating point to
calculate reusage potentials for registers when optimizing, and maybe
for other things as well.

> (2)  If I DO compile floating point code, set the 387 variable
> for an emulator, but don't explicitly specify an emulator in
> the GO32 variable, I don't get error messages, but I find that
> every floating-point constant in the generated code is
> integer -1 (i.e. 4 or 8 bytes of FFFFFFF..) Also, at runtime,
> every floating-point result is the same.

The 387 variable should only be used to override the autodetection
code.  Since this code is as Intel specifies, if you have to use the
387 variable then your machine is not Intel compatible.

> (3) I get the same results if I use the djgpp-supplied emulator.

If you run "set go32=emu c:/djgpp/emu387/emu387" it should always use
the emulator.

> (4) If I use the alternate emulator (wmemu ? I can't remember the
> name and don't have access to my system right now, but it's the
> one without sources) floating point seems to work fine.

There are few differences in support between the two emulators.  If
you can get one to work, the other should work also.

> I'm happy in that I have a solution that works (use the emulator
> without sources) but I'm unhappy in that I don't understand
> the other behaviour. What's more, I had earlier had a (presumably
> mistaken) impression that 486 processors performed floating-point
> instructions themselves, without the need for a 387 co-processor.
> I seem to be wrong. So what sort of co-processor goes with
> a 486 ?

If you have a 486 and not a 486SX, you *have* an FPU and shouldn't
need to use an emulator at all.


- Raw text -


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