public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Make GCC move instructions between a multi-cycle instruction and the next instruction that depends on its result.
@ 2022-02-22 19:00 William Tambe
  2022-02-22 21:15 ` William Tambe
  0 siblings, 1 reply; 6+ messages in thread
From: William Tambe @ 2022-02-22 19:00 UTC (permalink / raw)
  To: gcc-help

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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-23 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 19:00 Make GCC move instructions between a multi-cycle instruction and the next instruction that depends on its result William Tambe
2022-02-22 21:15 ` William Tambe
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

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).