Changeset 10265


Ignore:
Timestamp:
Jul 31, 2008, 5:47:29 PM (11 years ago)
Author:
rme
Message:

fast-mod-3 for x8632.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/X86/X8632/x8632-hash.lisp

    r7986 r10265  
    1919  (mark-as-node temp1)
    2020  (single-value-return))
     21
     22;; Faster mod based on Bruce Hoult's Dylan version, modified to use a
     23;; branch-free max.
     24(defx8632lapfunction fast-mod-3 ((number 4) #|(ra 0)|# (divisor arg_y) (recip arg_z))
     25  (std)                                 ;temp1 now unboxed
     26  (let ((imm1 temp1)
     27        (n temp0))
     28    (movl (@ number (% esp)) (% n))
     29    (movl (% n) (% imm0))
     30    (sarl ($ target::fixnumshift) (% imm0))
     31    (mov (% recip) (% imm1))
     32    (mul (% imm1)) ;; -> hi word in imm1 (unboxed)
     33    (mov (% divisor) (% imm0))
     34    (mul (% imm1)) ;; -> lo word in imm0 (boxed)
     35    (subl (% imm0) (% n))
     36    (subl (% divisor) (% n))
     37    (mov (% n) (% arg_z))
     38    (mov (% n) (% imm0))
     39    (sar ($ (1- target::nbits-in-word)) (% imm0))
     40    (andl (% imm0) (% divisor))
     41    (addl (% divisor) (% arg_z)))
     42  (xorl (% temp1) (% temp1))
     43  (cld)                                 ;temp1 now boxed
     44  (single-value-return 3))
    2145
    2246(defx8632lapfunction %dfloat-hash ((key arg_z))
Note: See TracChangeset for help on using the changeset viewer.