public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
To: Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Subject: Re: [PATCH][ARM] PR target/70566 Check that condition register is dead in tst-imm -> lsls-imm Thumb2 peepholes
Date: Fri, 08 Apr 2016 09:31:00 -0000	[thread overview]
Message-ID: <57077A47.2070100@arm.com> (raw)
In-Reply-To: <570673FB.7020803@foss.arm.com>

On 07/04/16 15:51, Kyrill Tkachov wrote:
> Hi all,
> 
> In this wrong-code PR we have a Thumb2 peephole transforming:
>     tst    r3, #2
>     bne    .L3
>     beq    .L6
> 
> into:
>     lsls    r3, r3, #30  // LSLS is shorter than TST in Thumb2
>     bmi    .L3
>     beq    .L6
> 
> that is, the branch following the extract+compare has its condition
> properly changed but the
> following branch doesn't get updated to check the opposite condition of
> MI (PL).
> Since the peepholes in thumb2.md only see the compare and a single
> branch the solution,
> suggested by Richard, is to guard those peepholes on the condition that
> the condition register
> is dead after the first branch. This patch does that and with it we no
> longer perform the transformation
> on the testcase. I've checked manually that we still perform the
> peephole when the condition register
> is indeed dead after the sequence.
> 
> Bootstrapped and tested on on arm-none-linux-gnueabihf with
> --with-mode=thumb as this affects only
> Thumb2 codegen.
> 
> Ok for trunk?
> 
> This PR also affects GCC 5 and 4.9 so I'll be testing the patch there as
> well.
> 
> Thanks,
> Kyrill
> 
> 
> 2016-04-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>     PR target/70566
>     * config/arm/thumb2.md (tst + branch-> lsls + branch
>     peephole below *orsi_not_shiftsi_si): Require that condition
>     register is dead after the peephole.
>     (second peephole after the above): Likewise.
> 
> 2016-04-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>     PR target/70566
>     * gcc.c-torture/execute/pr70566.c: New test.


OK.

R.

  reply	other threads:[~2016-04-08  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 14:51 Kyrill Tkachov
2016-04-08  9:31 ` Richard Earnshaw (lists) [this message]
2016-04-11 13:27   ` Kyrill Tkachov
2016-04-12  9:12     ` Richard Earnshaw (lists)

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=57077A47.2070100@arm.com \
    --to=richard.earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@foss.arm.com \
    --cc=ramana.radhakrishnan@arm.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).