public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill Tkachov <kyrylo.tkachov@arm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>,
	 Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: [PATCH][ARM][3/3] Implement negsicc, notsicc optabs
Date: Tue, 01 Sep 2015 15:04:00 -0000	[thread overview]
Message-ID: <55E5BE8C.6080806@arm.com> (raw)

Hi all,

This third patch implements the new optabs for arm.
Conveniently, we can reuse the recently refactored *if_neg_move pattern
and extend it to cover the conditional NOT case.
Although arm has conditional execution capabilities I have found that
performing the transformation from patch 1/3 early on benefits arm as well.
For example for code:
int
foonegsi (int a)
{
   return a ? 25089992 : -25089992;
}

we currently generate:
         movw    r2, #55240
         movw    r3, #10296
         cmp     r0, #0
         movt    r2, 382
         movt    r3, 65153
         movne   r0, r2
         moveq   r0, r3
         bx

whereas with this patch we generate:
         movw    r3, #10296
         cmp     r0, #0
         movt    r3, 65153
         mov     r0, r3
         rsbne   r0, r3, #0
         bx      lr


In SPEC2006 this doesn't trigger very often, so there were minimal code differences,
but overall I claim this patch is an improvement.

Bootstrapped and tested on arm-none-linux-gnueabihf.

Ok for trunk if the midend changes in 1/3 are approved?

Thanks,
Kyrill

2015-09-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/arm/arm.md (<NOT_NEG_op>sicc): New define_expand.
     (*if_neg_move): Rename to...
     (*if_<NOT_NEG_op>_move): ... This.  Use NOT_NEG code iterator.
     * config/arm/iterators.md (NOT_NEG): New code iterator.
     (NOT_NEG_op): New code attribute.

2015-09-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/arm/cond_op_imm_1.c: New test.

             reply	other threads:[~2015-09-01 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 15:04 Kyrill Tkachov [this message]
2015-09-01 15:09 ` pinskia
2015-09-01 15:10 Kyrill Tkachov
2015-09-10  9:17 ` Ramana Radhakrishnan

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=55E5BE8C.6080806@arm.com \
    --to=kyrylo.tkachov@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).