Hi Richard, Thank you for the clarification. I was curious because LLVM seems to support scheduling separate fusible instructions together.
Thanks :) Hau On Fri, Jan 10, 2025 at 1:30 AM Richard Sandiford <richard.sandif...@arm.com> wrote: > Hau Hsu via Gcc <gcc@gcc.gnu.org> writes: > > Hi, > > > > I have a question about GCC's macro fusion pass. > > In the GCC internals doc, there is a hook for scheduling: > > TARGET_SCHED_MACRO_FUSION_PAIR_P > > < > https://gcc.gnu.org/onlinedocs/gccint/Scheduling.html#index-TARGET_005fSCHED_005fMACRO_005fFUSION_005fPAIR_005fP > > > > It says: > >> If this hook returns true for the given insn pair (prev and curr), > >> the scheduler will put them into a sched group, and they will not be > > scheduled apart. > > > > My questions are, does this mean that GCC is just adding a mark on > > back-to-back insns (as their name *prev* and *curr* suggests) and won't > > separate them during scheduling? Does GCC try to search for separate but > > fusible insns and to put them together? > > > > I also traced the code in sched_macro_fuse_insns() > > < > https://github.com/gcc-mirror/gcc/blob/640b550425180bdab7bc67edc6a48465f4023888/gcc/sched-deps.cc#L2844-L2880 > >, > > but it seems only grouping back-to-back insns ... > > Yeah, that's right. TARGET_SCHED_MACRO_FUSION_PAIR_P just keeps existing > groups together. TARGET_SCHED_FUSION_PRIORITY provides a way of trying > to form new groups. > > Thanks, > Richard > >