public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "oleg.endo@t-online.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/50749] SH Target: Post-increment addressing used only for first memory access
Date: Sun, 30 Oct 2011 13:54:00 -0000	[thread overview]
Message-ID: <bug-50749-4-3GWt5t12yo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50749-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Oleg Endo <oleg.endo@t-online.de> 2011-10-30 13:53:51 UTC ---
(In reply to comment #1)
> GCC makes usual mem accesses into those with post_inc/pre_dec at
> auto_inc_dec pass.  I guess that auto_inc_dec pass can't find
> post_inc insns well in that case because other tree/rtl optimizers
> tweak the code already.  If this is the case, the problem would be
> not target specific.

Looks like so.  For the simple test case...

int test (char* p, int c)
{
  int r = 0;
  r += *p++;
  r += *p++;
  r += *p++;        
  return r;
}

...the load insns are initially expanded as:

(insn 2 5 3 2 (set (reg/v/f:SI 169 [ p ])
        (reg:SI 4 r4 [ p ]))
     (nil))


(insn 7 6 8 3 (set (reg:SI 171)
        (sign_extend:SI (mem:QI (reg/v/f:SI 169 [ p ]) [0 *p_2(D)+0 S1 A8]))) 
     (nil))


(insn 8 7 9 3 (set (reg:SI 172)
        (reg/v/f:SI 169 [ p ]))
     (nil))


(insn 9 8 10 3 (set (reg/f:SI 173)
        (plus:SI (reg/v/f:SI 169 [ p ])
            (const_int 1 [0x1])))
     (nil))


(insn 10 9 11 3 (set (reg:SI 174)
        (sign_extend:SI (mem:QI (reg/f:SI 173) [0 MEM[(char *)p_2(D) + 1B]+0 S1
A8])))
     (nil))

(insn 13 12 14 3 (set (reg/f:SI 177)
        (plus:SI (reg/v/f:SI 169 [ p ])
            (const_int 2 [0x2])))
     (nil))

(insn 14 13 15 3 (set (reg:SI 178)
        (sign_extend:SI (mem:QI (reg/f:SI 177) [0 MEM[(char *)p_2(D) + 2B]+0 S1
A8])))
     (nil))


The auto_inc_dec pass then fails to realize that (reg:SI 177) = (reg:SI 169) +
2 = (reg:SI 173) + 1.

I wonder whether there might be something in the target code that suggests the
early optimizers to do that?  I've tried playing with the TARGET_ADDRESS_COST
hook but it didn't have any effect in this case.


  parent reply	other threads:[~2011-10-30 13:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16 20:29 [Bug target/50749] New: " oleg.endo@t-online.de
2011-10-16 23:34 ` [Bug target/50749] " kkojima at gcc dot gnu.org
2011-10-17  0:33 ` kkojima at gcc dot gnu.org
2011-10-19  0:00 ` oleg.endo@t-online.de
2011-10-19 21:37 ` kkojima at gcc dot gnu.org
2011-10-30 12:37 ` oleg.endo@t-online.de
2011-10-30 13:54 ` oleg.endo@t-online.de [this message]
2011-10-30 23:37 ` kkojima at gcc dot gnu.org
2011-11-28 22:54 ` oleg.endo@t-online.de
2011-11-29  0:25 ` kkojima at gcc dot gnu.org
2011-12-30  2:14 ` oleg.endo@t-online.de
2011-12-30  3:36 ` kkojima at gcc dot gnu.org
2012-06-12  7:10 ` [Bug middle-end/50749] Auto-inc-dec does not find subsequent contiguous mem accesses olegendo at gcc dot gnu.org
2012-08-23 14:17 ` [Bug rtl-optimization/50749] " olegendo at gcc dot gnu.org
2013-06-22 12:22 ` olegendo at gcc dot gnu.org
2013-09-30  9:06 ` amker.cheng at gmail dot com
2013-10-03 10:47 ` olegendo at gcc dot gnu.org
2013-12-06 20:28 ` olegendo at gcc dot gnu.org
2013-12-24 22:55 ` steven at gcc dot gnu.org
2015-05-22 13:57 ` olegendo at gcc dot gnu.org
2015-09-17  9:00 ` urjaman at gmail dot com
2015-09-17 14:26 ` olegendo at gcc dot gnu.org
2015-09-17 19:45 ` urjaman at gmail dot com

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-50749-4-3GWt5t12yo@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).