• Joshua Kinard's avatar
    MIPS: R12000: Enable branch prediction global history · 8d5ded16
    Joshua Kinard authored
    The R12000 added a new feature to enhance branch prediction called
    "global history".  Per the Vr10000 Series User Manual (U10278EJ4V0UM),
    Coprocessor 0, Diagnostic Register (22):
    
    """
    If bit 26 is set, branch prediction uses all eight bits of the global
    history register.  If bit 26 is not set, then bits 25:23 specify a count
    of the number of bits of global history to be used. Thus if bits 26:23
    are all zero, global history is disabled.
    
    The global history contains a record of the taken/not-taken status of
    recently executed branches, and when used is XOR'ed with the PC of a
    branch being predicted to produce a hashed value for indexing the BPT.
    Some programs with small "working set of conditional branches" benefit
    significantly from the use of such hashing, some see slight performance
    degradation.
    """
    
    This patch enables global history on R12000 CPUs and up by setting bit
    26 in the branch prediction diagnostic register (CP0 $22) to '1'.  Bits
    25:23 are left alone so that all eight bits of the global history
    register are available for branch prediction.
    Signed-off-by: default avatarJoshua Kinard <kumba@gentoo.org>
    Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    8d5ded16
cpu-features.h 12.2 KB