X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fgeneric%2Fvm-tran.lisp;h=d843d1c838fd215faa4d3ec1aaf6dff4c275f476;hb=e73a30c901ab234291aefc9f1e73507650628892;hp=1d93ebafc282f4f0c6400c147afeb489a4301110;hpb=1e9966d5f24709d227e20911b4e1ddd27c87a00e;p=sbcl.git diff --git a/src/compiler/generic/vm-tran.lisp b/src/compiler/generic/vm-tran.lisp index 1d93eba..d843d1c 100644 --- a/src/compiler/generic/vm-tran.lisp +++ b/src/compiler/generic/vm-tran.lisp @@ -444,27 +444,20 @@ (define-good-modular-fun logior) ;;; FIXME: XOR? ANDC1, ANDC2? -- CSR, 2003-09-16 -#!-alpha -(progn - (defknown sb!vm::ash-left-mod32 (integer (integer 0)) (unsigned-byte 32) - (foldable flushable movable)) - (define-modular-fun-optimizer ash ((integer count) :width width) - (when (and (<= width 32) - (constant-lvar-p count) ; ? - (plusp (lvar-value count))) - (cut-to-width integer width) - 'sb!vm::ash-left-mod32))) -#!+alpha -(progn - (defknown sb!vm::ash-left-mod64 (integer (integer 0)) (unsigned-byte 64) - (foldable flushable movable)) - (define-modular-fun-optimizer ash ((integer count) :width width) - (when (and (<= width 64) - (constant-lvar-p count) ; ? - (plusp (lvar-value count))) - (cut-to-width integer width) - 'sb!vm::ash-left-mod64))) - +(macrolet + ((def (name width) + `(progn + (defknown ,name (integer (integer 0)) (unsigned-byte ,width) + (foldable flushable movable)) + (define-modular-fun-optimizer ash ((integer count) :width width) + (when (and (<= width 32) + (constant-lvar-p count) ;? + (plusp (lvar-value count))) + (cut-to-width integer width) + ',name)) + (setf (gethash ',name *modular-versions*) `(ash ,',width))))) + #!-alpha (def sb!vm::ash-left-mod32 32) + #!+alpha (def sb!vm::ash-left-mod64 64)) ;;; There are two different ways the multiplier can be recoded. The ;;; more obvious is to shift X by the correct amount for each bit set