- `(define-assembly-routine (,name
- (:cost 10)
- (:return-style :full-call)
- (:policy :safe)
- (:translate ,translate)
- (:save-p t))
- ((:arg x (descriptor-reg any-reg) edx-offset)
- (:arg y (descriptor-reg any-reg) edi-offset)
-
- (:res res descriptor-reg edx-offset)
-
- (:temp eax unsigned-reg eax-offset)
- (:temp ecx unsigned-reg ecx-offset))
-
- ;; KLUDGE: The "3" here is a mask for the bits which will be
- ;; zero in a fixnum. It should have a symbolic name. (Actually,
- ;; it might already have a symbolic name which the coder
- ;; couldn't be bothered to use..) -- WHN 19990917
- (inst test x 3)
- (inst jmp :nz TAIL-CALL-TO-STATIC-FN)
- (inst test y 3)
- (inst jmp :z INLINE-FIXNUM-COMPARE)
-
- TAIL-CALL-TO-STATIC-FN
- (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)) ; FIXME: Push 2 words on stack,
- ; weirdly?
- (inst push eax)
- (inst mov ecx (fixnumize 2)) ; FIXME: FIXNUMIZE and
- ; SINGLE-FLOAT-BITS are parallel,
- ; should be named parallelly.
- (inst jmp (make-ea :dword
- :disp (+ nil-value
- (static-fun-offset ',static-fn))))
-
- 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)
-
- RETURN-TRUE
- (load-symbol res t))))
+ #+sb-assembling
+ `(define-assembly-routine (,name
+ (:return-style :none))
+ ((:arg x (descriptor-reg any-reg) edx-offset)
+ (:arg y (descriptor-reg any-reg) edi-offset)
+
+ (:temp ecx unsigned-reg ecx-offset))
+
+ (inst mov ecx x)
+ (inst or ecx y)
+ (inst test ecx fixnum-tag-mask)
+ (inst jmp :nz DO-STATIC-FUN) ; are both fixnums?
+
+ (inst cmp x y)
+ (inst ret)
+
+ DO-STATIC-FUN
+ (move ecx esp-tn)
+ (inst sub esp-tn (fixnumize 3))
+ (inst mov (make-ea :dword
+ :base ecx :disp (fixnumize -1))
+ ebp-tn)
+ (move ebp-tn ecx)
+ (inst mov ecx (fixnumize 2))
+ (inst call (make-ea :dword
+ :disp (+ nil-value
+ (static-fun-offset ',static-fn))))
+ ;; HACK: We depend on NIL having the lowest address of all
+ ;; static symbols (including T)
+ ,@(ecase test
+ (:l `((inst mov y (1+ nil-value))
+ (inst cmp y x)))
+ (:g `((inst cmp x (1+ nil-value)))))
+ (inst ret))
+ #-sb-assembling
+ `(define-vop (,name)
+ (:translate ,translate)
+ (:policy :safe)
+ (:save-p t)
+ (:args (x :scs (descriptor-reg any-reg) :target edx)
+ (y :scs (descriptor-reg any-reg) :target edi))
+
+ (:temporary (:sc unsigned-reg :offset edx-offset
+ :from (:argument 0))
+ edx)
+ (: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)))))