On Wed, Feb 23, 2022 at 1:26 AM <stefan@xxxxxxxxx> wrote: > > > -----Ursprüngliche Nachricht----- > > Von: Gcc-help <gcc-help-bounces+bebbo=bejy.net@xxxxxxxxxxx> Im > > Auftrag von Segher Boessenkool > > Gesendet: Mittwoch, 23. Februar 2022 01:23 > > An: William Tambe <tambewilliam@xxxxxxxxx> > > Cc: gcc-help <gcc-help@xxxxxxxxxxx> > > Betreff: Re: Make GCC move instructions between a multi-cycle instruction > > and the next instruction that depends on its result. > > > > On Tue, Feb 22, 2022 at 03:15:55PM -0600, William Tambe via Gcc-help > > wrote: > > [snip] > > > > 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 ? > > > > GCC has a pretty advanced instruction scheduler. You can start looking at > > <https://gcc.gnu.org/onlinedocs/gccint/Scheduling.html> for example? > > > > You should also look at the md files defining an automaton --> > "define_automaton". > > There you model the pipelines, latency etc.p.p. for the cpu. > Then annotate the insns in the cpu md file with the types from the > automaton. > That information can be used by the scheduler and you may still need to > implement some of the scheduler hooks. > > Start looking at a simple cpu. > Would it be possible and safe to accomplish above transformation using TARGET_MACHINE_DEPENDENT_REORG ? If yes, what functions can be used to move an instruction ? > Stefan >