public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anton at samba dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/14473] New: Failure to use count register
Date: Mon, 08 Mar 2004 02:13:00 -0000	[thread overview]
Message-ID: <20040308021331.14473.anton@samba.org> (raw)

I found this in ppc32 3.3.3 (Debian), it also appears in 3.4.0 20040215.

If the loop count is large enough, it wont use the count register in the second
loop. eg:

#if 1
#define LOOPS 100000
#else
#define LOOPS 10
#endif
                                                                                
int main()
{
        unsigned long i;
                                                                                
        i = LOOPS;
        while (i--) {
                asm volatile("":::"memory");
        }
                                                                                
        i = LOOPS;
        while (i--) {
                asm volatile("":::"memory");
        }
}

produces the following code:

        lis 0,0x1
        ori 0,0,34464
        mtctr 0
.L13:
        bdnz .L13
        lis 0,0x1
        ori 0,0,34464
.L12:
        addic. 0,0,-1
        bne+ 0,.L12
        blr

If you reduce COUNT it will use the count register for both loops as expected

-- 
           Summary: Failure to use count register
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-unknown-linux-gnu


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


             reply	other threads:[~2004-03-08  2:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08  2:13 anton at samba dot org [this message]
2004-03-08  2:21 ` [Bug optimization/14473] " pinskia at gcc dot gnu dot org
2004-03-08  5:52 ` amodra at bigpond dot net dot au
2004-06-04  5:52 ` [Bug rtl-optimization/14473] " pinskia at gcc dot gnu dot org

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=20040308021331.14473.anton@samba.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).