public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: fshvaige@cisco.com
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: optimization/6990: -O do better optimization than -O3/-O2/-Os on jump-to-jump for PowerPC
Date: Thu, 13 Jun 2002 08:46:00 -0000	[thread overview]
Message-ID: <20020613154603.12216.qmail@sources.redhat.com> (raw)

The following reply was made to PR optimization/6990; it has been noted by GNATS.

From: fshvaige@cisco.com
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/6990: -O do better optimization than -O3/-O2/-Os on jump-to-jump for PowerPC
Date: 11 Jun 2002 11:58:49 -0000

 >Number:         6990
 >Category:       optimization
 >Synopsis:       -O do better optimization than -O3/-O2/-Os on jump-to-jump for PowerPC
 >Confidential:   no
 >Severity:       non-critical
 >Priority:       medium
 >Responsible:    unassigned
 >State:          open
 >Class:          pessimizes-code
 >Submitter-Id:   net
 >Arrival-Date:   Tue Jun 11 05:06:01 PDT 2002
 >Closed-Date:
 >Last-Modified:
 >Originator:     fshvaige@cisco.com
 >Release:        3.1 20020510
 >Organization:
 >Environment:
 --with-gcc-version-trigger=/home/install/gcc-3.1-20020510/gcc/version.c --host=i686-pc-linux-gnu --with-newlib --enable-target-optspace --target=ppc-eabi --prefix=/home/crossGCC/ppc-eabi --with-local-prefix=/home/crossGCC/ppc-eabi --program-prefix=ppc-eabi- --enable-languages=c,c++ -v --norecursion
 >Description:
 File memmove.c with function memmove():
 
 void *memmove (void *dst, const void *src, unsigned n) {
   void * tmp = dst;
   char * d = (char*)dst;
   char * s = (char*)src;
   if (n) { 
     if (d > s) {
       d += n;           
       s += n;           
       l1: //do-while loop bug in gcc 3.1 #6984
         * --d = * --s;          
       if (--n) goto l1; 
     } else {    
       --d;              
       --s;              
       l2: //do-while loop bug in gcc 3.1 #6984
         * ++d = * ++s;          
       if (--n) goto l2; 
     }           
   }     
   return tmp;
 }
 
 Compilation with -O produces code:
 
 memmove:
   mtctr 5
   cmpwi 0,5,0 
   beqlr- 0
   cmplw 0,3,4 
   ble- 0,.L3 
   add 9,3,5 
   add 4,4,5 
 .L4:
   lbzu 0,-1(4)
   stbu 0,-1(9)
   bdnz .L4
   blr   
 .L3:
   addi 9,3,-1
   addi 4,4,-1
 .L7:
   lbzu 0,1(4)
   stbu 0,1(9)
   bdnz .L7
   blr
 
 Compilation with -O3 produces code:
 
 memmove:
   cmpwi 0,5,0 
   mtctr 5
   beqlr- 0
   cmplw 0,3,4 
   ble- 0,.L3 
   add 9,3,5 
   add 4,4,5 
 .L4:
   lbzu 5,-1(4)
   stbu 5,-1(9)
   bdnz .L4
 .L2:
   blr   
 .L3:
   addi 9,3,-1
   addi 4,4,-1
 .L7:
   lbzu 5,1(4)
   stbu 5,1(9)
   bdnz .L7
   b .L2 
 
 Note last instruction 'b .L2' - it is jump to another jump 'blr' after label '.L2'.
 -O managed to produce 'blr' for last instruction.
 >How-To-Repeat:
 Command lines looks like:
 ppc-eabi-gcc -S -O memmove.c -Wall
 ppc-eabi-gcc -S -O3 memmove.c -Wall
 >Fix:
 
 >Release-Note:
 >Audit-Trail:
 >Unformatted:


             reply	other threads:[~2002-06-13 15:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-13  8:46 fshvaige [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-10 13:31 dje
2002-06-11  5:06 fshvaige

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020613154603.12216.qmail@sources.redhat.com \
    --to=fshvaige@cisco.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).