public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23452] New: Optimizing CONJG_EXPR (a) * a
@ 2005-08-18 7:26 tkoenig at gcc dot gnu dot org
2005-08-18 23:51 ` [Bug tree-optimization/23452] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-08-18 7:26 UTC (permalink / raw)
To: gcc-bugs
$ cat conj.f
program main
complex c1,c2
call foo(c1)
c2 = c1 * conjg(c1)
call bar(c2)
end
This is translated into a CONJ_EXPR:
foo (&c1);
c2 = CONJ_EXPR <c1> * c1;
bar (&c2);
The .optimized dump shows:
foo (&c1);
CR.11 = REALPART_EXPR <c1>;
CI.12 = IMAGPART_EXPR <c1>;
CI.13 = -CI.12;
REALPART_EXPR <c2> = CR.11 * CR.11 - CI.12 * CI.13;
IMAGPART_EXPR <c2> = CR.11 * CI.13 + CR.11 * CI.12;
bar (&c2);
return;
This could be simplified to
REALPART_EXPR <c2> = CR.11 * CR.11 + CR.12 * CR.12;
IMAGPART_EXPR <c2> = 0;
--
Summary: Optimizing CONJG_EXPR (a) * a
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23452
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23452] Optimizing CONJG_EXPR (a) * a
2005-08-18 7:26 [Bug tree-optimization/23452] New: Optimizing CONJG_EXPR (a) * a tkoenig at gcc dot gnu dot org
@ 2005-08-18 23:51 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-18 23:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-18 23:33 -------
Confirmed, there are two ways of fixing this, one in fold which folds CONJ_EXPR<a>*a, the other way is
to do it later on via somthing like like a combiner or even in complex exand.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-08-18 23:33:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23452
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23452] Optimizing CONJG_EXPR (a) * a
[not found] <bug-23452-10391@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2006-06-01 19:13 ` tkoenig at gcc dot gnu dot org
@ 2006-11-01 4:31 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-01 4:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-11-01 04:30 -------
(In reply to comment #3)
> This is now fixed on mainline provided the user specifies -ffast-math.
> There are some complications where imagpart(z*~z) can be non-zero, if
> imagpart(z) is non-finite, such as an Inf or a NaN. It's unclear from
> the fortran-95 standard whether gfortran is allowed to optimize this
> even without -ffast-math.
Well Fortran 95 does not have non-finite except with a TR and the IEEE fp
types, I forgot the number and the name
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23452
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23452] Optimizing CONJG_EXPR (a) * a
[not found] <bug-23452-10391@http.gcc.gnu.org/bugzilla/>
2006-05-30 21:34 ` sayle at gcc dot gnu dot org
2006-06-01 2:41 ` roger at eyesopen dot com
@ 2006-06-01 19:13 ` tkoenig at gcc dot gnu dot org
2006-11-01 4:31 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-06-01 19:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from tkoenig at gcc dot gnu dot org 2006-06-01 19:13 -------
(In reply to comment #3)
> This is now fixed on mainline provided the user specifies -ffast-math.
> There are some complications where imagpart(z*~z) can be non-zero, if
> imagpart(z) is non-finite, such as an Inf or a NaN. It's unclear from
> the fortran-95 standard whether gfortran is allowed to optimize this
> even without -ffast-math.
I'll ask con comp.lang.fortran :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23452
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23452] Optimizing CONJG_EXPR (a) * a
[not found] <bug-23452-10391@http.gcc.gnu.org/bugzilla/>
2006-05-30 21:34 ` sayle at gcc dot gnu dot org
@ 2006-06-01 2:41 ` roger at eyesopen dot com
2006-06-01 19:13 ` tkoenig at gcc dot gnu dot org
2006-11-01 4:31 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: roger at eyesopen dot com @ 2006-06-01 2:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from roger at eyesopen dot com 2006-06-01 02:41 -------
This is now fixed on mainline provided the user specifies -ffast-math.
There are some complications where imagpart(z*~z) can be non-zero, if
imagpart(z) is non-finite, such as an Inf or a NaN. It's unclear from
the fortran-95 standard whether gfortran is allowed to optimize this
even without -ffast-math.
--
roger at eyesopen dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23452
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23452] Optimizing CONJG_EXPR (a) * a
[not found] <bug-23452-10391@http.gcc.gnu.org/bugzilla/>
@ 2006-05-30 21:34 ` sayle at gcc dot gnu dot org
2006-06-01 2:41 ` roger at eyesopen dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: sayle at gcc dot gnu dot org @ 2006-05-30 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from sayle at gcc dot gnu dot org 2006-05-30 21:34 -------
Subject: Bug 23452
Author: sayle
Date: Tue May 30 21:34:04 2006
New Revision: 114246
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114246
Log:
PR tree-optimization/23452
* fold-const.c (fold_mult_zconjz): New subroutine of fold_binary,
to optimize z * conj(z) as realpart(z)^2 + imagpart(z)^2.
(fold_binary) <MULT_EXPR>: Call fold_mult_zconjz for integral
complex values and with -ffast-math for FP complex values.
* gcc.dg/fold-mulconj-1.c: New test case.
Added:
trunk/gcc/testsuite/gcc.dg/fold-mulconj-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23452
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-11-01 4:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-18 7:26 [Bug tree-optimization/23452] New: Optimizing CONJG_EXPR (a) * a tkoenig at gcc dot gnu dot org
2005-08-18 23:51 ` [Bug tree-optimization/23452] " pinskia at gcc dot gnu dot org
[not found] <bug-23452-10391@http.gcc.gnu.org/bugzilla/>
2006-05-30 21:34 ` sayle at gcc dot gnu dot org
2006-06-01 2:41 ` roger at eyesopen dot com
2006-06-01 19:13 ` tkoenig at gcc dot gnu dot org
2006-11-01 4:31 ` pinskia at gcc dot gnu dot 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).