public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bergner at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/35371]  New: Missing REG_POINTER attribute causes bad indexed load/store operand ordering
Date: Mon, 25 Feb 2008 20:05:00 -0000	[thread overview]
Message-ID: <bug-35371-11700@http.gcc.gnu.org/bugzilla/> (raw)

We fail to correctly order the operands for the indexed store within the loop
below. This seems to be caused by a missing REG_POINTER attribute, so the code
added for PR28690 doesn't have a chance of getting the ordering correct. An
interesting thing is that if we replace the global array with an "extern int
*reg_values;", then we get the ordering correct.

bergner@etna:~/gcc/tests> cat a2-loop.c 
int reg_values[1024];
void
clear_table (unsigned int n)
{
  unsigned int i;
  for (i = 0; i < n; i++)
    reg_values[i] = 0;
}

The "bad" code gen looks like (using -O2 -S):

clear_table:
        cmpwi 0,3,0
        beqlr- 0
        lis 9,reg_values@ha
        slwi 3,3,2
        la 9,reg_values@l(9)
        li 11,0
        li 0,0
        .p2align 4,,15
.L3:
        stwx 0,11,9
        addi 11,11,4
        cmpw 7,11,3
        bne+ 7,.L3
        blr

It's another question on why this isn't using an update form store and branch
on count loop, to halve the size of the loop.  The loop size is particularly
glaring when you use -O2 -funroll-loops, then we get 8 indexed stores (all with
the wrong operand order) and 8 addi's...but I guess that's for another
bugzilla.


-- 
           Summary: Missing REG_POINTER attribute causes bad indexed
                    load/store operand ordering
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: bergner at gcc dot gnu dot org
        ReportedBy: bergner at gcc dot gnu dot org
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


             reply	other threads:[~2008-02-25 20:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-25 20:05 bergner at gcc dot gnu dot org [this message]
2008-02-25 20:51 ` [Bug rtl-optimization/35371] " bergner at gcc dot gnu dot org
2008-02-26  1:56 ` bergner at gcc dot gnu dot org
2008-02-26  1:57 ` bergner at gcc dot gnu dot org
2008-04-08 15:42 ` bergner 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=bug-35371-11700@http.gcc.gnu.org/bugzilla/ \
    --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).