public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug regression/16456] New: PowerPC - redundant subtract involving pointer types @ 2004-07-09 18:05 gcc-bugzilla at gcc dot gnu dot org 2004-07-09 18:57 ` [Bug other/16456] " pinskia at gcc dot gnu dot org ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-09 18:05 UTC (permalink / raw) To: gcc-bugs Description: A non-optimal code sequence is illustrated. Two subtract operations are done where only one is necessary. Duplicate using gcc 3.5 and command line: gcc -O3 -m64 -c test.c Testcase: char * ptr1; char * ptr2; int x; long int y; void foo () { x = ptr1 - ptr2; y = ptr1 - ptr2; } Assembly: ld 9,.LC0@toc(2) ld 11,.LC1@toc(2) ld 0,0(9) ld 10,0(11) ld 8,.LC3@toc(2) subf 11,10,0 ld 9,.LC2@toc(2) subf 0,10,0 -- no need to do this subtract, just use the previous result. std 11,0(8) stw 0,0(9) blr -- Summary: PowerPC - redundant subtract involving pointer types Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: enhancement Priority: P1 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: steinmtz at us dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm dot com GCC build triplet: powerpc64-linux GCC host triplet: powerpc64-linux GCC target triplet: powerpc64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug other/16456] PowerPC - redundant subtract involving pointer types 2004-07-09 18:05 [Bug regression/16456] New: PowerPC - redundant subtract involving pointer types gcc-bugzilla at gcc dot gnu dot org @ 2004-07-09 18:57 ` pinskia at gcc dot gnu dot org 2004-07-09 19:15 ` [Bug rtl-optimization/16456] " pinskia at gcc dot gnu dot org 2004-11-03 11:20 ` nathan at gcc dot gnu dot org 2 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-07-09 18:57 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Component|regression |other Keywords| |missed-optimization http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types 2004-07-09 18:05 [Bug regression/16456] New: PowerPC - redundant subtract involving pointer types gcc-bugzilla at gcc dot gnu dot org 2004-07-09 18:57 ` [Bug other/16456] " pinskia at gcc dot gnu dot org @ 2004-07-09 19:15 ` pinskia at gcc dot gnu dot org 2004-11-03 11:20 ` nathan at gcc dot gnu dot org 2 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-07-09 19:15 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-09 19:15 ------- Confirmed, the problem is they are different modes. (set (reg:SI 124) (minus:SI (subreg:SI (reg:DI 119 [ ptr1.1 ]) 4) (subreg:SI (reg:DI 120 [ ptr2.4 ]) 4))) (set (reg:DI 126) (minus:DI (reg:DI 119 [ ptr1.1 ]) (reg:DI 120 [ ptr2.4 ]))) -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|other |rtl-optimization Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2004-07-09 19:15:24 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types 2004-07-09 18:05 [Bug regression/16456] New: PowerPC - redundant subtract involving pointer types gcc-bugzilla at gcc dot gnu dot org 2004-07-09 18:57 ` [Bug other/16456] " pinskia at gcc dot gnu dot org 2004-07-09 19:15 ` [Bug rtl-optimization/16456] " pinskia at gcc dot gnu dot org @ 2004-11-03 11:20 ` nathan at gcc dot gnu dot org 2 siblings, 0 replies; 7+ messages in thread From: nathan at gcc dot gnu dot org @ 2004-11-03 11:20 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-03 11:20 ------- What is happening is that convert_to_integer, which is used to convert the subtraction result to the type of 'x', reassociates the cast from (int)((long)ptr1 - (long)ptr2) to (int)ptr1 - (int)ptr2 As it thinks that's a win. Unfortunately this stops CSE noticing that the later subtraction is actually the same. This is another example of premature tree optimization, and it should be addressed in the reworking of fold itself. I don't think this should be attempted at stage 3 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <bug-16456-8614@http.gcc.gnu.org/bugzilla/>]
* [Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types [not found] <bug-16456-8614@http.gcc.gnu.org/bugzilla/> @ 2005-11-02 17:16 ` pinskia at gcc dot gnu dot org 2006-10-22 23:13 ` pinskia at gcc dot gnu dot org 2009-05-14 3:00 ` bje at gcc dot gnu dot org 2 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-11-02 17:16 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from pinskia at gcc dot gnu dot org 2005-11-02 17:16 ------- All P1 enhancements not targeted towards 4.1, moving to P5. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types [not found] <bug-16456-8614@http.gcc.gnu.org/bugzilla/> 2005-11-02 17:16 ` pinskia at gcc dot gnu dot org @ 2006-10-22 23:13 ` pinskia at gcc dot gnu dot org 2009-05-14 3:00 ` bje at gcc dot gnu dot org 2 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-10-22 23:13 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from pinskia at gcc dot gnu dot org 2006-10-22 23:13 ------- (In reply to comment #2) > This is another example of premature tree optimization, and it should be addressed > in the reworking of fold itself. I don't think this should be attempted at stage 3 First off, fold is not doing this but instead convert.c :). Second I don't think this is premature tree optim but instead just something RTL level should catch. People can write code like what the tree level gives us so it is not a question of premature tree opt but rather how to catch it on the RTL level. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2006-03-11 06:24:57 |2006-10-22 23:13:17 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types [not found] <bug-16456-8614@http.gcc.gnu.org/bugzilla/> 2005-11-02 17:16 ` pinskia at gcc dot gnu dot org 2006-10-22 23:13 ` pinskia at gcc dot gnu dot org @ 2009-05-14 3:00 ` bje at gcc dot gnu dot org 2 siblings, 0 replies; 7+ messages in thread From: bje at gcc dot gnu dot org @ 2009-05-14 3:00 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from bje at gcc dot gnu dot org 2009-05-14 03:00 ------- Still present in GCC 4.5.0 (20090513). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-05-14 3:00 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-07-09 18:05 [Bug regression/16456] New: PowerPC - redundant subtract involving pointer types gcc-bugzilla at gcc dot gnu dot org 2004-07-09 18:57 ` [Bug other/16456] " pinskia at gcc dot gnu dot org 2004-07-09 19:15 ` [Bug rtl-optimization/16456] " pinskia at gcc dot gnu dot org 2004-11-03 11:20 ` nathan at gcc dot gnu dot org [not found] <bug-16456-8614@http.gcc.gnu.org/bugzilla/> 2005-11-02 17:16 ` pinskia at gcc dot gnu dot org 2006-10-22 23:13 ` pinskia at gcc dot gnu dot org 2009-05-14 3:00 ` bje 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).