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 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.  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.

R.


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