public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>,
	Ramana Radhakrishnan	<ramana.gcc@googlemail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Kyrill Tkachov	<kyrylo.tkachov@foss.arm.com>,
	Richard Earnshaw <Richard.Earnshaw@arm.com>,	nd <nd@arm.com>
Subject: Re: [PATCH, ARM] Further improve stack usage on sha512 (PR 77308)
Date: Wed, 30 Nov 2016 12:01:00 -0000	[thread overview]
Message-ID: <AM5PR0802MB26103E4F51572F3BAB036ACC838C0@AM5PR0802MB2610.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <AM5PR0802MB261038521472515DDE3E58DA838D0@AM5PR0802MB2610.eurprd08.prod.outlook.com>

Bernd Edlinger wrote:
> On 11/29/16 16:06, Wilco Dijkstra wrote:
> > Bernd Edlinger wrote:
> >
> > -  "TARGET_32BIT && reload_completed
> > +  "TARGET_32BIT && ((!TARGET_NEON && !TARGET_IWMMXT) || reload_completed)
> >     && ! (TARGET_NEON && IS_VFP_REGNUM (REGNO (operands[0])))"
> >
> > This is equivalent to "&& (!TARGET_IWMMXT || reload_completed)" since we're
> > already excluding NEON.
>
> Aehm, no.  This would split the addi_neon insn before it is clear
> if the reload pass will assign a VFP register.

Hmm that's strange... This instruction shouldn't be used to also split some random
Neon pattern - for example arm_subdi3 doesn't do the same. To understand and
reason about any of these complex patterns they should all work in the same way...

> But when I make *arm_cmpdi_insn split early, it ICEs:

(insn 4870 4869 1636 87 (set (scratch:SI)
         (minus:SI (minus:SI (subreg:SI (reg:DI 2261) 4)
                 (subreg:SI (reg:DI 473 [ X$14 ]) 4))
             (ltu:SI (reg:CC_C 100 cc)
                 (const_int 0 [0])))) "pr77308-2.c":140 -1
      (nil))

That's easy, we don't have a sbcs <scratch>, r1, r2 pattern. A quick workaround is
to create a temporary for operand[2] (if before reload) so it will match the standard
sbcs pattern, and then the split works fine.

> So it is certainly possible, but not really simple to improve the
> stack size even further.  But I would prefer to do that in a
> separate patch.

Yes separate patches would be fine. However there is a lot of scope to improve this
further. For example after your patch shifts and logical operations are expanded in
expand, add/sub are in split1 after combine runs and everything else is split after
reload. It doesn't make sense to split different operations at different times - it means
you're still going to get the bad DImode subregs and miss lots of optimization
opportunities due to the mix of partly split and partly not-yet-split operations.

> BTW: there are also negd2_compare, *negdi_extendsidi,
> *negdi_zero_extendsidi, *thumb2_negdi2.

I have a patch to merge thumb2_negdi2 into arm_negdi2. For extends, if we split them
at expand time, then none of the combined alu+extend patterns will be needed, and
that will be a huge simplification.

> I think it would be a precondition to have test cases that exercise
> each of these patterns before we try to split these instructions.

Agreed.

Wilco

  parent reply	other threads:[~2016-11-30 12:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-06 14:18 Bernd Edlinger
2016-11-25 11:30 ` Ramana Radhakrishnan
2016-11-28 19:42   ` Bernd Edlinger
     [not found]     ` <VI1PR0802MB2621FFBFA3252B40E5978C9F838D0@VI1PR0802MB2621.eurprd08.prod.outlook.com>
2016-11-29 21:37       ` Bernd Edlinger
     [not found]         ` <AM5PR0802MB261038521472515DDE3E58DA838D0@AM5PR0802MB2610.eurprd08.prod.outlook.com>
2016-11-30 12:01           ` Wilco Dijkstra [this message]
2016-11-30 17:01             ` Bernd Edlinger
2016-12-08 19:50               ` Bernd Edlinger
2017-01-11 16:55                 ` Richard Earnshaw (lists)
2017-01-11 17:19                   ` Bernd Edlinger
2017-04-29 19:17     ` [PING**2] " Bernd Edlinger
2017-05-12 16:51       ` [PING**3] " Bernd Edlinger
2017-06-01 16:01         ` [PING**4] " Bernd Edlinger
     [not found]         ` <bd5e03b1-860f-dd16-2030-9ce0f9a94c7c@hotmail.de>
2017-06-14 12:35           ` [PING**5] " Bernd Edlinger
     [not found]           ` <9a0fbb5d-9909-ef4d-6871-0cb4f7971bbb@hotmail.de>
2017-07-05 18:14             ` [PING**6] " Bernd Edlinger
2017-09-04 14:52       ` [PING**2] " Kyrill Tkachov
2017-09-05  8:47         ` Christophe Lyon
2017-09-05 14:25           ` Bernd Edlinger
2017-09-05 15:02             ` Wilco Dijkstra
2017-09-05 17:48               ` Bernd Edlinger
2017-09-05 17:53                 ` Kyrill Tkachov
2017-09-05 18:20                   ` Christophe Lyon
2017-09-06  7:35                     ` Christophe Lyon
2017-09-05 21:28                 ` Wilco Dijkstra
2017-09-06  9:31                   ` Bernd Edlinger
2017-09-05 17:45             ` Kyrill Tkachov

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=AM5PR0802MB26103E4F51572F3BAB036ACC838C0@AM5PR0802MB2610.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@foss.arm.com \
    --cc=nd@arm.com \
    --cc=ramana.gcc@googlemail.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).