Make GCC move instructions between a multi-cycle instruction and the next instruction that depends on its result.
William Tambe
tambewilliam@gmail.com
Tue Feb 22 19:00:25 GMT 2022
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".
More information about the Gcc-help
mailing list