public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16799] New: PowerPC - load reuse opportunity
@ 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:36 ` [Bug target/16799] " bangerth at dealii dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-28 17:01 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal code sequence is illustrated.  There exists an opportunity to reuse a value loaded in a loop and avoid reloading it on a subsequent iteration of the loop.  Duplicate using gcc 3.5 and command line:

gcc -O3 -m64 -c test.c

Testcase:
typedef struct {
    unsigned int e;
} str;
char *q;

void foo (char *p) {

  while (1) {
    q = p - ((str *)p)->e;
    if (((str *)q)->e) break;
    p = q;
  }

}

Assembly:
 On entry to the loop body, the first "lwz 0,0(9)" is reloading the value already loaded into gpr0 by the peeled iteration of the loop.  On subsequent iterations of the loop, the value has already been loaded by the second lwz on the previous iteration.  Thus, the first lwz is unnecessary.

.foo:
	lwz 0,0(3)
	ld 11,.LC0@toc(2)
	subf 3,0,3
	std 3,0(11)
	lwz 0,0(3)
	cmpwi 7,0,0
	bnelr- 7
	mr 9,3
.L4:
	lwz 0,0(9)  <-- Unnecessary, value is already in gpr 0.
	subf 9,0,9
	std 9,0(11)
	lwz 0,0(9)
	cmpwi 7,0,0
	beq+ 7,.L4
	blr



-- 
           Summary: PowerPC - load reuse opportunity
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: other
        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=16799


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

* [Bug target/16799] PowerPC - load reuse opportunity
  2004-07-28 17:01 [Bug other/16799] New: PowerPC - load reuse opportunity gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-28 17:36 ` bangerth at dealii dot org
  2004-07-28 18:37 ` [Bug tree-optimization/16799] " falk at debian dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28 17:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|other                       |target


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


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

* [Bug tree-optimization/16799] PowerPC - load reuse opportunity
  2004-07-28 17:01 [Bug other/16799] New: PowerPC - load reuse opportunity gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:36 ` [Bug target/16799] " bangerth at dealii dot org
@ 2004-07-28 18:37 ` falk at debian dot org
  2004-07-29  4:58 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2004-07-28 18:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2004-07-28 18:37 -------
Same thing happens on Alpha, so this is not a target bug.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|target                      |tree-optimization
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization


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


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

* [Bug tree-optimization/16799] PowerPC - load reuse opportunity
  2004-07-28 17:01 [Bug other/16799] New: PowerPC - load reuse opportunity gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:36 ` [Bug target/16799] " bangerth at dealii dot org
  2004-07-28 18:37 ` [Bug tree-optimization/16799] " falk at debian dot org
@ 2004-07-29  4:58 ` pinskia at gcc dot gnu dot org
  2004-10-28  4:28 ` pinskia at gcc dot gnu dot org
  2004-10-28  4:33 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-29  4:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-29 04:58 -------
hmm, this seems like a case where -fmodulo-sched should catch but does not.

-- 


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


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

* [Bug tree-optimization/16799] PowerPC - load reuse opportunity
  2004-07-28 17:01 [Bug other/16799] New: PowerPC - load reuse opportunity gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-07-29  4:58 ` pinskia at gcc dot gnu dot org
@ 2004-10-28  4:28 ` pinskia at gcc dot gnu dot org
  2004-10-28  4:33 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28  4:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-28 04:27 -------
Fixed on the mainline (note this is powerp64-darwin but should represent  powerpc64-linux closely):
_foo:
        lwz r0,0(r3)
        .align32 4,0x60000000
L2:
        subf r9,r0,r3
        lwz r0,0(r9)
        mr r3,r9
        cmpdi cr7,r0,0
        beq cr7,L2
        lis r2,ha16(L_q$non_lazy_ptr)
        ld r2,lo16(L_q$non_lazy_ptr)(r2)
        std r9,0(r2)
        blr
.comm _q,8

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug tree-optimization/16799] PowerPC - load reuse opportunity
  2004-07-28 17:01 [Bug other/16799] New: PowerPC - load reuse opportunity gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-10-28  4:28 ` pinskia at gcc dot gnu dot org
@ 2004-10-28  4:33 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28  4:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2004-10-28  4:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 17:01 [Bug other/16799] New: PowerPC - load reuse opportunity gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:36 ` [Bug target/16799] " bangerth at dealii dot org
2004-07-28 18:37 ` [Bug tree-optimization/16799] " falk at debian dot org
2004-07-29  4:58 ` pinskia at gcc dot gnu dot org
2004-10-28  4:28 ` pinskia at gcc dot gnu dot org
2004-10-28  4:33 ` 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).