From 7f9451cac95232400b210b3b8a90eae035c6f2c1 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Fri, 4 Nov 2005 04:29:46 +0000 Subject: [PATCH] Add some vops to handle logand of signed and unsigned. Based on the sparc version. --- compiler/ppc/arith.lisp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/compiler/ppc/arith.lisp b/compiler/ppc/arith.lisp index 1ebd07048..f1eca41fa 100644 --- a/compiler/ppc/arith.lisp +++ b/compiler/ppc/arith.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman (FAHLMAN@CMUC). ;;; ********************************************************************** ;;; -;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ppc/arith.lisp,v 1.9 2005/02/11 05:42:19 rtoy Exp $ +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ppc/arith.lisp,v 1.10 2005/11/04 04:29:46 rtoy Exp $ ;;; ;;; This file contains the VM definition arithmetic VOPs for the MIPS. ;;; @@ -240,6 +240,33 @@ (define-const-logop logxor 2 xori) +;;; Special logand cases: (logand signed unsigned) => unsigned + +(define-vop (fast-logand/signed-unsigned=>unsigned + fast-logand/unsigned=>unsigned) + (:args (x :scs (signed-reg)) + (y :target r :scs (unsigned-reg))) + (:arg-types signed-num unsigned-num)) + +(define-vop (fast-logand/unsigned-signed=>unsigned + fast-logand/unsigned=>unsigned) + (:args (x :target r :scs (unsigned-reg)) + (y :scs (signed-reg))) + (:arg-types unsigned-num signed-num)) + +(define-vop (fast-logand-c/signed-unsigned=>unsigned fast-unsigned-binop-c) + (:args (x :scs (signed-reg))) + (:translate logand) + (:arg-types signed-num + (:constant (or (and (unsigned-byte 15) (not (integer 0 0))) + (integer #xffffffff #xffffffff)))) + (:generator 1 ; Needs to be low to give this vop a chance. + (cond ((= y #xffffffff) + (move r x)) + ((typep y '(unsigned-byte 15)) + (inst andi. r x y))))) + + ;;; Special case fixnum + and - that trap on overflow. Useful when we ;;; don't know that the output type is a fixnum. ;;; -- GitLab