public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases
@ 2008-09-09 22:04 pinskia at gcc dot gnu dot org
2008-09-09 22:05 ` [Bug rtl-optimization/37451] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-09 22:04 UTC (permalink / raw)
To: gcc-bugs
Simple testcase:
/* { dg-do compile } */
/* { dg-options "-O2" } */
int f(int l, int *a)
{
int i;
for(i = 0;i < l; i++)
a[i] = i;
return l;
}
/* We should be able to do this loop without adding -1 to the l
to get the number of iterations with this loop still doing a do-loop. */
/* The place where we were getting an extra -1 is when converting from 32bits
to 64bits as the ctr register is used as 64bits on powerpc64. */
/* { dg-final { scan-assembler-not "-1" } } */
/* { dg-final { scan-assembler "bdnz" } } */
/* { dg-final { scan-assembler-times "mtctr" 1 } } */
---- CUT ---
The issue is that we zero extend before correcting the count of the iterations.
--
Summary: Extra addition for doloop in some cases
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
@ 2008-09-09 22:05 ` pinskia at gcc dot gnu dot org
2008-09-15 1:16 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-09 22:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-09-09 22:03 -------
I have a fix which I will try to submit for 4.5, I will attach it soon.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-09-09 22:03:49
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
2008-09-09 22:05 ` [Bug rtl-optimization/37451] " pinskia at gcc dot gnu dot org
@ 2008-09-15 1:16 ` pinskia at gcc dot gnu dot org
2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-15 1:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-09-15 01:15 -------
Hmm, I posted a patch which fixes some of this but we still don't get rid of
the extra zero extend because of the way variables are promoted. Boo.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
2008-09-09 22:05 ` [Bug rtl-optimization/37451] " pinskia at gcc dot gnu dot org
2008-09-15 1:16 ` pinskia at gcc dot gnu dot org
@ 2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-18 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-09-18 19:30 -------
Subject: Bug 37451
Author: pinskia
Date: Thu Sep 18 19:28:48 2008
New Revision: 140470
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140470
Log:
2008-09-18 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37451
* loop-doloop.c (doloop_modify): New argument zero_extend_p and
zero extend count after the correction to it is done.
(doloop_optimize): Update call to doloop_modify, don't zero extend
count before call.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/loop-doloop.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
@ 2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
2008-09-29 14:53 ` schwab at suse dot de
2009-04-16 15:48 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-18 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2008-09-18 19:30 -------
This is still not fully fixed. There is still an issue dealing the DECL_RTX's
being promoted early on.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
@ 2008-09-29 14:53 ` schwab at suse dot de
2009-04-16 15:48 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 13+ messages in thread
From: schwab at suse dot de @ 2008-09-29 14:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from schwab at suse dot de 2008-09-29 14:52 -------
This is causing miscompilation of the stage2 ada compiler.
fatal error: system.ads is incorrectly formatted
unrecognized or incorrect restrictions pragma: No_Implicit_Dynamic_Code
compilation abandoned
make[3]: *** [ada/ada.o] Error 1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-09-29 14:53 ` schwab at suse dot de
@ 2009-04-16 15:48 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 15:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2009-04-16 15:48 -------
I am no longer working on this one.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-05-15 3:31 ` luoxhu at gcc dot gnu.org
@ 2020-05-15 3:49 ` luoxhu at gcc dot gnu.org
5 siblings, 0 replies; 13+ messages in thread
From: luoxhu at gcc dot gnu.org @ 2020-05-15 3:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
luoxhu at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #12 from luoxhu at gcc dot gnu.org ---
Close this.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-05-15 3:27 ` cvs-commit at gcc dot gnu.org
@ 2020-05-15 3:31 ` luoxhu at gcc dot gnu.org
2020-05-15 3:49 ` luoxhu at gcc dot gnu.org
5 siblings, 0 replies; 13+ messages in thread
From: luoxhu at gcc dot gnu.org @ 2020-05-15 3:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
--- Comment #11 from luoxhu at gcc dot gnu.org ---
fixed on master.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2012-01-10 23:54 ` jsm28 at gcc dot gnu.org
@ 2020-05-15 3:27 ` cvs-commit at gcc dot gnu.org
2020-05-15 3:31 ` luoxhu at gcc dot gnu.org
2020-05-15 3:49 ` luoxhu at gcc dot gnu.org
5 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-15 3:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Xiong Hu Luo <luoxhu@gcc.gnu.org>:
https://gcc.gnu.org/g:8a15faa730f99100f6f3ed12663563356ec5a2c0
commit r11-407-g8a15faa730f99100f6f3ed12663563356ec5a2c0
Author: Xionghu Luo <luoxhu@linux.ibm.com>
Date: Thu May 14 21:03:24 2020 -0500
Fold (add -1; zero_ext; add +1) operations to zero_ext when not
overflow(PR37451, PR61837)
This "subtract/extend/add" existed for a long time and still annoying us
(PR37451, part of PR61837) when converting from 32bits to 64bits, as the
ctr
register is used as 64bits on powerpc64, Andraw Pinski had a patch but
caused some issue and reverted by Joseph S. Myers(PR37451, PR37782).
Andraw:
http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01070.html
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg01321.html
Joseph:
https://gcc.gnu.org/legacy-ml/gcc-patches/2011-11/msg02405.html
We still can do the simplification from "subtract/zero_ext/add" to
"zero_ext"
when loop iterations is known to be LT than MODE_MAX (only do simplify
when counter+0x1 NOT overflow).
Bootstrap and regression tested pass on Power8-LE.
gcc/ChangeLog
2020-05-15 Xiong Hu Luo <luoxhu@linux.ibm.com>
PR rtl-optimization/37451, part of PR target/61837
* loop-doloop.c (doloop_simplify_count): New function. Simplify
(add -1; zero_ext; add +1) to zero_ext when not wrapping.
(doloop_modify): Call doloop_simplify_count.
gcc/testsuite/ChangeLog
2020-05-15 Xiong Hu Luo <luoxhu@linux.ibm.com>
PR rtl-optimization/37451, part of PR target/61837
* gcc.target/powerpc/doloop-2.c: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
2011-12-02 16:55 ` jsm28 at gcc dot gnu.org
2012-01-10 16:56 ` jsm28 at gcc dot gnu.org
@ 2012-01-10 23:54 ` jsm28 at gcc dot gnu.org
2020-05-15 3:27 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-01-10 23:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
--- Comment #9 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2012-01-10 23:53:19 UTC ---
Author: jsm28
Date: Tue Jan 10 23:53:13 2012
New Revision: 183080
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183080
Log:
Revert:
2008-09-18 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37451
* loop-doloop.c (doloop_modify): New argument zero_extend_p and
zero extend count after the correction to it is done.
(doloop_optimize): Update call to doloop_modify, don't zero extend
count before call.
2008-11-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37782
* loop-doloop.c (doloop_modify): Add from_mode argument that says what
mode count is in.
(doloop_optimize): Update call to doloop_modify.
testsuite:
* gcc.c-torture/execute/doloop-1.c,
gcc.c-torture/execute/doloop-2.c: New tests.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/doloop-1.c
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/doloop-2.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/loop-doloop.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
2011-12-02 16:55 ` jsm28 at gcc dot gnu.org
@ 2012-01-10 16:56 ` jsm28 at gcc dot gnu.org
2012-01-10 23:54 ` jsm28 at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-01-10 16:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
--- Comment #8 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2012-01-10 16:55:44 UTC ---
Author: jsm28
Date: Tue Jan 10 16:55:40 2012
New Revision: 183071
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183071
Log:
Revert:
2008-09-18 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37451
* loop-doloop.c (doloop_modify): New argument zero_extend_p and
zero extend count after the correction to it is done.
(doloop_optimize): Update call to doloop_modify, don't zero extend
count before call.
2008-11-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37782
* loop-doloop.c (doloop_modify): Add from_mode argument that says what
mode count is in.
(doloop_optimize): Update call to doloop_modify.
testsuite:
* gcc.c-torture/execute/doloop-1.c,
gcc.c-torture/execute/doloop-2.c: New tests.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/execute/doloop-1.c
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/execute/doloop-2.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/loop-doloop.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/37451] Extra addition for doloop in some cases
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
@ 2011-12-02 16:55 ` jsm28 at gcc dot gnu.org
2012-01-10 16:56 ` jsm28 at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-12-02 16:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451
--- Comment #7 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-12-02 16:54:33 UTC ---
Author: jsm28
Date: Fri Dec 2 16:54:27 2011
New Revision: 181929
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181929
Log:
Revert:
2008-09-18 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37451
* loop-doloop.c (doloop_modify): New argument zero_extend_p and
zero extend count after the correction to it is done.
(doloop_optimize): Update call to doloop_modify, don't zero extend
count before call.
2008-11-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/37782
* loop-doloop.c (doloop_modify): Add from_mode argument that says what
mode count is in.
(doloop_optimize): Update call to doloop_modify.
testsuite:
* gcc.c-torture/execute/doloop-1.c,
gcc.c-torture/execute/doloop-2.c: New tests.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/doloop-1.c
trunk/gcc/testsuite/gcc.c-torture/execute/doloop-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/loop-doloop.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-05-15 3:49 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-09 22:04 [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases pinskia at gcc dot gnu dot org
2008-09-09 22:05 ` [Bug rtl-optimization/37451] " pinskia at gcc dot gnu dot org
2008-09-15 1:16 ` pinskia at gcc dot gnu dot org
2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
2008-09-18 19:31 ` pinskia at gcc dot gnu dot org
2008-09-29 14:53 ` schwab at suse dot de
2009-04-16 15:48 ` pinskia at gcc dot gnu dot org
[not found] <bug-37451-4@http.gcc.gnu.org/bugzilla/>
2011-12-02 16:55 ` jsm28 at gcc dot gnu.org
2012-01-10 16:56 ` jsm28 at gcc dot gnu.org
2012-01-10 23:54 ` jsm28 at gcc dot gnu.org
2020-05-15 3:27 ` cvs-commit at gcc dot gnu.org
2020-05-15 3:31 ` luoxhu at gcc dot gnu.org
2020-05-15 3:49 ` luoxhu 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).