Changeset 13419


Ignore:
Timestamp:
Jan 29, 2010, 12:56:41 AM (10 years ago)
Author:
gb
Message:

First-approximation %BIGNUM-LOGIOR, %BIGNUM-LOGAND for x8664.
Use these new functions to implement the loops in the bignum/bignum
cases of LOGIOR/LOGAND.

Location:
trunk/source/level-0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/X86/X8664/x8664-bignum.lisp

    r13067 r13419  
    332332    (single-value-return)))
    333333
    334 
    335 
     334;;; Do LOGIOR on the N 32-bit words in A and B, storing the result in
     335;;; C.  (It's legal and desirable to do this more than 32 bits at a time.)
     336
     337(defx86lapfunction %bignum-logior ((n 8) #|ra 0|# (a arg_x) (b arg_y) (c arg)z)
     338  (movq (@ n (% rsp)) (% imm0))
     339  (shrq (% imm0))
     340  (jmp @test)
     341  @loop
     342  (movl (@ x8664::misc-data-offset (% a) (% imm0)) (%l imm1))
     343  (orl (@ x8664::misc-data-offset (% b) (% imm0)) (%l imm1))
     344  (movl (%l imm1) (@ x8664::misc-data-offset (% c) (% imm0)))
     345  (subq ($  4) (% imm0))
     346  @test
     347  (jne @loop)
     348  (single-value-return 3))
     349
     350
     351
     352;;; Do LOGAND on the N 32-bit words in A and B, storing the result in
     353;;; C.  (It's legal and desirable to do this more than 32 bits at a time.)
     354
     355(defx86lapfunction %bignum-logand ((n 8) #|ra 0|# (a arg_x) (b arg_y) (c arg)z)
     356  (movq (@ n (% rsp)) (% imm0))
     357  (shrq (% imm0))
     358  (jmp @test)
     359  @loop
     360  (movl (@ x8664::misc-data-offset (% a) (% imm0)) (%l imm1))
     361  (andl (@ x8664::misc-data-offset (% b) (% imm0)) (%l imm1))
     362  (movl (%l imm1) (@ x8664::misc-data-offset (% c) (% imm0)))
     363  (subq ($  4) (% imm0))
     364  @test
     365  (jne @loop)
     366  (single-value-return 3))
     367
  • trunk/source/level-0/l0-bignum64.lisp

    r13327 r13419  
    12861286  (declare (type bignum-type a b res)
    12871287           (type bignum-index len-a))
    1288   (dotimes (i len-a)
    1289     (setf (bignum-ref res i)
    1290           (logand (the fixnum (bignum-ref a i))
    1291                   (the fixnum (bignum-ref b i)))))
     1288  (%bignum-logand len-a a b res)
    12921289  (%normalize-bignum-macro res))
    12931290
     
    13011298  (declare (type bignum-type a b res)
    13021299           (type bignum-index len-a len-b))
    1303   (dotimes (i len-a)
    1304     (setf (bignum-ref res i)
    1305           (logand (the fixnum (bignum-ref a i))
    1306                               (the fixnum (bignum-ref b i)))))
     1300  (%bignum-logand len-a a b res)
    13071301  (bignum-replace res b :start1 len-a :start2 len-a :end1 len-b :end2 len-b)
    13081302  (%normalize-bignum-macro res))
     
    14321426  (declare (type bignum-type a b res)
    14331427           (type bignum-index len-a len-b))
    1434   (dotimes (i len-a)
    1435     (setf (bignum-ref res i)
    1436           (logior (the fixnum (bignum-ref a i))
    1437                   (the fixnum (bignum-ref b i)))))
     1428  (%bignum-logior len-a a b res)
    14381429  (if (not (eql len-a len-b))
    14391430    (bignum-replace res b :start1 len-a :start2 len-a :end1 len-b :end2 len-b))
     
    14491440  (declare (type bignum-type a b res)
    14501441           (type bignum-index len-a len-b))
    1451   (dotimes (i len-a)
    1452     (setf (bignum-ref res i)
    1453           (logior (the fixnum (bignum-ref a i))
    1454                   (the fixnum (bignum-ref b i)))))
     1442  (%bignum-logior len-a a b res)
    14551443  (do ((i len-a (1+ i)))
    14561444      ((= i len-b))
Note: See TracChangeset for help on using the changeset viewer.