- `(define-assembly-routine (,name
- (:cost 10)
- (:return-style :full-call)
- (:policy :safe)
- (:translate ,translate)
- (:save-p t))
- ((:arg x (descriptor-reg any-reg) rdx-offset)
- (:arg y (descriptor-reg any-reg) rdi-offset)
-
- (:res res descriptor-reg rdx-offset)
-
- (:temp eax unsigned-reg rax-offset)
- (:temp ecx unsigned-reg rcx-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 7)
- (inst jmp :nz TAIL-CALL-TO-STATIC-FN)
- (inst test y 7)
- (inst jmp :z INLINE-FIXNUM-COMPARE)
-
- TAIL-CALL-TO-STATIC-FN
- (inst pop eax)
- (inst push rbp-tn)
- (inst lea rbp-tn (make-ea :qword
- :base rsp-tn
- :disp n-word-bytes))
- (inst sub rsp-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 :qword
- :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 3)
- (inst jmp eax)
-
- RETURN-TRUE
- (load-symbol res t))))
+ (declare (ignorable translate static-fn))
+ #+sb-assembling
+ `(define-assembly-routine (,name
+ (:return-style :none))
+ ((:arg x (descriptor-reg any-reg) rdx-offset)
+ (:arg y (descriptor-reg any-reg) rdi-offset)
+
+ (:temp rcx unsigned-reg rcx-offset))
+
+ (inst mov rcx x)
+ (inst or rcx y)
+ (inst test rcx fixnum-tag-mask)
+ (inst jmp :nz DO-STATIC-FUN) ; are both fixnums?
+
+ (inst cmp x y)
+ (inst ret)
+
+ DO-STATIC-FUN
+ (inst sub rsp-tn (fixnumize 3))
+ (inst mov (make-ea :qword :base rsp-tn
+ :disp (frame-byte-offset
+ (+ sp->fp-offset
+ -3
+ ocfp-save-offset)))
+ rbp-tn)
+ (inst lea rbp-tn (make-ea :qword :base rsp-tn
+ :disp (frame-byte-offset
+ (+ sp->fp-offset
+ -3
+ ocfp-save-offset))))
+ (inst mov rcx (fixnumize 2))
+ (inst call (make-ea :qword
+ :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 rdx)
+ (y :scs (descriptor-reg any-reg) :target rdi))
+
+ (:temporary (:sc unsigned-reg :offset rdx-offset
+ :from (:argument 0))
+ rdx)
+ (:temporary (:sc unsigned-reg :offset rdi-offset
+ :from (:argument 1))
+ rdi)
+
+ (:temporary (:sc unsigned-reg :offset rcx-offset
+ :from :eval)
+ rcx)
+ (:conditional ,test)
+ (:generator 10
+ (move rdx x)
+ (move rdi y)
+ (inst lea rcx (make-ea :qword
+ :disp (make-fixup ',name :assembly-routine)))
+ (inst call rcx)))))