This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/16801] New: PowerPC - forward store motion opportunity


Description:
A non-optimal code sequence is illustrated.  There exists an opportunity to perform forward store motion.  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:
 .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)
	subf 9,0,9
	std 9,0(11) <-- candidate for forward store motion out of the loop.
	lwz 0,0(9)
	cmpwi 7,0,0
	beq+ 7,.L4
	blr



-- 
           Summary: PowerPC - forward store motion 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=16801


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]