public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59239] New: [SH] Improve decrement-and-test insn
Date: Thu, 21 Nov 2013 22:00:00 -0000	[thread overview]
Message-ID: <bug-59239-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 59239
           Summary: [SH] Improve decrement-and-test insn
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
            Target: sh*-*-*

Created attachment 31264
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31264&action=edit
Possible cleanup patch

The decrement-and-test insn seems to rely on the define_peephole.  At least
taking it out shows some missed opportunities in the CSiBE set.
I've tried replacing it with a define_peephole2, but it would still show missed
cases such as:
   mov.l  @(...), Rn
   add    #-1,Rn
   mov.l  Rn,@(...)
   tst    Rn,Rn

Towards the very end of compilation the insns often get reordered to something
like
   mov.l  @(...), Rn
   add    #-1,Rn
   tst    Rn,Rn
   mov.l  Rn,@(...)

and the define_peephole will catch it in the final RTL pass when outputting asm
code.

Attached is a patch that replaces the old define_peephole with a manual insn
combine in cmpeqsi_t.  This catches some more of those cases where the
individual decrement and test insns are interleaved with something else.

There is one weird case in CSiBE in linux-2.4.23-pre3-testplatform/fs/iobuf.c
(alloc_kiobuf_bhs) though, where the individual decrement and test insns end up
in different basic blocks and only at the very end are emitted right next to
each other without a label in between.


             reply	other threads:[~2013-11-21 22:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 22:00 olegendo at gcc dot gnu.org [this message]
2013-11-21 22:08 ` [Bug target/59239] " olegendo at gcc dot gnu.org
2013-11-21 22:36 ` olegendo at gcc dot gnu.org
2014-05-10 13:03 ` olegendo at gcc dot gnu.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-59239-4@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).