Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1011

Re: Compiler optimization and floating point operations

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.compilers
Subject Re: Compiler optimization and floating point operations
Date 2013-10-24 02:56 +0000
Organization Aioe.org NNTP Server
Message-ID <13-10-028@comp.compilers> (permalink)
References <13-10-026@comp.compilers>

Show all headers | View raw


Abid <abidmuslim@gmail.com> wrote:

(snip)
> Does back end compiler optimizations affect the floating point
> accuracy? Is there any research work in this area?

As far as I know, the biggest cause of problems with optimization
is the extended precision of the registers in the Intel x87.

The original design of the 8087 was for a virtual stack that would
spill on overflow, and (what is the opposite of spill?) on underflow.

Not until the hardware was ready did anyone try to write the interrupt
routine to handle it, and it turned out not to be possible.  The
required state information was either not available, could not be
restored, or both.

Compilers could write temporary intermediates to memory in temporary
real format, but that is rare.

Next comes the complication of optimization. Common subexpression
elimination between statements, or in general keeping values in
registers, means that some values will retain extra precision, but you
(the programmer) don't know which ones. Even if you assign to a
variable and reload, the optimizer might keep it in a register.  (Many
compilers have an option to force the store, but that can slow things
down.)

I don't know about the research that might be done. The x87 has an
eight element stack. Research won't change that, though the use of SSE
avoids the problem (and advantage) of extended precision.

The technology for doing optimization is reasonably well understood.
Knowing which ones you should do it a different problem.

-- glen

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Compiler optimization and floating point operations Abid <abidmuslim@gmail.com> - 2013-10-23 13:47 -0700
  Re: Compiler optimization and floating point operations Cameron McInally <cameron.mcinally@nyu.edu> - 2013-10-23 22:55 -0400
  Re: Compiler optimization and floating point operations glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-10-24 02:56 +0000
  Re: Compiler optimization and floating point operations George Neuner <gneuner2@comcast.net> - 2013-10-24 07:41 -0400
    Re: Compiler optimization and floating point operations Jean-Marc Bourguet <jm@bourguet.org> - 2013-10-24 15:51 +0200
    Re: Compiler optimization and floating point operations "Steven G. Kargl" <sgk@troutmask.apl.washington.edu> - 2013-10-24 16:38 +0000
      Re: Compiler optimization and floating point operations christian.bau@cbau.wanadoo.co.uk - 2013-10-28 15:54 -0700
    Re: Compiler optimization and floating point operations George Neuner <gneuner2@comcast.net> - 2013-10-24 15:51 -0400
    Re: Compiler optimization and floating point operations glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-10-24 20:21 +0000
    Re: Compiler optimization and floating point operations christian.bau@cbau.wanadoo.co.uk - 2013-10-28 15:50 -0700
      Re: Compiler optimization and floating point operations Cameron McInally <cameron.mcinally@nyu.edu> - 2013-10-28 20:41 -0400

csiph-web