public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52138] New: Operations on complex values are not inlined, even with -O3
@ 2012-02-06 18:20 gonnet at maths dot ox.ac.uk
  2012-02-06 18:26 ` [Bug c/52138] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gonnet at maths dot ox.ac.uk @ 2012-02-06 18:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52138

             Bug #: 52138
           Summary: Operations on complex values are not inlined, even
                    with -O3
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gonnet@maths.ox.ac.uk


Irrespective of the optimization level selected, multiplying or dividing two
complex doubles generates a call to __muldc3 or __divdc3 respectively.

Using the "-fcx-limited-range" flag inlines the operations, but then the range
may be limited.

Strangely enough, in the gfortran frontend, complex arithmetic is inlined even
with no optimization (-O0).


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

* [Bug c/52138] Operations on complex values are not inlined, even with -O3
  2012-02-06 18:20 [Bug c/52138] New: Operations on complex values are not inlined, even with -O3 gonnet at maths dot ox.ac.uk
@ 2012-02-06 18:26 ` jakub at gcc dot gnu.org
  2012-02-06 18:33 ` gonnet at maths dot ox.ac.uk
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-06 18:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52138

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-06 18:25:47 UTC ---
Why do you think inlining a ~ 750B long routine would be beneficial?  Note that
if one of the operands has 0 either the imaginary or real part, gcc will inline
it.


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

* [Bug c/52138] Operations on complex values are not inlined, even with -O3
  2012-02-06 18:20 [Bug c/52138] New: Operations on complex values are not inlined, even with -O3 gonnet at maths dot ox.ac.uk
  2012-02-06 18:26 ` [Bug c/52138] " jakub at gcc dot gnu.org
@ 2012-02-06 18:33 ` gonnet at maths dot ox.ac.uk
  2012-02-06 18:51 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gonnet at maths dot ox.ac.uk @ 2012-02-06 18:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52138

--- Comment #2 from Pedro <gonnet at maths dot ox.ac.uk> 2012-02-06 18:33:11 UTC ---
I'm a bit confused... In the gfortran output the multiplication only about 40
bytes. Does that mean that gfortran is using a reduced range by default?


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

* [Bug c/52138] Operations on complex values are not inlined, even with -O3
  2012-02-06 18:20 [Bug c/52138] New: Operations on complex values are not inlined, even with -O3 gonnet at maths dot ox.ac.uk
  2012-02-06 18:26 ` [Bug c/52138] " jakub at gcc dot gnu.org
  2012-02-06 18:33 ` gonnet at maths dot ox.ac.uk
@ 2012-02-06 18:51 ` kargl at gcc dot gnu.org
  2012-02-06 18:58 ` dominiq at lps dot ens.fr
  2012-02-06 19:29 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-02-06 18:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52138

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org 2012-02-06 18:50:41 UTC ---
(In reply to comment #2)
> I'm a bit confused... In the gfortran output the multiplication only about 40
> bytes. Does that mean that gfortran is using a reduced range by default?

>From gcc/toplev.c

  /* With -fcx-limited-range, we do cheap and quick complex arithmetic.  */
  if (flag_cx_limited_range)
    flag_complex_method = 0;

  /* With -fcx-fortran-rules, we do something in-between cheap and C99.  */
  if (flag_cx_fortran_rules)
    flag_complex_method = 1;

So, yes, gfortran does something different than gcc.


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

* [Bug c/52138] Operations on complex values are not inlined, even with -O3
  2012-02-06 18:20 [Bug c/52138] New: Operations on complex values are not inlined, even with -O3 gonnet at maths dot ox.ac.uk
                   ` (2 preceding siblings ...)
  2012-02-06 18:51 ` kargl at gcc dot gnu.org
@ 2012-02-06 18:58 ` dominiq at lps dot ens.fr
  2012-02-06 19:29 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-02-06 18:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52138

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-02-06 18:58:00 UTC ---
>From the manual:

-fcx-limited-range
When enabled, this option states that a range reduction step is not needed when
performing complex division. Also, there is no checking whether the result of a
complex multiplication or division is NaN + I*NaN, with an attempt to rescue
the situation in that case. The default is -fno-cx-limited-range, but is
enabled by -ffast-math.
This option controls the default setting of the ISO C99 CX_LIMITED_RANGE
pragma. Nevertheless, the option applies to all languages. 

-fcx-fortran-rules
Complex multiplication and division follow Fortran rules. Range reduction is
done as part of complex division, but there is no checking whether the result
of a complex multiplication or division is NaN + I*NaN, with an attempt to
rescue the situation in that case.
The default is -fno-cx-fortran-rules.


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

* [Bug c/52138] Operations on complex values are not inlined, even with -O3
  2012-02-06 18:20 [Bug c/52138] New: Operations on complex values are not inlined, even with -O3 gonnet at maths dot ox.ac.uk
                   ` (3 preceding siblings ...)
  2012-02-06 18:58 ` dominiq at lps dot ens.fr
@ 2012-02-06 19:29 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-06 19:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52138

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-06 19:28:41 UTC ---
This is invalid as mentioned above.


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

end of thread, other threads:[~2012-02-06 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-06 18:20 [Bug c/52138] New: Operations on complex values are not inlined, even with -O3 gonnet at maths dot ox.ac.uk
2012-02-06 18:26 ` [Bug c/52138] " jakub at gcc dot gnu.org
2012-02-06 18:33 ` gonnet at maths dot ox.ac.uk
2012-02-06 18:51 ` kargl at gcc dot gnu.org
2012-02-06 18:58 ` dominiq at lps dot ens.fr
2012-02-06 19:29 ` pinskia at gcc dot gnu.org

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