public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/5739] [sparc] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
@ 2003-05-27 14:27 ` pinskia@physics.uc.edu
2003-06-08 16:50 ` pinskia@physics.uc.edu
` (7 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: pinskia@physics.uc.edu @ 2003-05-27 14:27 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-05-27 13:35:05
date| |
------- Additional Comments From pinskia@physics.uc.edu 2003-05-27 13:35 -------
See comments.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/5739] [sparc] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
2003-05-27 14:27 ` [Bug optimization/5739] [sparc] "const" and "pure" function attributes pessimize code pinskia@physics.uc.edu
@ 2003-06-08 16:50 ` pinskia@physics.uc.edu
2003-06-17 22:34 ` [Bug optimization/5739] " dann at godzilla dot ics dot uci dot edu
` (6 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-08 16:50 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-05-27 13:35:05 |2003-06-08 16:50:54
date| |
------- Additional Comments From pinskia@physics.uc.edu 2003-06-08 16:50 -------
I can still confirm this on the mainline (20030608).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
2003-05-27 14:27 ` [Bug optimization/5739] [sparc] "const" and "pure" function attributes pessimize code pinskia@physics.uc.edu
2003-06-08 16:50 ` pinskia@physics.uc.edu
@ 2003-06-17 22:34 ` dann at godzilla dot ics dot uci dot edu
2003-06-17 23:14 ` pinskia at physics dot uc dot edu
` (5 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2003-06-17 22:34 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
dann@godzilla.ics.uci.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[sparc] "const" and "pure" |"const" and "pure" function
|function attributes |attributes pessimize code
|pessimize code |
------- Additional Comments From dann@godzilla.ics.uci.edu 2003-06-17 22:34 -------
Delete [sparc] from summary, it occurs on other platforms too.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
` (2 preceding siblings ...)
2003-06-17 22:34 ` [Bug optimization/5739] " dann at godzilla dot ics dot uci dot edu
@ 2003-06-17 23:14 ` pinskia at physics dot uc dot edu
2004-05-23 22:13 ` [Bug rtl-optimization/5739] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-06-17 23:14 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |3.3
------- Additional Comments From pinskia@physics.uc.edu 2003-06-17 23:14 -------
Reported against when 3.3 was 3.2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
` (3 preceding siblings ...)
2003-06-17 23:14 ` pinskia at physics dot uc dot edu
@ 2004-05-23 22:13 ` pinskia at gcc dot gnu dot org
2004-05-28 17:17 ` dann at godzilla dot ics dot uci dot edu
` (3 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-23 22:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-22 23:08 -------
Note on the mainline now the loops are empty which is correct.
This testcase will produce code but I cannot reproduce this on PPC or on x86:
#ifdef MY_PURE
extern double mycos (double) __attribute__ ((pure));
extern double mysin (double) __attribute__ ((pure));
#elif defined MY_CONST
extern double mycos (double) __attribute__ ((const));
extern double mysin (double) __attribute__ ((const));
#else
extern double mycos (double);
extern double mysin (double);
#endif
struct my_complex
{
double re;
double im;
};
int main(void) {
struct my_complex u[2048];
int i;
for (i = 0; i < 2048; ++i)
{
u[i].re = 1.0;
u[i].im = 0.0;
}
for (i = 0; i < 2048; ++i) {
struct my_complex *p = u;
unsigned int j;
for (j = 0; j < 2048; ++j) {
double ur = p->re;
double ui = p->im;
double u2 = ur * ur + ui * ui;
double cosv = mycos (u2);
double sinv = mysin (u2);
p->re = p->re * cosv - p->im * sinv;
p->im = p->im * sinv + p->re * cosv;
++p;
}
}
for (i = 0; i < 2048; ++i) {
f(u[i]);
}
}
Does this still happen on SPARC also?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
` (4 preceding siblings ...)
2004-05-23 22:13 ` [Bug rtl-optimization/5739] " pinskia at gcc dot gnu dot org
@ 2004-05-28 17:17 ` dann at godzilla dot ics dot uci dot edu
2004-05-28 17:27 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-05-28 17:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dann at godzilla dot ics dot uci dot edu 2004-05-27 22:59 -------
(In reply to comment #7)
> Note on the mainline now the loops are empty which is correct.
> This testcase will produce code but I cannot reproduce this on PPC or on x86:
[snip]
> Does this still happen on SPARC also?
Not with this example, tree-ssa is too smart and sees almost everything as dead
code, here is a slightly modified one:
#ifdef MY_PURE
extern double mycos (double) __attribute__ ((pure));
extern double mysin (double) __attribute__ ((pure));
#elif defined MY_CONST
extern double mycos (double) __attribute__ ((const));
extern double mysin (double) __attribute__ ((const));
#else
extern double mycos (double);
extern double mysin (double);
#endif
struct my_complex
{
double re;
double im;
};
void
foo (struct my_complex u[])
{
int i;
for (i = 0; i < 2048; ++i)
{
u[i].re = 1.0;
u[i].im = 0.0;
}
for (i = 0; i < 2048; ++i) {
struct my_complex *p = u;
unsigned int j;
for (j = 0; j < 2048; ++j) {
double ur = p->re;
double ui = p->im;
double u2 = ur * ur + ui * ui;
double cosv = mycos (u2);
double sinv = mysin (u2);
p->re = p->re * cosv - p->im * sinv;
p->im = p->im * sinv + p->re * cosv;
++p;
}
}
}
the difference between the MY_CONST/PURE code and the one without is smaller,
but it _still_ exists, the MY_CONST/PURE code has 2 extra stores.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
` (5 preceding siblings ...)
2004-05-28 17:17 ` dann at godzilla dot ics dot uci dot edu
@ 2004-05-28 17:27 ` pinskia at gcc dot gnu dot org
2004-08-26 0:38 ` pinskia at gcc dot gnu dot org
2005-01-20 2:17 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-28 17:27 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Last reconfirmed|2003-11-23 07:51:34 |2004-05-27 23:04:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
` (6 preceding siblings ...)
2004-05-28 17:27 ` pinskia at gcc dot gnu dot org
@ 2004-08-26 0:38 ` pinskia at gcc dot gnu dot org
2005-01-20 2:17 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-26 0:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-26 00:38 -------
I understand what is going on now:
double ur = p->re;
double ui = p->im;
double u2 = ur * ur + ui * ui;
double cosv = mycos (u2);
double sinv = mysin (u2);
p->re = p->re * cosv - p->im * sinv; <--- here we actually do not load again from p->re but
rather use ur which makes we store on the stack (or keep in register for targets with more than a few FP
registers like PPC, in which case this works correctly :) ).
So this is really only happens on x86
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-05-27 23:04:12 |2004-08-26 00:38:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/5739] "const" and "pure" function attributes pessimize code
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
` (7 preceding siblings ...)
2004-08-26 0:38 ` pinskia at gcc dot gnu dot org
@ 2005-01-20 2:17 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-20 2:17 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ra
Last reconfirmed|2004-08-26 00:38:25 |2005-01-20 02:17:01
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-01-20 2:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20020220141600.5739.dann@godzilla.ics.uci.edu>
2003-05-27 14:27 ` [Bug optimization/5739] [sparc] "const" and "pure" function attributes pessimize code pinskia@physics.uc.edu
2003-06-08 16:50 ` pinskia@physics.uc.edu
2003-06-17 22:34 ` [Bug optimization/5739] " dann at godzilla dot ics dot uci dot edu
2003-06-17 23:14 ` pinskia at physics dot uc dot edu
2004-05-23 22:13 ` [Bug rtl-optimization/5739] " pinskia at gcc dot gnu dot org
2004-05-28 17:17 ` dann at godzilla dot ics dot uci dot edu
2004-05-28 17:27 ` pinskia at gcc dot gnu dot org
2004-08-26 0:38 ` pinskia at gcc dot gnu dot org
2005-01-20 2:17 ` 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).