Ignore:
Timestamp:
Dec 4, 2006, 7:46:36 PM (14 years ago)
Author:
gb
Message:

Ensure that %ASHL handles shift count of 32 (and returns 0 in that case.)

File:
1 edited

Legend:

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

    r4153 r5588  
    9797;;; resulting from dividing hi:low by divisor.
    9898;;; We only have two immediate registers, and -have- to use them
    99 ;;; to represent hi:low.  We -can- store the unboxed divisor in
    100 ;;; %ebp, if we commit to the idea that %rbp will never be traced
    101 ;;; by the GC.  I'm willing to commit to that for x8664, since
    102 ;;; this is an example of not having enough imm regs.  We do need
    103 ;;; to save/restore %rbp, but hopefully we can do wo without
    104 ;;; hitting memory.
     99;;; to represent hi:low.  Keep the unboxed divisor in the high
     100;;; word of a fixnum on the top of the stack.  (That's probably
     101;;; slower than using %rbp, but clobbering %rbp confuses backtrace).
    105102;;; For x8632, we'll probably have to mark something (%ecx ?) as
    106103;;; being "temporarily unboxed" by mucking with some bits in the
     
    109106  (let ((unboxed-high imm1)
    110107        (unboxed-low imm0)
    111         (unboxed-divisor ebp)
    112108        (unboxed-quo imm0)
    113109        (unboxed-rem imm1))
    114     (movd (% rbp) (% mm0))
    115     (unbox-fixnum divisor rbp)
     110    (unbox-fixnum divisor imm0)
     111    (pushq ($ 0))
     112    (movl (%l imm0) (@ 4 (% rsp)))
    116113    (unbox-fixnum num-high unboxed-high)
    117114    (unbox-fixnum num-low unboxed-low)
    118     (divl (% ebp))
    119     (movd (% mm0) (% rbp))
     115    (divl (@ 4 (% rsp)))
     116    (addq ($ 8) (% rsp))
    120117    (box-fixnum unboxed-quo arg_y)
    121118    (box-fixnum unboxed-rem arg_z)
     
    205202;;; Again, we're out of imm regs: a variable shift count has to go in %cl.
    206203;;; Make sure that the rest of %rcx is 0, to keep the GC happy.
    207 ;;; %rcx == temp1
     204;;; %rcx == temp2
    208205(defx86lapfunction %digit-logical-shift-right ((digit arg_y) (count arg_z))
    209206  (unbox-fixnum digit imm0)
     
    215212  (box-fixnum imm0 arg_z)
    216213  (single-value-return))
     214
     215
    217216
    218217(defx86lapfunction %ashr ((digit arg_y) (count arg_z))
     
    232231  (xorq (% temp2) (% temp2))
    233232  (movb (% imm1.b) (% temp2.b))
    234   (shll (% temp2.b) (%l imm0))
     233  (shlq (% temp2.b) (% imm0))
    235234  (movb ($ 0) (% temp2.b)) 
    236235  (movl (%l imm0) (%l imm0))            ;zero-extend
Note: See TracChangeset for help on using the changeset viewer.