X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Falpha%2Fchar.lisp;h=5318c40d5f4acc2b149214144bbb91569a79eb83;hb=11f02398a1a9ccbde847c82fd233e8378e45c29c;hp=259a0dda1bfc05c630431e40c2671c7164d9bfd8;hpb=dfa55a883f94470267b626dae77ce7e7dfac3df6;p=sbcl.git diff --git a/src/compiler/alpha/char.lisp b/src/compiler/alpha/char.lisp index 259a0dd..5318c40 100644 --- a/src/compiler/alpha/char.lisp +++ b/src/compiler/alpha/char.lisp @@ -1,53 +1,40 @@ -;;; -*- Package: C; Log: C.Log -*- -;;; -;;; ********************************************************************** -;;; This code was written as part of the CMU Common Lisp project at -;;; Carnegie Mellon University, and has been placed in the public domain. -;;; - -;;; -;;; ********************************************************************** -;;; -;;; $Header$ -;;; -;;; This file contains the RT VM definition of character operations. -;;; -;;; Written by Rob MacLachlan -;;; Converted for the Alpha by Sean Hallgren. -;;; -(in-package "SB!VM") - +;;;; the Alpha VM definition of character operations +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. +(in-package "SB!VM") -;;;; Moves and coercions: +;;;; moves and coercions ;;; Move a tagged char to an untagged representation. -;;; (define-vop (move-to-base-char) (:args (x :scs (any-reg descriptor-reg))) (:results (y :scs (base-char-reg))) (:generator 1 - (inst srl x sb!vm:type-bits y))) + (inst srl x sb!vm:n-widetag-bits y))) ;;; (define-move-vop move-to-base-char :move (any-reg descriptor-reg) (base-char-reg)) - ;;; Move an untagged char to a tagged representation. -;;; (define-vop (move-from-base-char) (:args (x :scs (base-char-reg))) (:results (y :scs (any-reg descriptor-reg))) (:generator 1 - (inst sll x sb!vm:type-bits y) - (inst bis y sb!vm:base-char-type y))) + (inst sll x sb!vm:n-widetag-bits y) + (inst bis y sb!vm:base-char-widetag y))) ;;; (define-move-vop move-from-base-char :move (base-char-reg) (any-reg descriptor-reg)) ;;; Move untagged base-char values. -;;; (define-vop (base-char-move) (:args (x :target y :scs (base-char-reg) @@ -62,10 +49,8 @@ (define-move-vop base-char-move :move (base-char-reg) (base-char-reg)) - ;;; Move untagged base-char arguments/return-values. -;;; -(define-vop (move-base-char-argument) +(define-vop (move-base-char-arg) (:args (x :target y :scs (base-char-reg)) (fp :scs (any-reg) @@ -78,19 +63,17 @@ (base-char-stack (storew x fp (tn-offset y)))))) ;;; -(define-move-vop move-base-char-argument :move-argument +(define-move-vop move-base-char-arg :move-arg (any-reg base-char-reg) (base-char-reg)) -;;; Use standard MOVE-ARGUMENT + coercion to move an untagged base-char +;;; Use standard MOVE-ARG + coercion to move an untagged base-char ;;; to a descriptor passing location. ;;; -(define-move-vop move-argument :move-argument +(define-move-vop move-arg :move-arg (base-char-reg) (any-reg descriptor-reg)) - - -;;;; Other operations: +;;;; other operations (define-vop (char-code) (:translate char-code) @@ -111,10 +94,9 @@ (:result-types base-char) (:generator 1 (inst srl code 2 res))) - -;;; Comparison of base-chars. -;;; +;;;; comparison of BASE-CHARs + (define-vop (base-char-compare) (:args (x :scs (base-char-reg)) (y :scs (base-char-reg))) @@ -145,3 +127,37 @@ (define-vop (fast-char>/base-char base-char-compare) (:translate char>) (:variant :gt)) + +(define-vop (base-char-compare/c) + (:args (x :scs (base-char-reg))) + (:arg-types base-char (:constant base-char)) + (:temporary (:scs (non-descriptor-reg)) temp) + (:conditional) + (:info target not-p y) + (:policy :fast-safe) + (:note "inline constant comparison") + (:variant-vars cond) + (:generator 2 + (ecase cond + (:eq (inst cmpeq x (sb!xc:char-code y) temp)) + (:lt (inst cmplt x (sb!xc:char-code y) temp)) + (:gt (inst cmple x (sb!xc:char-code y) temp))) + (if not-p + (if (eq cond :gt) + (inst bne temp target) + (inst beq temp target)) + (if (eq cond :gt) + (inst beq temp target) + (inst bne temp target))))) + +(define-vop (fast-char=/base-char/c base-char-compare/c) + (:translate char=) + (:variant :eq)) + +(define-vop (fast-char/base-char/c base-char-compare/c) + (:translate char>) + (:variant :gt))