public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* arm926 branch cost
@ 2009-05-26 13:46 Phil Fong
  0 siblings, 0 replies; only message in thread
From: Phil Fong @ 2009-05-26 13:46 UTC (permalink / raw)
  To: gcc


At the end of config/arm/arm926ejs.md, branch costs are modeled with:

>;; Branch instructions are difficult to model accurately.  The ARM
>;; core can predict most branches.  If the branch is predicted
>;; correctly, and predicted early enough, the branch can be completely
>;; eliminated from the instruction stream.  Some branches can
>;; therefore appear to require zero cycles to execute.  We assume that
>;; all branches are predicted correctly, and that the latency is
>;; therefore the minimum value.
>
>(define_insn_reservation "9_branch_op" 0
> (and (eq_attr "tune" "arm926ejs")
>      (eq_attr "type" "branch"))
> "nothing")
In arm.md "*arm_cond_branch" and "*arm_cond_branch_reversed" have attr "type" set to "branch".

This seems to disagree with Section 8.3 of the ARM9EJ-S Technical Reference Manual (ARM DDI 0222B) which says:
"Any ARM or Thumb branch, and an ARM branch with link operation
takes three cycles"
Presumably, branches that are not taken take 1 cycle like any other non-executed conditional instruction.  

In addition, arm926ejs.md does not model the cost of alu instructions like mov, etc. with the PC as the destination.  According to the reference manual, these are either 3 or 4 cycles.

The section section above from arm926ejs.md also appears in arm1026ejs.md.  The arm1026 has branch prediction while the arm926 does not according to their respective reference manuals.

Am I mis-understanding what "define_insn_reservation" means?  There
does not appear to be anything the arm_adjust_cost in arm.c which
affects branching costs.

Phil


      

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-25 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-26 13:46 arm926 branch cost Phil Fong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).