------- Comment #6 from wilson at codesourcery dot com  2009-03-16 19:07 -------
Subject: Re:  Branch registers loaded too late
 on ia64

steven at gcc dot gnu dot org wrote:
> ------- Comment #5 from steven at gcc dot gnu dot org  2009-03-16 08:46 
> -------
> Can someone point me to the IA64 optimiation manuals mentioned in comment #0? 
>  

You can find manuals on the Intel web site.  You want the Intel Itanium 
2 Processor Reference Manual (For Software Development and 
Optimization).  Chapter 7 talks about branch instructions.

> * Which branch registers can I use?

Any one of the 8 special branch registers, class BR_REGS.

> * What does "as early as possible" mean in comment #0?

The manual says there should be several cycles between the branch 
register write and the branch for correct prediction.  There is probably 
no "too early" to worry about, as long as you don't use more than the 
available 8 registers.  You want to avoid reloads here.  Some of the 
regs are call clobbered, some are preserved, and probably some are 
reserved for call/return.  I don't recall all of the ABI details.  You 
can look them up in the manuals.  See the Itanium Software Conventions 
and Runtime Architecture Guide.

> * What happens if a value is assigned to a branch register on IA64?  Is the
> prefetcher always triggered?  What is the latency of the prefetching after a
> branch register has been assigned a value?

This is complicated.  I suggest downloading the docs and reading them.

> * Is there a possibility to add a prediction hint to say "branch register A is
> more likely to be used than branch register B" when multiple branch registers
> are assigned a value in the same basic block?

There is separate predication support for each branch register, but I 
assume this is about priority for prefetching?  Yes, there are branch 
hints for that.  See the Itanium Architecture Software Developer's 
Manual, Volume 1, section 4.5 is for branch instructions.  There is a 
"few" completer for prefetching a few lines, and a "many" completer for 
prefetching many lines.  ia64.md uses "many" for call and return.

Jim


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30688

Reply via email to