public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: William Tambe <tambewilliam@gmail.com>
To: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Make GCC move instructions between a multi-cycle instruction and the next instruction that depends on its result.
Date: Tue, 22 Feb 2022 15:15:55 -0600	[thread overview]
Message-ID: <CAF8i9mM34-mLZoh4DrKbLsRNSR=S24zB39heVwv5MsxWjcWsiQ@mail.gmail.com> (raw)
In-Reply-To: <CAF8i9mOugP=Rovks8e4WSCJdbocDNt568S9rUEezrFW+kkxH0Q@mail.gmail.com>

On Tue, Feb 22, 2022 at 1:00 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> In this CPU,
>
> A multi-cycle instruction, once decoded, runs in parallel as other
> decoded single/multi-cycle instructions.
>
> A single/multi-cycle instruction takes two operands, where the first
> operand receives the result
> of computing both operands.
>
> An example of multi-cycle instruction is "div".
> An example of single-cycle instruction is "add".
>
> GCC should be able to transform following:
> ````
> add %0 %5
> add %1 %6
> div %4 %5 #<-- Multi-cycle instruction.
> add %4 %7 #<-- Next instruction that depends on its result.
> add %3 %7
> add %2 %7
> ```
> To:
> ```
> div %4 %5 #<-- Multi-cycle instruction.
> add %0 %5
> add %1 %6
> add %3 %7
> add %2 %7
> add %4 %7 #<-- Next instruction that depends on its result.
> ```
> Without above transformation, `add %4 %7` would cause the cpu to wait
> on `div %4 %5` when it could have executed instructions that do not
> depend on the result of "div".

How to implement above transformation such that GCC moves instructions
between a multi-cycle instruction and the next instruction that
depends on its result ?

  reply	other threads:[~2022-02-22 21:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 19:00 William Tambe
2022-02-22 21:15 ` William Tambe [this message]
2022-02-23  0:22   ` Segher Boessenkool
2022-02-23  0:51     ` William Tambe
2022-02-23  7:25     ` AW: " stefan
2022-02-23 15:07       ` William Tambe

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='CAF8i9mM34-mLZoh4DrKbLsRNSR=S24zB39heVwv5MsxWjcWsiQ@mail.gmail.com' \
    --to=tambewilliam@gmail.com \
    --cc=gcc-help@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).