public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ramana at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/40416] unnecessary register spill
Date: Fri, 12 Jun 2009 12:54:00 -0000	[thread overview]
Message-ID: <20090612125408.26734.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40416-17659@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from ramana at gcc dot gnu dot org  2009-06-12 12:54 -------
(In reply to comment #1)
> Created an attachment (id=17983)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17983&action=view) [edit]
> test case
> 

Your attachment didn't have #include <stdint.h> - Please try and supply
pre-processed input which is self contained . Adding a -I from a build
directory can be rather painful . Thanks - 

> The spilling is occurred around the first loop:
> 
>         push    {r4, r5, r6, r7, lr}
>         sub     sp, sp, #12
>         .loc 1 5 0
>         str     r2, [sp, #4]          // A
>         .loc 1 6 0
>         add     r6, r1, r2
>         mov     r4, r0
>         .loc 1 8 0
>         b       .L2
> .L5:
>         .loc 1 10 0
>         mov     r7, #0
>         ldrsh   r5, [r4, r7]
>         .loc 1 12 0
>         cmp     r2, r5
>         bge     .L3
>         .loc 1 14 0
>         ldrb    r7, [r1]
>         strb    r7, [r1, r2]
>         .loc 1 15 0
>         strh    r2, [r4]
>         .loc 1 16 0
>         lsl     r1, r2, #1
>         sub     r2, r5, r2
>         strh    r2, [r1, r4]
> .L6:
>         .loc 1 5 0
>         ldr     r5, [sp, #4]     //   B
>         lsl     r4, r5, #1
>         add     r0, r0, r4
>         b       .L4
> .L3:
>         .loc 1 19 0
>         lsl     r7, r5, #1
>         mov     ip, r7
>         add     r4, r4, ip
>         .loc 1 20 0
>         add     r1, r1, r5
>         .loc 1 21 0
>         sub     r2, r2, r5
> .L2:
>         .loc 1 8 0
>         cmp     r2, #0
>         bgt     .L5
>         b       .L6
> .L4:
>         .loc 1 30 0
>         mov     r1, #0
> 
> 
> The spilling is occurred at instruction A and reload at instruction B.
> 
> The spilled value is x. The source code computes next_runs and next_alpha
> before while loop and preserve them through the loop body. But the generated
> code preserve next_alpha, original runs and original x through the loop body
> and compute next_runs after the loop. This caused an extra usage of register
> and results in a register spilling.
> 

Could you say what you'd like the code to be because I don't see an option but
to spill one of the values here. ?


-- 


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


  parent reply	other threads:[~2009-06-12 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11 14:26 [Bug target/40416] New: " carrot at google dot com
2009-06-11 14:34 ` [Bug target/40416] " carrot at google dot com
2009-06-12 12:54 ` ramana at gcc dot gnu dot org [this message]
2009-06-15  2:27 ` carrot at google dot com
2009-06-15  2:32 ` carrot at google dot com
2009-06-15  9:14 ` ramana at gcc dot gnu dot org
2009-06-22 16:32 ` steven at gcc dot gnu dot org
2009-06-30  7:42 ` carrot at google dot com
2009-06-30  8:19 ` steven at gcc dot gnu dot org
2009-06-30  8:21 ` steven 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=20090612125408.26734.qmail@sourceware.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).