4 (define-assembly-routine (generic-+
6 (:return-style :full-call)
10 ((:arg x (descriptor-reg any-reg) a0-offset)
11 (:arg y (descriptor-reg any-reg) a1-offset)
13 (:res res (descriptor-reg any-reg) a0-offset)
15 (:temp temp non-descriptor-reg nl0-offset)
16 (:temp lip interior-reg lip-offset)
17 (:temp lra descriptor-reg lra-offset)
18 (:temp nargs any-reg nargs-offset)
19 (:temp ocfp any-reg ocfp-offset))
20 (inst b DO-STATIC-FUN)
25 (inst bne temp DO-STATIC-FUN)
27 (inst bne temp DO-STATIC-FUN)
30 (lisp-return lra lip :offset 2))
33 (inst lw lip null-tn (static-fun-offset 'two-arg-+))
34 (inst li nargs (fixnumize 2))
35 (inst move ocfp cfp-tn)
37 (inst move cfp-tn csp-tn))
40 (define-assembly-routine (generic--
42 (:return-style :full-call)
46 ((:arg x (descriptor-reg any-reg) a0-offset)
47 (:arg y (descriptor-reg any-reg) a1-offset)
49 (:res res (descriptor-reg any-reg) a0-offset)
51 (:temp temp non-descriptor-reg nl0-offset)
52 (:temp lip interior-reg lip-offset)
53 (:temp lra descriptor-reg lra-offset)
54 (:temp nargs any-reg nargs-offset)
55 (:temp ocfp any-reg ocfp-offset))
56 (inst b DO-STATIC-FUN)
61 (inst bne temp DO-STATIC-FUN)
63 (inst bne temp DO-STATIC-FUN)
66 (lisp-return lra lip :offset 2))
69 (inst lw lip null-tn (static-fun-offset 'two-arg--))
70 (inst li nargs (fixnumize 2))
71 (inst move ocfp cfp-tn)
73 (inst move cfp-tn csp-tn))
76 (define-assembly-routine (generic-*
78 (:return-style :full-call)
82 ((:arg x (descriptor-reg any-reg) a0-offset)
83 (:arg y (descriptor-reg any-reg) a1-offset)
85 (:res res (descriptor-reg any-reg) a0-offset)
87 (:temp temp non-descriptor-reg nl0-offset)
88 (:temp lo non-descriptor-reg nl1-offset)
89 (:temp hi non-descriptor-reg nl2-offset)
90 (:temp pa-flag non-descriptor-reg nl4-offset)
91 (:temp lip interior-reg lip-offset)
92 (:temp lra descriptor-reg lra-offset)
93 (:temp nargs any-reg nargs-offset)
94 (:temp ocfp any-reg ocfp-offset))
95 ;; If either arg is not a fixnum, call the static function.
97 (inst bne temp DO-STATIC-FUN)
99 (inst bne temp DO-STATIC-FUN)
102 ;; Remove the tag from one arg so that the result will have the correct
108 ;; Check to see if the result will fit in a fixnum. (I.e. the high word
109 ;; is just 32 copies of the sign bit of the low word).
110 (inst sra temp res 31)
113 ;; Shift the double word hi:res down two bits into hi:low to get rid of the
116 (inst sll temp hi 30)
120 ;; Do we need one word or two? Assume two.
121 (inst sra temp lo 31)
123 (inst bne temp two-words)
124 ;; Assume a two word header.
125 (inst li temp (logior (ash 2 n-widetag-bits) bignum-widetag))
127 ;; Only need one word, fix the header.
128 (inst li temp (logior (ash 1 n-widetag-bits) bignum-widetag))
130 (pseudo-atomic (pa-flag :extra (pad-data-block (+ 1 bignum-digits-offset)))
131 (inst or res alloc-tn other-pointer-lowtag)
132 (storew temp res 0 other-pointer-lowtag))
134 (storew lo res bignum-digits-offset other-pointer-lowtag)
137 (lisp-return lra lip :offset 2)
141 (pseudo-atomic (pa-flag :extra (pad-data-block (+ 2 bignum-digits-offset)))
142 (inst or res alloc-tn other-pointer-lowtag)
143 (storew temp res 0 other-pointer-lowtag))
145 (storew lo res bignum-digits-offset other-pointer-lowtag)
146 (storew hi res (1+ bignum-digits-offset) other-pointer-lowtag)
149 (lisp-return lra lip :offset 2)
153 (inst lw lip null-tn (static-fun-offset 'two-arg-*))
154 (inst li nargs (fixnumize 2))
155 (inst move ocfp cfp-tn)
157 (inst move cfp-tn csp-tn)
163 ;;;; Comparison routines.
166 ((define-cond-assem-rtn (name translate static-fn cmp not-p)
167 `(define-assembly-routine (,name
169 (:return-style :full-call)
171 (:translate ,translate)
173 ((:arg x (descriptor-reg any-reg) a0-offset)
174 (:arg y (descriptor-reg any-reg) a1-offset)
176 (:res res descriptor-reg a0-offset)
178 (:temp temp non-descriptor-reg nl0-offset)
179 (:temp lip interior-reg lip-offset)
180 (:temp nargs any-reg nargs-offset)
181 (:temp ocfp any-reg ocfp-offset))
183 (inst bne temp DO-STATIC-FN)
185 (inst beq temp DO-COMPARE)
189 (inst lw lip null-tn (static-fun-offset ',static-fn))
190 (inst li nargs (fixnumize 2))
191 (inst move ocfp cfp-tn)
193 (inst move cfp-tn csp-tn)
196 (inst ,(if not-p 'bne 'beq) temp done)
197 (inst move res null-tn)
201 (define-cond-assem-rtn generic-< < two-arg-< (inst slt temp x y) nil)
202 (define-cond-assem-rtn generic-> > two-arg-> (inst slt temp y x) nil))
205 (define-assembly-routine (generic-eql
207 (:return-style :full-call)
211 ((:arg x (descriptor-reg any-reg) a0-offset)
212 (:arg y (descriptor-reg any-reg) a1-offset)
214 (:res res descriptor-reg a0-offset)
216 (:temp temp non-descriptor-reg nl0-offset)
217 (:temp lip interior-reg lip-offset)
218 (:temp lra descriptor-reg lra-offset)
219 (:temp nargs any-reg nargs-offset)
220 (:temp ocfp any-reg ocfp-offset))
221 (inst beq x y RETURN-T)
223 (inst beq temp RETURN-NIL)
225 (inst bne temp DO-STATIC-FN)
229 (inst move res null-tn)
230 (lisp-return lra lip :offset 2)
233 (inst lw lip null-tn (static-fun-offset 'eql))
234 (inst li nargs (fixnumize 2))
235 (inst move ocfp cfp-tn)
237 (inst move cfp-tn csp-tn)
242 (define-assembly-routine (generic-=
244 (:return-style :full-call)
248 ((:arg x (descriptor-reg any-reg) a0-offset)
249 (:arg y (descriptor-reg any-reg) a1-offset)
251 (:res res descriptor-reg a0-offset)
253 (:temp temp non-descriptor-reg nl0-offset)
254 (:temp lip interior-reg lip-offset)
255 (:temp lra descriptor-reg lra-offset)
256 (:temp nargs any-reg nargs-offset)
257 (:temp ocfp any-reg ocfp-offset))
259 (inst bne temp DO-STATIC-FN)
261 (inst bne temp DO-STATIC-FN)
263 (inst beq x y RETURN-T)
265 (inst move res null-tn)
266 (lisp-return lra lip :offset 2)
269 (inst lw lip null-tn (static-fun-offset 'two-arg-=))
270 (inst li nargs (fixnumize 2))
271 (inst move ocfp cfp-tn)
273 (inst move cfp-tn csp-tn)
278 (define-assembly-routine (generic-/=
280 (:return-style :full-call)
284 ((:arg x (descriptor-reg any-reg) a0-offset)
285 (:arg y (descriptor-reg any-reg) a1-offset)
287 (:res res descriptor-reg a0-offset)
289 (:temp temp non-descriptor-reg nl0-offset)
290 (:temp lip interior-reg lip-offset)
291 (:temp lra descriptor-reg lra-offset)
292 (:temp nargs any-reg nargs-offset)
293 (:temp ocfp any-reg ocfp-offset))
295 (inst bne temp DO-STATIC-FN)
297 (inst bne temp DO-STATIC-FN)
299 (inst beq x y RETURN-NIL)
302 (lisp-return lra lip :offset 2)
305 (inst lw lip null-tn (static-fun-offset 'two-arg-=))
306 (inst li nargs (fixnumize 2))
307 (inst move ocfp cfp-tn)
309 (inst move cfp-tn csp-tn)
312 (inst move res null-tn))