1.0.16.34: Remove global STACK-ALLOCATE-VALUE-CELLS proclamation in make-host-2.lisp
[sbcl.git] / src / assembly / x86 / arith.lisp
index 1365fba..33c0439 100644 (file)
 
                 INLINE-FIXNUM-COMPARE
                 (inst cmp x y)
-                (inst jmp ,test RETURN-TRUE)
                 (inst mov res nil-value)
-                ;; FIXME: A note explaining this return convention, or a
-                ;; symbolic name for it, would be nice. (It looks as though we
-                ;; should be hand-crafting the same return sequence as would be
-                ;; produced by GENERATE-RETURN-SEQUENCE, but in that case it's
-                ;; not clear why we don't just jump to the end of this function
-                ;; to share the return sequence there.
-                (inst pop eax)
-                (inst add eax 2)
-                (inst jmp eax)
+                (inst jmp ,test RETURN-FALSE)
+
+                (load-symbol res t)
 
-                RETURN-TRUE
-                (load-symbol res t))))
+                RETURN-FALSE
+                DONE)))
 
-  (define-cond-assem-rtn generic-< < two-arg-< :l)
-  (define-cond-assem-rtn generic-> > two-arg-> :g))
+  (define-cond-assem-rtn generic-< < two-arg-< :ge)
+  (define-cond-assem-rtn generic-> > two-arg-> :le))
 
 (define-assembly-routine (generic-eql
                           (:cost 10)
 
   RETURN-NIL
   (inst mov res nil-value)
-  (inst pop eax)
-  (inst add eax 2)
-  (inst jmp eax)
+  (inst jmp DONE)
 
   DO-STATIC-FN
   (inst pop eax)
 
   RETURN-T
   (load-symbol res t)
-  ;; FIXME: I don't understand how we return from here..
-  )
+
+  DONE)
 
 (define-assembly-routine (generic-=
                           (:cost 10)
   (inst jmp :e RETURN-T)                ; ok
 
   (inst mov res nil-value)
-  (inst pop eax)
-  (inst add eax 2)
-  (inst jmp eax)
+  (inst jmp DONE)
 
   DO-STATIC-FN
   (inst pop eax)
                      :disp (+ nil-value (static-fun-offset 'two-arg-=))))
 
   RETURN-T
-  (load-symbol res t))
+  (load-symbol res t)
+
+  DONE)
 
 \f
 ;;; Support for the Mersenne Twister, MT19937, random number generator
   ;; Generate a new set of results.
   (inst xor k k)
   LOOP1
-  (inst mov y (make-ea :dword :base state :index k :scale 4
-                       :disp (- (* (+ 3 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))
-  (inst mov tmp (make-ea :dword :base state :index k :scale 4
-                         :disp (- (* (+ 1 3 vector-data-offset)
-                                     n-word-bytes)
-                                  other-pointer-lowtag)))
+  (inst mov y (make-ea-for-vector-data state :index k :offset 3))
+  (inst mov tmp (make-ea-for-vector-data state :index k :offset (+ 1 3)))
   (inst and y #x80000000)
   (inst and tmp #x7fffffff)
   (inst or y tmp)
   (inst jmp :nc skip1)
   (inst xor y #x9908b0df)
   SKIP1
-  (inst xor y (make-ea :dword :base state :index k :scale 4
-                       :disp (- (* (+ 397 3 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))
-  (inst mov (make-ea :dword :base state :index k :scale 4
-                     :disp (- (* (+ 3 vector-data-offset)
-                                 n-word-bytes)
-                              other-pointer-lowtag))
-        y)
+  (inst xor y (make-ea-for-vector-data state :index k :offset (+ 397 3)))
+  (inst mov (make-ea-for-vector-data state :index k :offset 3) y)
   (inst inc k)
   (inst cmp k (- 624 397))
   (inst jmp :b loop1)
   LOOP2
-  (inst mov y (make-ea :dword :base state :index k :scale 4
-                       :disp (- (* (+ 3 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))
-  (inst mov tmp (make-ea :dword :base state :index k :scale 4
-                         :disp (- (* (+ 1 3 vector-data-offset)
-                                     n-word-bytes)
-                                  other-pointer-lowtag)))
+  (inst mov y (make-ea-for-vector-data state :index k :offset 3))
+  (inst mov tmp (make-ea-for-vector-data state :index k :offset (+ 1 3)))
   (inst and y #x80000000)
   (inst and tmp #x7fffffff)
   (inst or y tmp)
   (inst jmp :nc skip2)
   (inst xor y #x9908b0df)
   SKIP2
-  (inst xor y (make-ea :dword :base state :index k :scale 4
-                       :disp (- (* (+ (- 397 624) 3 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))
-  (inst mov (make-ea :dword :base state :index k :scale 4
-                     :disp (- (* (+ 3 vector-data-offset)
-                                 n-word-bytes)
-                              other-pointer-lowtag))
-        y)
+  (inst xor y (make-ea-for-vector-data state :index k :offset (+ (- 397 624) 3)))
+  (inst mov (make-ea-for-vector-data state :index k :offset 3) y)
   (inst inc k)
   (inst cmp k (- 624 1))
   (inst jmp :b loop2)
 
-  (inst mov y (make-ea :dword :base state
-                       :disp (- (* (+ (- 624 1) 3 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))
-  (inst mov tmp (make-ea :dword :base state
-                         :disp (- (* (+ 0 3 vector-data-offset)
-                                     n-word-bytes)
-                                  other-pointer-lowtag)))
+  (inst mov y (make-ea-for-vector-data state :offset (+ (- 624 1) 3)))
+  (inst mov tmp (make-ea-for-vector-data state :offset (+ 0 3)))
   (inst and y #x80000000)
   (inst and tmp #x7fffffff)
   (inst or y tmp)
   (inst jmp :nc skip3)
   (inst xor y #x9908b0df)
   SKIP3
-  (inst xor y (make-ea :dword :base state
-                       :disp (- (* (+ (- 397 1) 3 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))
-  (inst mov (make-ea :dword :base state
-                     :disp (- (* (+ (- 624 1) 3 vector-data-offset)
-                                 n-word-bytes)
-                              other-pointer-lowtag))
-        y)
+  (inst xor y (make-ea-for-vector-data state :offset (+ (- 397 1) 3)))
+  (inst mov (make-ea-for-vector-data state :offset (+ (- 624 1) 3)) y)
 
   ;; Restore the temporary registers and return.
   (inst pop tmp)