This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: decrement_and_branch_until_zero pattern
- From: Paul Koning <paulkoning at comcast dot net>
- To: Jim Wilson <jimw at sifive dot com>
- Cc: Andreas Schwab <schwab at linux-m68k dot org>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Thu, 5 Jul 2018 12:50:02 -0400
- Subject: Re: decrement_and_branch_until_zero pattern
- References: <40F210CF-1193-48F5-AA77-1AB93E6CA642@comcast.net> <87d0x14k8r.fsf@igel.home> <33E78317-B3AB-496B-BD78-5C98A16F9FD8@comcast.net> <cb9a5461-14eb-314f-2fcb-4b38950d2d24@sifive.com> <60DDF374-FFF3-4680-AE2B-FB5C4ED2AF21@comcast.net> <CAFyWVaZriSX7t=hsBRS8_MU7MZhf29bWqb2gO5z7EtrOyBrLQg@mail.gmail.com>
> On Jun 8, 2018, at 6:16 PM, Jim Wilson <jimw@sifive.com> wrote:
>
> On Fri, Jun 8, 2018 at 1:12 PM, Paul Koning <paulkoning@comcast.net> wrote:
>> Thanks. I saw those sections and interpreted them as support for signal processor style fast hardware loops. If they can be adapted for dbra type looping, great. I'll give that a try.
>
> The rs6000 port uses it for bdnz (branch decrement not zero) for
> instance, which is similar to the m68k dbra.
>
>> Meanwhile, yes, it looks like there is a documentation bug. I can clean that up. It's more than a few lines, but does that qualify for an "obvious" change?
>
> I think the obvious rule should only apply to trivial patches, and
> this will require some non-trivial changes to fix the looping pattern
> section. Just deleting the decrement_and_branch_until_zero named
> pattern section looks trivial. It looks like the REG_NONNEG section
> should mention the doloop_end pattern instead of
> decrement_and_branch_until_zero, since I think the same rule applies
> that they only get generated if the doloop_end pattern exists.
It appears that doloop_end doesn't get a REG_NONNEG pattern. I just added doloop_end to my target and I don't see any such note in the RTL dumps.
By the way, the documentation makes it clear that the register used in the doloop isn't available as an "induction variable". I wonder if there is a way to make that restriction go away, since my target -- and I suspect several others as well -- use a general register for the loop control. So as far as the target is concerned the loop control register is definitely available. I understand the original restriction for machines like DSPs that loop using special-purpose loop registers, but that isn't a universal limitation.
paul