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

           Summary: Extra Load immediate with zero
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: p...@pixelmetrix.com
            Target: PowerPC-eabi
             Build: 4.1.1 and 4.4.6


options : -O2 -std=gnu99

This is on 32bit PowerPC processor, when we trying to multiple add to 64bit
long long together:

     unsigned long a,b;
     unsigned long long x += a;
     unsigned long long y += b;

this produce the following code

     li   r25,0
     li   r23,0        <-----unnecessary extra load.
     addc r13,r13,r26
     adde r12,r12,r25
     addc r11,r11,r24
     adde r10,r10,r23  <-----r23, can also just use r25

The is a unnecessary load. Since r25 is already zero, it can be used for both
cases(or more).

Reply via email to