public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <jh@suse.cz>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: Joe Buck <jbuck@synopsys.COM>, Chris Lattner <sabre@nondot.org>,
	Brad Lucier <lucier@math.purdue.edu>,
	gcc@gcc.gnu.org
Subject: Re: floor on i386
Date: Tue, 25 Sep 2001 06:47:00 -0000	[thread overview]
Message-ID: <20010925154659.B13734@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <orofo1bvxg.fsf@localhost.localdomain>

> It would probably be best to introduce a hard register to indicate the
> rounding mode, and use OPTIMIZE_MODE_SWITCHING to do as few mode
> changes as possible.  For reference, have a look at the SH4
> implementation of floating-point support, that defines an explicit
> floating-point control register, mode-switching RTL and USEs that

The USEs itself are problem - you loose a lot of optimizations then.
The trick can be to lower code before reload using pre-reload splitting.

Major problem still remains in reload.
If we don't want to get exact IEEE by setting proper precisity before each
mathematic operation (as SH4 does IMO), we will run into problems with spills ,
since these can be put in place control word is set to some wrong value
resutlting in wrong rounding before storing.

Thats the main purpose why my original patch didn't contained it.

The problem can be solved by mode switching pass after reload, when all spills
are visible - you use existing pass before reload to compute control word values
as these needs pseudos and after reload just insert fldcw/fstcw at strategic places.

If you insert them at last optimal position in code, you will get them after the
lazy code to compute control word inserted by pre-reload pass.

As disussed with Timothy, the benefits are relativly small compared to the first
half (computing control word values optimally), as CPUs do have hardware bypass.

> register in all instructions that depend on the floating-point mode,
> indicating in an attribute which mode the register is supposed to be
> in.  The difference is that SH4 uses the floating-point control
> register to switch between single- and double-precision operations,
> that have the same encoding but different behavior depending on the
> state of the control register.  Modeling mode switching for purposes
> of rounding on x86 should be far simpler.  In fact, I'm not even sure
> you'd need the hard register: just define unspec patterns that switch
> back and forth and you're done.
You need scheduling barrier, but it is big problem.

Honza
> 
> -- 
> Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
> Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
> CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
> Free Software Evangelist    *Please* write to mailing lists, not to me

  reply	other threads:[~2001-09-25  6:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-12 12:03 Chris Lattner
2001-09-12 16:16 ` Joe Buck
2001-09-24 10:52   ` Alexandre Oliva
2001-09-25  6:47     ` Jan Hubicka [this message]
2001-09-25  7:47       ` Brad Lucier
2001-09-25  8:00         ` Jan Hubicka
2001-09-25 12:52           ` Tim Prince
2001-09-25 12:48       ` Frank Klemm
2001-09-26  4:14         ` Jan Hubicka
2001-09-26 15:45           ` Frank Klemm
  -- strict thread matches above, loose matches on Subject: below --
2001-09-26 16:19 dewar
2001-09-27  7:09 ` Frank Klemm
2001-09-12  9:26 Brad Lucier

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=20010925154659.B13734@atrey.karlin.mff.cuni.cz \
    --to=jh@suse.cz \
    --cc=aoliva@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jbuck@synopsys.COM \
    --cc=lucier@math.purdue.edu \
    --cc=sabre@nondot.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 read-only IMAP folder(s) and NNTP newsgroup(s).