1 ;;;; the HPPA 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-character)
18 (:args (x :scs (any-reg descriptor-reg)))
19 (:results (y :scs (character-reg)))
21 (inst srl x n-widetag-bits y)))
22 (define-move-vop move-to-character :move
23 (any-reg descriptor-reg) (character-reg))
25 ;;; Move an untagged char to a tagged representation.
26 (define-vop (move-from-character)
27 (:args (x :scs (character-reg)))
28 (:results (y :scs (any-reg descriptor-reg)))
30 (inst sll x n-widetag-bits y)
31 (inst addi character-widetag y y)))
32 (define-move-vop move-from-character :move
33 (character-reg) (any-reg descriptor-reg))
35 ;;; Move untagged character values.
36 (define-vop (character-move)
39 :load-if (not (location= x y))))
40 (:results (y :scs (character-reg)
41 :load-if (not (location= x y))))
46 (define-move-vop character-move :move
47 (character-reg) (character-reg))
49 ;;; Move untagged character args/return-values.
50 (define-vop (move-character-arg)
54 :load-if (not (sc-is y character-reg))))
61 (storew x fp (tn-offset y))))))
62 (define-move-vop move-character-arg :move-arg
63 (any-reg character-reg) (character-reg))
65 ;;; Use standard MOVE-ARG + coercion to move an untagged character to
66 ;;; a descriptor passing location.
67 (define-move-vop move-arg :move-arg
68 (character-reg) (any-reg descriptor-reg))
70 ;;;; Other operations:
71 (define-vop (char-code)
72 (:translate char-code)
74 (:args (ch :scs (character-reg) :target res))
75 (:arg-types character)
76 (:results (res :scs (unsigned-reg)))
77 (:result-types positive-fixnum)
81 (define-vop (code-char)
82 (:translate code-char)
84 (:args (code :scs (unsigned-reg) :target res))
85 (:arg-types positive-fixnum)
86 (:results (res :scs (character-reg)))
87 (:result-types character)
91 ;;; Comparison of characters.
92 (define-vop (character-compare)
93 (:args (x :scs (character-reg))
94 (y :scs (character-reg)))
95 (:arg-types character character)
99 (:note "inline comparison")
102 (inst bc cond not-p x y target)))
104 (define-vop (fast-char=/character character-compare)
108 (define-vop (fast-char</character character-compare)
112 (define-vop (fast-char>/character character-compare)