public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* expand and truncate and 387
@ 1998-10-27  6:09 Jan Hubicka
  1998-10-30  3:25 ` Jeffrey A Law
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Hubicka @ 1998-10-27  6:09 UTC (permalink / raw)
  To: egcs

Hi
I am just looking at expand and truncate patterns. Since i387 holds all data
in same registers and form, they are not required in reg-to-reg cases.
Because they are extremly slow (done by writing to memory and reading back)
it is significant to avoid them (I think people often mix float and double
code just because many programmers use float and all functions are double)
I386.md partially handles this by patterns for each operation with first
extend, second extend and both extended.
This way is bit suboptimal. It makes hard to add new patterns and eliminate
just extensions and just in case only one extension is done.
I am not sure whether eliminating truncate in all cases is corret, but at least
it is good -ffast-math or -mno-ieee-fp candidate.
I think I can halde this by mach operator matching eighter truncate or extend.
Problem is that it still does not solve problem with nested retypes and I should
need to duplicate many patterns (that actually isn't) like important pushing onto
stack case (often used when calling functions) and so on.

Isn't possible to write instruction pattern that match eighter register or
register with truncate/extend expressions? using special predicate or so?


Honza
-- 
                       OK. Lets make a signature file.
+-------------------------------------------------------------------------+
|        Jan Hubicka (Jan Hubi\v{c}ka in TeX) hubicka@freesoft.cz         |
|         Czech free software foundation: http://www.freesoft.cz          |
|AA project - the new way for computer graphics - http://www.ta.jcu.cz/aa |
|  homepage: http://www.paru.cas.cz/~hubicka/ , games koules, Xonix, fast  |
|  fractal zoomer XaoS, index of Czech GNU/Linux/UN*X documentation etc.  | 
+-------------------------------------------------------------------------+

^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: expand and truncate and 387
@ 1998-11-02  0:21 Marc Lehmann
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Lehmann @ 1998-11-02  0:21 UTC (permalink / raw)
  To: egcs

>  > Because they are extremly slow (done by writing to memory and reading back)
>  > it is significant to avoid them
>So, my question is why are we doing anything for them to begin with.
>
>Can someone else that knows something abou the x86 confirm Jan's assertions?
>What is he talking about?  Don't we have to worry about rounding and truncation
>when changing modes?

I don't think the x86 backend worries about rounding and truncation on
fp->fp conversions.

>  > I386.md partially handles this by patterns for each operation with first
>  > extend, second extend and both extended.
>I'm sorry, I have no idea what you are talking about.  

The x86 backend generates a fst/fld combination which costs _alot_ of
cycles, and doesn't seem to serve a purpose (the x86 backend doesn't bother
calculating doubles as doubles and treats them as extended, giving them more
precision)

Since the only side-effect of this insn pair is to generate an exception
my !conjecture! is that either this indeed is their only purpose, or
they are just superflous.

>  > I am not sure whether eliminating truncate in all cases is corret, but at
>  > least it is good -ffast-math or -mno-ieee-fp candidate.
>I disagree.  We don't want to go overboard with either option since all that
>will do is make them useless.
>
>Right now, those options control domain checks for things like sqrt and basically
>enable some optimizations that are not safe in the presense of a NaN.

I think this would pretty much fit that description. But I don't _really_
know what these instructions are supposed to do, they just look like:

mov reg1 -> mem
mov mem -> reg1 (mem dies here)

and the only side effect I can see is possible rounding (Jan?) or exceptions.

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

^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: expand and truncate and 387
@ 1998-11-09 14:50 Stephen L Moshier
  1998-11-19  8:52 ` Jeffrey A Law
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen L Moshier @ 1998-11-09 14:50 UTC (permalink / raw)
  To: egcs; +Cc: Marc Lehmann

> I don't think the x86 backend worries about rounding and truncation on
> fp->fp conversions.

Assuming the usual long-double precision control setting,
converting from lower to higher precision is a no-op.

Converting from higher to lower precision requires the value to
be stored out to memory and read back in.  This actually does
truncate both the exponent and the significand to the format of the
narrower width.


^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: expand and truncate and 387
@ 1998-11-19 19:37 N8TM
  1998-11-20  8:14 ` Stephen L Moshier
  0 siblings, 1 reply; 28+ messages in thread
From: N8TM @ 1998-11-19 19:37 UTC (permalink / raw)
  To: law, moshier; +Cc: egcs, pcg

In a message dated 11/19/98 3:10:03 PM Pacific Standard Time, law@cygnus.com
writes:

>   > Assuming the usual long-double precision control setting,
>    > converting from lower to higher precision is a no-op.
>  Is that something we can safely assume?  I don't think so.
>  
Don't the other control settings simply limit the maximum precision available?
The single precision setting is not recommended, presumably since it
eliminates double, so there is no point in making conversions work under it.
This leaves conversion from single (float) to double, and doesn't that work
the same regardless of whether the control setting is double or long double?

^ permalink raw reply	[flat|nested] 28+ messages in thread
[parent not found: <19981130114618.A1831@dot.cygnus.com>]

end of thread, other threads:[~1998-12-01 17:59 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-27  6:09 expand and truncate and 387 Jan Hubicka
1998-10-30  3:25 ` Jeffrey A Law
1998-10-31  2:52   ` Jan Hubicka
1998-11-02  0:21 Marc Lehmann
1998-11-09 14:50 Stephen L Moshier
1998-11-19  8:52 ` Jeffrey A Law
1998-11-20  5:20   ` Stephen L Moshier
1998-11-23 16:29   ` Jan Hubicka
1998-11-23  9:01     ` Jeffrey A Law
1998-11-26  0:40       ` Richard Henderson
1998-11-26  6:51         ` Stephen L Moshier
1998-11-26  8:04           ` Jan Hubicka
1998-11-26 17:08             ` Jeffrey A Law
1998-11-26 19:01               ` Stephen L Moshier
1998-11-27  8:53           ` Richard Henderson
1998-11-27 12:46             ` Jan Hubicka
1998-11-27 17:13               ` Stephen L Moshier
1998-11-27 12:46             ` Stephen L Moshier
1998-11-19 19:37 N8TM
1998-11-20  8:14 ` Stephen L Moshier
     [not found] <19981130114618.A1831@dot.cygnus.com>
1998-11-30 20:56 ` Stephen L Moshier
1998-11-30 23:25   ` Richard Henderson
1998-11-30 20:56     ` Stephen L Moshier
1998-11-30 23:25       ` Richard Henderson
1998-12-01  6:13         ` Stephen L Moshier
1998-12-01 12:51           ` Richard Henderson
1998-12-01 17:59             ` Stephen L Moshier
1998-12-01 17:59           ` Joern Rennecke

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).