1 ;;;; the Alpha VM definition of character operations
3 ;;;; This software is part of the SBCL system. See the README file for
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.
14 ;;;; moves and coercions
16 ;;; Move a tagged char to an untagged representation.
17 (define-vop (move-to-base-char)
18 (:args (x :scs (any-reg descriptor-reg)))
19 (:results (y :scs (base-char-reg)))
21 (inst srl x sb!vm:n-widetag-bits y)))
23 (define-move-vop move-to-base-char :move
24 (any-reg descriptor-reg) (base-char-reg))
26 ;;; Move an untagged char to a tagged representation.
27 (define-vop (move-from-base-char)
28 (:args (x :scs (base-char-reg)))
29 (:results (y :scs (any-reg descriptor-reg)))
31 (inst sll x sb!vm:n-widetag-bits y)
32 (inst bis y sb!vm:base-char-widetag y)))
34 (define-move-vop move-from-base-char :move
35 (base-char-reg) (any-reg descriptor-reg))
37 ;;; Move untagged base-char values.
38 (define-vop (base-char-move)
41 :load-if (not (location= x y))))
42 (:results (y :scs (base-char-reg)
43 :load-if (not (location= x y))))
49 (define-move-vop base-char-move :move
50 (base-char-reg) (base-char-reg))
53 ;;; Move untagged base-char arguments/return-values.
54 (define-vop (move-base-char-argument)
58 :load-if (not (sc-is y base-char-reg))))
65 (storew x fp (tn-offset y))))))
67 (define-move-vop move-base-char-argument :move-argument
68 (any-reg base-char-reg) (base-char-reg))
71 ;;; Use standard MOVE-ARGUMENT + coercion to move an untagged base-char
72 ;;; to a descriptor passing location.
74 (define-move-vop move-argument :move-argument
75 (base-char-reg) (any-reg descriptor-reg))
79 (define-vop (char-code)
80 (:translate char-code)
82 (:args (ch :scs (base-char-reg) :target res))
83 (:arg-types base-char)
84 (:results (res :scs (any-reg)))
85 (:result-types positive-fixnum)
89 (define-vop (code-char)
90 (:translate code-char)
92 (:args (code :scs (any-reg) :target res))
93 (:arg-types positive-fixnum)
94 (:results (res :scs (base-char-reg)))
95 (:result-types base-char)
97 (inst srl code 2 res)))
99 ;;;; comparison of BASE-CHARs
101 (define-vop (base-char-compare)
102 (:args (x :scs (base-char-reg))
103 (y :scs (base-char-reg)))
104 (:arg-types base-char base-char)
105 (:temporary (:scs (non-descriptor-reg)) temp)
109 (:note "inline comparison")
113 (:eq (inst cmpeq x y temp))
114 (:lt (inst cmplt x y temp))
115 (:gt (inst cmplt y x temp)))
117 (inst beq temp target)
118 (inst bne temp target))))
120 (define-vop (fast-char=/base-char base-char-compare)
124 (define-vop (fast-char</base-char base-char-compare)
128 (define-vop (fast-char>/base-char base-char-compare)