Skip to content
Snippets Groups Projects
Commit 836a86e8 authored by rtoy's avatar rtoy
Browse files

o Add vop for INTEGER-LENGTH of (UNSIGNED-BYTE 32).

o Fix FAST-ASH/UNSIGNED=>UNSIGNED vop where the amount might be
  greater than 31.
parent 36acd7ec
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC). ;;; Scott Fahlman (FAHLMAN@CMUC).
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ppc/arith.lisp,v 1.7 2004/08/02 03:15:17 rtoy Exp $ ;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ppc/arith.lisp,v 1.8 2004/10/06 23:58:46 rtoy Exp $
;;; ;;;
;;; This file contains the VM definition arithmetic VOPs for the MIPS. ;;; This file contains the VM definition arithmetic VOPs for the MIPS.
;;; ;;;
...@@ -351,6 +351,7 @@ ...@@ -351,6 +351,7 @@
(cond (cond
((and (minusp amount) (< amount -31)) (move result zero-tn)) ((and (minusp amount) (< amount -31)) (move result zero-tn))
((minusp amount) (inst srwi result number (- amount))) ((minusp amount) (inst srwi result number (- amount)))
((> amount 31) (move result zero-tn))
(t (inst slwi result number amount)))))))) (t (inst slwi result number amount))))))))
(define-vop (fast-ash/signed=>signed) (define-vop (fast-ash/signed=>signed)
...@@ -412,6 +413,21 @@ ...@@ -412,6 +413,21 @@
(inst slwi shift shift 2) (inst slwi shift shift 2)
(inst subfic res shift (fixnumize 32))))) (inst subfic res shift (fixnumize 32)))))
(define-vop (unsigned-byte-32-len)
(:translate integer-length)
(:note "inline (unsigned-byte 32) integer-length")
(:policy :fast-safe)
(:args (arg :scs (unsigned-reg)))
(:arg-types unsigned-num)
(:results (res :scs (any-reg)))
(:result-types positive-fixnum)
(:temporary (:scs (non-descriptor-reg) :to (:argument 0)) shift)
(:generator 6
; (integer-length arg) = (- 32 (cntlz arg)))
(inst cntlzw shift arg)
(inst slwi shift shift 2)
(inst subfic res shift (fixnumize 32))))
(define-vop (unsigned-byte-32-count) (define-vop (unsigned-byte-32-count)
(:translate logcount) (:translate logcount)
(:note "inline (unsigned-byte 32) logcount") (:note "inline (unsigned-byte 32) logcount")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment