Changeset 13561


Ignore:
Timestamp:
Mar 28, 2010, 11:55:52 AM (10 years ago)
Author:
gb
Message:

In the vinsns and subprims for special variable reference, try to
use CMOVs rather than branches.

Location:
trunk/source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/X86/X8632/x8632-vinsns.lisp

    r13457 r13561  
    33803380  :resume
    33813381  (movl (:@ x8632::symbol.binding-index (:%l src)) (:%l idx))
     3382  (xorl (:%l table) (:%l table))
    33823383  (rcmpl (:%l idx) (:@ (:%seg :rcontext) x8632::tcr.tlb-limit))
     3384  (cmovael (:%l table) (:%l idx))
    33833385  (movl (:@ (:%seg :rcontext) x8632::tcr.tlb-pointer) (:%l table))
    3384   (jae :symbol)
    33853386  (movl (:@ (:%l table) (:%l idx)) (:%l dest))
    33863387  (cmpl (:$l x8632::subtag-no-thread-local-binding) (:%l dest))
    3387   (jne :test)
    3388   :symbol
    3389   (movl (:@ x8632::symbol.vcell (:%l src)) (:%l dest))
    3390   :test
     3388  (cmovel (:@ x8632::symbol.vcell (:%l src)) (:%l dest))
    33913389  (cmpl (:$l x8632::unbound-marker) (:%l dest))
    33923390  (je :bad)
     
    34053403(define-x8632-vinsn %ref-symbol-value-inline (((dest :lisp))
    34063404                                              ((src (:lisp (:ne dest))))
    3407                                               ((table :imm)
    3408                                                (idx :imm)))
     3405                                              ((idx :imm)))
     3406  ;; binding index 0 always contains a no-thread-local-binding
     3407  ;; marker, so treat out-of-range indices as 0 to avoid branches.
    34093408  (movl (:@ x8632::symbol.binding-index (:%l src)) (:%l idx))
     3409  (xorl (:% dest) (:% dest))
    34103410  (rcmpl (:%l idx) (:@ (:%seg :rcontext) x8632::tcr.tlb-limit))
    3411   (jae :symbol)
     3411  (cmovael (:% dest) (:% idx))
    34123412  (addl (:@ (:%seg :rcontext) x8632::tcr.tlb-pointer) (:%l idx))
    34133413  (movl (:@ (:%l idx)) (:%l dest))
    34143414  (cmpl (:$l x8632::subtag-no-thread-local-binding) (:%l dest))
    3415   (jne :done)
    3416   :symbol
    3417   (movl (:@ x8632::symbol.vcell (:%l src)) (:%l dest))
    3418   :done)
     3415  (cmovel (:@ x8632::symbol.vcell (:%l src)) (:%l dest)))
    34193416
    34203417(define-x8632-vinsn ref-interrupt-level (((dest :imm))
  • trunk/source/compiler/X86/X8664/x8664-vinsns.lisp

    r13457 r13561  
    21182118  :resume
    21192119  (movq (:@ x8664::symbol.binding-index (:%q src)) (:%q idx))
     2120  ;; The entry for binding-index 0 in the table always
     2121  ;; contains a no-thread-local-binding marker; treat
     2122  ;; out-of-bounds indices as 0 to avoid branches
     2123  (xorl (:%l table) (:%l table))
    21202124  (rcmpq (:%q idx) (:rcontext x8664::tcr.tlb-limit))
     2125  (cmovael (:%l table) (:%l idx))
    21212126  (movq (:rcontext x8664::tcr.tlb-pointer) (:%q table))
    2122   (jae :symbol)
    21232127  (movq (:@ (:%q table) (:%q idx)) (:%q dest))
    21242128  (cmpl (:$b x8664::subtag-no-thread-local-binding) (:%l dest))
    2125   (jne :test)
    2126   :symbol
    2127   (movq (:@ x8664::symbol.vcell (:%q src)) (:%q dest))
     2129  (cmoveq (:@ x8664::symbol.vcell (:%q src)) (:%q dest))
    21282130  :test
    21292131  (cmpl (:$b x8664::unbound-marker) (:%l dest))
     
    21472149                                              ((table :imm)
    21482150                                               (idx :imm)))
     2151  ;; Treat out-of-bounds indices as index 0
    21492152  (movq (:@ x8664::symbol.binding-index (:%q src)) (:%q idx))
     2153  (xorl (:%l table) (:%l table))
    21502154  (rcmpq (:%q idx) (:rcontext x8664::tcr.tlb-limit))
     2155  (cmovael (:%l table) (:%l idx))
    21512156  (movq (:rcontext x8664::tcr.tlb-pointer) (:%q table))
    2152   (jae :symbol)
    21532157  (movq (:@ (:%q table) (:%q idx)) (:%q dest))
    21542158  (cmpb (:$b x8664::subtag-no-thread-local-binding) (:%b dest))
    2155   (jne :done)
    2156   :symbol
    2157   (movq (:@ x8664::symbol.vcell (:%q src)) (:%q dest))
    2158   :done)
     2159  (cmoveq (:@ x8664::symbol.vcell (:%q src)) (:%q dest)))
    21592160
    21602161(define-x8664-vinsn ref-interrupt-level (((dest :imm))
  • trunk/source/lisp-kernel/x86-spentry32.s

    r13406 r13561  
    34863486        __(movl rcontext(tcr.tlb_pointer),%temp1)
    34873487        __(movl %arg_z,%arg_y)
    3488         __(jae 7f)
     3488        __(jae 1f)
    34893489        __(movl (%temp1,%imm0),%arg_z)
    34903490        __(cmpb $no_thread_local_binding_marker,%arg_z_b)
    3491         __(jne 8f)
    3492 7:      __(movl symbol.vcell(%arg_y),%arg_z)
    3493 8:      __(repret)             
     3491        __(cmovel symbol.vcell(%arg_y),%arg_z)
     3492        __(ret)
     34931:      __(movl symbol.vcell(%arg_y),%arg_z)
     3494        __(ret)
    34943495_endsubp(specref)
    34953496
  • trunk/source/lisp-kernel/x86-spentry64.s

    r13406 r13561  
    33613361_spentry(specref)
    33623362        __(movq symbol.binding_index(%arg_z),%imm0)
     3363        __(xorl %imm2_l,%imm2_l)
    33633364        __(cmp rcontext(tcr.tlb_limit),%imm0)
    33643365        __(movq rcontext(tcr.tlb_pointer),%imm1)
    33653366        __(movq %arg_z,%arg_y)
    3366         __(jae 7f)
     3367        __(cmovael %imm2_l,%imm0_l)
    33673368        __(movq (%imm1,%imm0),%arg_z)
    33683369        __(cmpb $no_thread_local_binding_marker,%arg_z_b)
    3369         __(jne 8f)
    3370 7:      __(movq symbol.vcell(%arg_y),%arg_z)
    3371 8:      __(repret)             
     3370        __(cmoveq symbol.vcell(%arg_y),%arg_z)
     3371        __(ret)
    33723372_endsubp(specref)
    33733373
     
    33903390_spentry(specrefcheck)
    33913391        __(movq symbol.binding_index(%arg_z),%imm0)
     3392        __(xorl %imm2_l,%imm2_l)
    33923393        __(cmp rcontext(tcr.tlb_limit),%imm0)
    33933394        __(movq rcontext(tcr.tlb_pointer),%imm1)
    33943395        __(movq %arg_z,%arg_y)
    3395         __(jae 7f)
     3396        __(cmovaeq %imm2,%imm0)
    33963397        __(movq (%imm1,%imm0),%arg_z)
    33973398        __(cmpb $no_thread_local_binding_marker,%arg_z_b)
     
    33993400        __(cmpb $unbound_marker,%arg_z_b)
    34003401        __(je 9f)
    3401 8:      __(repret)
    3402 7:      __(cmpb $unbound_marker,symbol.vcell(%arg_y))
    3403         __(movq symbol.vcell(%arg_y),%arg_z)
    3404         __(je 9f)
    34053402        __(repret)
    340634039:      __(uuo_error_reg_unbound(Rarg_y))
Note: See TracChangeset for help on using the changeset viewer.