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/59533] [SH] Missed cmp/pz opportunity
Date: Sun, 25 Jan 2015 17:08:00 -0000	[thread overview]
Message-ID: <bug-59533-4-IhOAOYnfvJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59533-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59533

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
The issues mentioned above have been fixed by the treg_set_expr patch
(r220081).
There is one more thing, though:

int test2 (int x)
{
  return x < 0;
}

It's effectively a lshiftrt 31 and compiles to:
        shll    r4
        rts
        movt    r0

On SH2A the same can be done as:
        cmp/pz  r4
        rts
        movrt   r0

which avoids mutating the input operand of the comparison.  On non-SH2A this
would end up as:
        cmp/pz  r4
        mov     #-1,r0
        rts
        negc    r0,r0

which could be better than shll-movt in cases where the input operand is not
dead after the insn and even better if the -1 constant can be shared.


  parent reply	other threads:[~2015-01-25 17:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 21:59 [Bug target/59533] New: " olegendo at gcc dot gnu.org
2013-12-17  0:32 ` [Bug target/59533] " olegendo at gcc dot gnu.org
2013-12-17  1:43 ` olegendo at gcc dot gnu.org
2013-12-17 21:07 ` olegendo at gcc dot gnu.org
2015-01-24 13:05 ` olegendo at gcc dot gnu.org
2015-01-25 17:08 ` olegendo at gcc dot gnu.org [this message]
2015-01-25 17:25 ` olegendo at gcc dot gnu.org
2015-01-25 17:42 ` 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-59533-4-IhOAOYnfvJ@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).