Changeset 10923


Ignore:
Timestamp:
Sep 30, 2008, 8:50:09 PM (11 years ago)
Author:
rme
Message:

In %SUBTRACT-WITH-BORROW-1, zero-extend the borrow into the entire
register (the setae instruction only affects the low byte).

This should fix the bug in ticket:341.

Other stuff I noticed while I was in there:

Make %SUBTRACT-ONE work. In %FLOOR-99, swap use of %temp0/%temp1 to
make the comment at @more about temp1 containing a fixnum code be true (and
not incidentally, make the code gc-safe).

File:
1 edited

Legend:

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

    r10575 r10923  
    217217
    218218(defx8632lapfunction %subtract-one ((high arg_y) (low arg_z))
    219   (mark-as-imm temp0)
     219  (shll ($ (- 16 x8632::fixnumshift)) (% arg_y))
    220220  (unbox-fixnum low imm0)
    221   (movl (% high) (% temp0))
    222   (shll ($ (- 16 x8632::fixnumshift)) (% temp0))
    223   (orl (% imm0) (% temp0))
    224   (subl ($ 1) (% temp0))
    225   (movzwl (% temp0.w) (% imm0))
    226   (box-fixnum imm0 low)
    227   (sarl ($ 16) (% temp0))
    228   (box-fixnum temp0 high)
    229   (mark-as-node temp0)
     221  ;; high half should always be clear...
     222  ;;(movzwl (% imm0.w) (% imm0))
     223  (orl (% arg_y) (% imm0))
     224  (decl (% imm0))
    230225  (movl (% esp) (% temp0))
    231   (push (% high))
    232   (push (% low))
     226  ;; extract and push high half
     227  (movl ($ (- #x10000)) (% arg_y))
     228  (andl (% imm0) (% arg_y))
     229  (shrl ($ (- 16 x8632::fixnumshift)) (% arg_y))
     230  (push (% arg_y))
     231  ;; low half
     232  (andl ($ #xffff) (% imm0))
     233  (shll ($ x8632::fixnumshift) (% imm0))
     234  (push (% imm0))
     235  (set-nargs 2)
    233236  (jmp-subprim .SPvalues))
    234237
     
    261264  (sbbl (% temp0) (% temp1))
    262265  (setae (%b imm0))                     ;resulting borrow (1 for no, 0 for yes)
     266  (movzbl (%b imm0) (% imm0))
    263267  (box-fixnum imm0 arg_z)
    264268  (movl (% temp1) (% imm0))
     
    935939(defx8632lapfunction %floor-99 ((x-stk 8) (xidx 4) #|(ra 0)|#
    936940                                (yptr arg_y) (yidx arg_z))
     941  (pop (% temp1))
     942  (pop (% imm0))
    937943  (pop (% temp0))
    938   (pop (% imm0))
    939   (pop (% temp1))
    940944  (discard-reserved-frame)
    941   (push (% temp0))
    942   (movl (% imm0) (% temp0))
    943   (movl (@ x8632::misc-data-offset (% temp1) (% temp0)) (% imm0)) ;x[i]
     945  (push (% temp1))
     946  (movl (% imm0) (% temp1))
     947  (movl (@ x8632::misc-data-offset (% temp0) (% temp1)) (% imm0)) ;x[i]
    944948  (cmpl (% imm0) (@ x8632::misc-data-offset (% yptr) (% yidx)))   ;y[j]
    945949  (jne @more)
     
    951955  @more
    952956  (mark-as-imm edx)                     ;aka temp1 (contains a fixnum)
    953   (movl (@ (- x8632::misc-data-offset 4) (% temp1) (% temp0)) (% eax)) ;low
    954   (movl (@ x8632::misc-data-offset (% temp1) (% temp0)) (% edx))    ;high digit
     957  (movl (@ (- x8632::misc-data-offset 4) (% temp0) (% temp1)) (% eax)) ;low
     958  (movl (@ x8632::misc-data-offset (% temp0) (% temp1)) (% edx))    ;high digit
    955959  (divl (@ x8632::misc-data-offset (% yptr) (% yidx)))
    956960  (mark-as-node edx)
Note: See TracChangeset for help on using the changeset viewer.