On Tue, Feb 22, 2022 at 6:24 PM Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> wrote: > > 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? > Thank you for the pointer; could you suggest an existing example close to what I am looking to implement that uses above TARGET_SCHED_* hooks ? > > Segher