X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fassembly%2Fx86%2Farith.lisp;h=ea10b508a400d165ace349455ced6d15b27bb185;hb=6c296da561efd25c22e051a1e55080d9689f3ecc;hp=f3081f82456079e53c2394b1126fe2ec5354b536;hpb=d95f1e6476aa63695e018a7769a1ae9e002fca36;p=sbcl.git diff --git a/src/assembly/x86/arith.lisp b/src/assembly/x86/arith.lisp index f3081f8..ea10b50 100644 --- a/src/assembly/x86/arith.lisp +++ b/src/assembly/x86/arith.lisp @@ -21,9 +21,7 @@ (:policy :safe) (:save-p t)) ((:arg x (descriptor-reg any-reg) edx-offset) - (:arg y (descriptor-reg any-reg) - ;; this seems wrong esi-offset -- FIXME: What's it mean? - edi-offset) + (:arg y (descriptor-reg any-reg) edi-offset) (:res res (descriptor-reg any-reg) edx-offset) @@ -40,13 +38,12 @@ (inst ret) DO-STATIC-FUN - (inst pop eax) + ;; Same as: (inst enter (fixnumize 1)) (inst push ebp-tn) - (inst lea - ebp-tn - (make-ea :dword :base esp-tn :disp n-word-bytes)) - (inst sub esp-tn (fixnumize 2)) - (inst push eax) ; callers return addr + (inst mov ebp-tn esp-tn) + (inst sub esp-tn (fixnumize 1)) + (inst push (make-ea :dword :base ebp-tn + :disp (frame-byte-offset return-pc-save-offset))) (inst mov ecx (fixnumize 2)) ; arg count (inst jmp (make-ea :dword @@ -86,7 +83,7 @@ (move eax x) ; must use eax for 64-bit result (inst sar eax n-fixnum-tag-bits) ; remove *4 fixnum bias (inst imul y) ; result in edx:eax - (inst jmp :no okay) ; still fixnum + (inst jmp :no OKAY) ; still fixnum ;; zzz jrd changed edx to ebx in here, as edx isn't listed as a temp, above ;; pfw says that loses big -- edx is target for arg x and result res @@ -130,11 +127,11 @@ (inst test x fixnum-tag-mask) (inst jmp :z FIXNUM) - (inst pop eax) (inst push ebp-tn) - (inst lea ebp-tn (make-ea :dword :base esp-tn :disp n-word-bytes)) - (inst sub esp-tn (fixnumize 2)) - (inst push eax) + (inst mov ebp-tn esp-tn) + (inst sub esp-tn (fixnumize 1)) + (inst push (make-ea :dword :base ebp-tn + :disp (frame-byte-offset return-pc-save-offset))) (inst mov ecx (fixnumize 1)) ; arg count (inst jmp (make-ea :dword :disp (+ nil-value (static-fun-offset '%negate)))) @@ -171,12 +168,20 @@ (inst ret) DO-STATIC-FUN - (move ecx esp-tn) + (inst push ebp-tn) + (inst mov ebp-tn esp-tn) (inst sub esp-tn (fixnumize 3)) - (inst mov (make-ea :dword - :base ecx :disp (fixnumize -1)) + (inst mov (make-ea :dword :base esp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset))) ebp-tn) - (move ebp-tn ecx) + (inst lea ebp-tn (make-ea :dword :base esp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset)))) (inst mov ecx (fixnumize 2)) (inst call (make-ea :dword :disp (+ nil-value @@ -187,9 +192,10 @@ (:l `((inst mov y (1+ nil-value)) (inst cmp y x))) (:g `((inst cmp x (1+ nil-value))))) + (inst pop ebp-tn) (inst ret)) #-sb-assembling - `(define-vop (,name) + `(define-vop (,name) (:translate ,translate) (:policy :safe) (:save-p t) @@ -202,17 +208,11 @@ (:temporary (:sc unsigned-reg :offset edi-offset :from (:argument 1)) edi) - - (:temporary (:sc unsigned-reg :offset ecx-offset - :from :eval) - ecx) (:conditional ,test) (:generator 10 (move edx x) (move edi y) - (inst lea ecx (make-ea :dword - :disp (make-fixup ',name :assembly-routine))) - (inst call ecx))))) + (inst call (make-fixup ',name :assembly-routine)))))) (define-cond-assem-rtn generic-< < two-arg-< :l) (define-cond-assem-rtn generic-> > two-arg-> :g)) @@ -230,7 +230,7 @@ (inst cmp ecx other-pointer-lowtag) (inst jmp :e DO-STATIC-FUN) - ;; Not both other pointers + ;; At least one fixnum (inst cmp x y) RET (inst ret) @@ -240,18 +240,26 @@ (inst cmp x y) (inst jmp :e RET) - (move ecx esp-tn) + (inst push ebp-tn) + (inst mov ebp-tn esp-tn) (inst sub esp-tn (fixnumize 3)) - (inst mov (make-ea :dword - :base ecx - :disp (fixnumize -1)) + (inst mov (make-ea :dword :base esp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset))) ebp-tn) - (move ebp-tn ecx) + (inst lea ebp-tn (make-ea :dword :base esp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset)))) (inst mov ecx (fixnumize 2)) (inst call (make-ea :dword :disp (+ nil-value (static-fun-offset 'eql)))) (load-symbol y t) (inst cmp x y) + (inst pop ebp-tn) (inst ret)) #-sb-assembling @@ -269,16 +277,11 @@ :from (:argument 1)) edi) - (:temporary (:sc unsigned-reg :offset ecx-offset - :from :eval) - ecx) (:conditional :e) (:generator 10 (move edx x) (move edi y) - (inst lea ecx (make-ea :dword - :disp (make-fixup 'generic-eql :assembly-routine))) - (inst call ecx))) + (inst call (make-fixup 'generic-eql :assembly-routine)))) #+sb-assembling (define-assembly-routine (generic-= @@ -297,18 +300,26 @@ (inst ret) DO-STATIC-FUN - (move ecx esp-tn) + (inst push ebp-tn) + (inst mov ebp-tn esp-tn) (inst sub esp-tn (fixnumize 3)) - (inst mov (make-ea :dword - :base ecx - :disp (fixnumize -1)) + (inst mov (make-ea :dword :base esp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset))) ebp-tn) - (move ebp-tn ecx) + (inst lea ebp-tn (make-ea :dword :base esp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset)))) (inst mov ecx (fixnumize 2)) (inst call (make-ea :dword :disp (+ nil-value (static-fun-offset 'two-arg-=)))) (load-symbol y t) (inst cmp x y) + (inst pop ebp-tn) (inst ret)) #-sb-assembling @@ -326,16 +337,11 @@ :from (:argument 1)) edi) - (:temporary (:sc unsigned-reg :offset ecx-offset - :from :eval) - ecx) (:conditional :e) (:generator 10 (move edx x) (move edi y) - (inst lea ecx (make-ea :dword - :disp (make-fixup 'generic-= :assembly-routine))) - (inst call ecx))) + (inst call (make-fixup 'generic-= :assembly-routine)))) ;;; Support for the Mersenne Twister, MT19937, random number generator