public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/3928: The -ffast-,math option does not re-associate f.p. multiply
@ 2001-08-03 11:06 trt
  0 siblings, 0 replies; 2+ messages in thread
From: trt @ 2001-08-03 11:06 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3928
>Category:       optimization
>Synopsis:       The -ffast-,math option does not re-associate f.p. multiply
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 03 11:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tom Truscott
>Release:        gcc version 3.0 20010326 (prerelease)
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
Programs compiled with -ffast-math should re-associate
and fold floating point constant multiplication.
>How-To-Repeat:
Compile the following program with -ffast-math
and observe in the assembly code that there are two
multiplies by 3, rather than one multiply by 9:

multiply_by_nine (x)
     double x;
{
  return x * 3 * 3;
}
>Fix:
In gcc/fold_const.c, at approx line 5577, change:
      if (! wins
          && (! FLOAT_TYPE_P (type)
              || (flag_fast_math && code != MULT_EXPR)))
to
      if (! wins && (! FLOAT_TYPE_P (type) || flag_fast_math))

(Arguably the "code != MULT_EXPR" was intended to be ==,
and so by mistake gcc has been re-associating + and -
rather than *.  Given that it has been this way
and no one has noticed, I think gcc should just
re-associate all such expressions.
It might be appropriate to revise the comment
preceeding this code, though.)
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: optimization/3928: The -ffast-,math option does not re-associate f.p. multiply
@ 2002-02-04 13:32 toon
  0 siblings, 0 replies; 2+ messages in thread
From: toon @ 2002-02-04 13:32 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, trt

Synopsis: The -ffast-,math option does not re-associate f.p. multiply

State-Changed-From-To: open->closed
State-Changed-By: toon
State-Changed-When: Mon Feb  4 13:32:50 2002
State-Changed-Why:
    Fixed in 3.1

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3928


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-04 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-03 11:06 optimization/3928: The -ffast-,math option does not re-associate f.p. multiply trt
2002-02-04 13:32 toon

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