0.8.9.5:
authorChristophe Rhodes <csr21@cam.ac.uk>
Thu, 25 Mar 2004 21:51:53 +0000 (21:51 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Thu, 25 Mar 2004 21:51:53 +0000 (21:51 +0000)
Pointless microoptimizations 'R' us:
... in (defun foo (x)
         (declare (optimize speed) (type (signed-byte 32) x))
         (logand x #xffffffff))
on the x86, there is no need to perform the hardware AND, as
we are not interested in the flags.  Make it so.  (The system
already automatically handles the representation such that X
and the result can live in the same register -- to see this,
wrap the LOGAND above as (ASH (LOGAND ...) -3) and disassemble.

src/compiler/x86/arith.lisp
version.lisp-expr

index 565a2e9..25d7091 100644 (file)
                  (:translate ,translate)
                  (:generator ,untagged-penalty
                  (move r x)
-                 (inst ,op r y))))))
-
-  ;;(define-binop + 4 add)
+                 ,(if (eq translate 'logand)
+                      ;; for the -C/UNSIGNED=>UNSIGNED VOP, this case
+                      ;; is optimized away as an identity somewhere
+                      ;; along the lines.  However, this VOP is used in
+                      ;; -C/SIGNED=>UNSIGNED, below, when the
+                      ;; higher-level lisp code can't optimize away the
+                      ;; non-trivial identity.
+                      `(unless (= y #.(1- (ash 1 n-word-bits)))
+                         (inst ,op r y))
+                      `(inst ,op r y)))))))
   (define-binop - 4 sub)
   (define-binop logand 2 and)
   (define-binop logior 2 or)
           (move r x)
           (inst add r y)))))
 
-
 ;;;; Special logand cases: (logand signed unsigned) => unsigned
 
 (define-vop (fast-logand/signed-unsigned=>unsigned
index df7e8d7..2b9a0a8 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.9.4"
+"0.8.9.5"