This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Scheduler questions (related to PR17808)


On Thursday 30 June 2005 12:53, Richard Earnshaw wrote:
> On Thu, 2005-06-30 at 11:22, Steven Bosscher wrote:
> > For your problem, I think the jump should just be forced somehow to
> > be the last insn in the block.  You can't move things into other
> > basic blocks if you are not doing interblock scheduling, after all.
> > For the PR I was looking at, someone who actually understands the
> > scheduler will have to figure out a fix :-/
>
> The PR is exactly the point that we *don't* want to force the jump to
> the end of the block: we want to put the branch at the optimal point in
> the schedule and move any left over conditional insns to a place where
> they don't waste time when they don't compute anything.

Maybe that is your interpretation of that PR, but not mine (and I filed
it).  My interpretation is that there is a problem that if some correct
code in sched-deps.c is enabled, things break elsewhere.

> There's no 
> point in conditionally not executing an instruction if it takes a cycle
> to do so with no benefit.  Consider the following instruction sequence
> (where C and c are opposite conditions):
>
> 	T = [addr]
> 	C? addr += 4
> 	C? X += 12
> 	c? T += 1
> 	c? Jump foo
>
> Now on a processor with a one cycle stall on a memory access the optimal
> sequence here is
>
> 	T = [addr]
> 	C? addr += 4
> 	c? T += 1
> 	c? jump foo
> 	(C?) X += 12 // Note: C? is optional -- will always be true
>
> We don't want to put the 'X += 12' before the branch because it just
> wastes a cycle of execution time when the branch is taken.

So?  If you want to move the branch to an optimal point, you should
enable interblock scheduling.  You can't do intrablock scheduling and
at the same expect the scheduler to move insns to other blocks.  By
definition of "intra-block", you can't move insns to other blocks.

Gr.
Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]