public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Paulo J. Matos" <paulo@matos-sorge.com>
To: Vladimir Makarov <vmakarov@redhat.com>
Cc: gcc@gcc.gnu.org, Richard Guenther <richard.guenther@gmail.com>
Subject: Re: Move insn out of the way
Date: Thu, 11 Aug 2011 12:22:00 -0000	[thread overview]
Message-ID: <CAKQyQBf7BOQnHs1msWHHLTPt+XCcbo85sztTDjro2B9kN4yWog@mail.gmail.com> (raw)
In-Reply-To: <4E431BD8.8060705@redhat.com>

On Thu, Aug 11, 2011 at 1:01 AM, Vladimir Makarov <vmakarov@redhat.com> wrote:
> I can not reproduce the problem.  It would be nice to give all info (the
> code without includes and all options).  In this case I could have more info
> to say more definitely about the reason of the problem in IRA.
>

Let me add another example using the avr backend that produces really
strange code. The code has a similar nature:
_Bool simple(unsigned long *a, unsigned long *b) { return *a == *b; }

Generates the following assembler when compiled with -Os in gcc-4.6:
simple:
        push r16
        push r17
/* prologue: function */
/* frame size = 0 */
/* stack size = 2 */
.L__stack_usage = 2
        mov r30,r24
        mov r31,r25
        ldi r24,lo8(1)
        ld r16,Z
        ldd r17,Z+1
        ldd r18,Z+2
        ldd r19,Z+3
        mov r30,r22
        mov r31,r23
        ld r20,Z
        ldd r21,Z+1
        ldd r22,Z+2
        ldd r23,Z+3
        cp r16,r20
        cpc r17,r21
        cpc r18,r22
        cpc r19,r23
        breq .L2
        ldi r24,lo8(0)
.L2:
/* epilogue start */
        pop r17
        pop r16
        ret

Again here the placing of the return value is not very relevant
because I guess there's not much register pressure but when there is,
in my arch, the resulting code is increased by 5 words simply due to
the position of the constant assignment. In the above case, the
constant assignment is the 5th instruction, when it could be pretty
much closer to the end.

I am interested in knowing if this is indeed an IRA problem and I have
to wait for a fix, or if there's something that I need doing in the
backend to tell GCC to delay the constant assignment.

Cheers,

-- 
PMatos

  parent reply	other threads:[~2011-08-11 12:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 11:20 Paulo J. Matos
2011-08-10 11:40 ` Richard Guenther
2011-08-10 11:42   ` Richard Guenther
2011-08-10 13:55     ` Paulo J. Matos
     [not found]       ` <4E431BD8.8060705@redhat.com>
2011-08-11  8:12         ` Paulo J. Matos
2011-08-11  8:49           ` Richard Guenther
2011-08-11 14:27             ` Vladimir Makarov
2011-08-12 10:01               ` Paulo J. Matos
2011-08-12 14:22                 ` Vladimir Makarov
2011-08-12 15:06                   ` Paulo J. Matos
2011-08-12 16:12                 ` Jeff Law
2011-08-11 12:22         ` Paulo J. Matos [this message]
2011-08-10 13:46   ` Paulo J. Matos
2011-08-10 13:51     ` Richard Guenther
2011-08-10 14:14       ` Paulo J. Matos

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=CAKQyQBf7BOQnHs1msWHHLTPt+XCcbo85sztTDjro2B9kN4yWog@mail.gmail.com \
    --to=paulo@matos-sorge.com \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=vmakarov@redhat.com \
    /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).