0.8.18.14:
[sbcl.git] / src / assembly / x86-64 / alloc.lisp
1 ;;;; allocating simple objects
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
11
12 (in-package "SB!VM")
13 \f
14 ;;;; from signed/unsigned
15
16 ;;; KLUDGE: Why don't we want vops for this one and the next
17 ;;; one? -- WHN 19990916
18 #+sb-assembling ; We don't want a vop for this one.
19 (define-assembly-routine
20     (move-from-signed)
21     ((:temp eax unsigned-reg eax-offset)
22      (:temp ebx unsigned-reg ebx-offset))
23   (inst mov ebx eax)
24   (inst shl ebx 1)
25   (inst jmp :o bignum)
26   (inst shl ebx 1)
27   (inst jmp :o bignum)
28   (inst shl ebx 1)
29   (inst jmp :o bignum)
30   (inst ret)
31   BIGNUM
32
33   (with-fixed-allocation (ebx bignum-widetag (+ bignum-digits-offset 1))
34     (storew eax ebx bignum-digits-offset other-pointer-lowtag))
35
36   (inst ret))
37
38 #+sb-assembling ; We don't want a vop for this one either.
39 (define-assembly-routine
40   (move-from-unsigned)
41   ((:temp eax unsigned-reg eax-offset)
42    (:temp ebx unsigned-reg ebx-offset))
43
44   (inst bsr ebx eax)
45   (inst cmp ebx 61)
46   (inst jmp :z DONE)
47   (inst jmp :ge BIGNUM)
48   ;; Fixnum
49   (inst mov ebx eax)
50   (inst shl ebx 3)
51   DONE
52   (inst ret)
53
54   BIGNUM
55   (with-fixed-allocation (ebx bignum-widetag (+ bignum-digits-offset 2))
56     (storew eax ebx bignum-digits-offset other-pointer-lowtag))
57   (inst ret))
58
59