1.0.23.3: faster generic arithmetic dispatch on x86 and x86-64
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 1 Dec 2008 15:32:21 +0000 (15:32 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 1 Dec 2008 15:32:21 +0000 (15:32 +0000)
 * Single branch to check if both arguments are fixnums, rerorder fixnum branch to
   be the fallthru.

NEWS
src/assembly/x86-64/arith.lisp
src/assembly/x86/arith.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 69e84d9..443a38b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
 ;;;; -*- coding: utf-8; -*-
+  * optimization: faster generic arithmetic dispatch on x86 and x86-64.
   * bug fix: lexical type declarations are now correctly reported by
     SB-CLTL2. (reported by Larry D'Anna)
   * bug fix: STRING-TO-OCTETS did not handle :START properly when
index 4e8f81d..22fee87 100644 (file)
                  (:res res (descriptor-reg any-reg) rdx-offset)
 
                  (:temp rax unsigned-reg rax-offset)
-                 (:temp rbx unsigned-reg rbx-offset)
                  (:temp rcx unsigned-reg rcx-offset))
 
-                (declare (ignorable rbx))
-
-                (inst test x 7)  ; fixnum?
+                (inst mov rcx x)
+                (inst or rcx y)
+                (inst test rcx 7)            ; both fixnums?
                 (inst jmp :nz DO-STATIC-FUN) ; no - do generic
-                (inst test y 7)  ; fixnum?
-                (inst jmp :z DO-BODY)   ; yes - doit here
+
+                ,@body
+                (inst clc)
+                (inst ret)
 
                 DO-STATIC-FUN
                 (inst pop rax)
                       (make-ea :qword
                                :disp (+ nil-value
                                         (static-fun-offset
-                                         ',(symbolicate "TWO-ARG-" fun)))))
-
-                DO-BODY
-                ,@body)))
+                                         ',(symbolicate "TWO-ARG-" fun))))))))
 
   (define-generic-arith-routine (+ 10)
     (move res x)
index 33c0439..0d3b721 100644 (file)
                  (:res res (descriptor-reg any-reg) edx-offset)
 
                  (:temp eax unsigned-reg eax-offset)
-                 (:temp ebx unsigned-reg ebx-offset)
                  (:temp ecx unsigned-reg ecx-offset))
 
-                (declare (ignorable ebx))
-
-                (inst test x 3)  ; fixnum?
+                (inst mov ecx x)
+                (inst or ecx y)
+                (inst test ecx 3)            ; both fixnums?
                 (inst jmp :nz DO-STATIC-FUN) ; no - do generic
-                (inst test y 3)  ; fixnum?
-                (inst jmp :z DO-BODY)   ; yes - doit here
+
+                ,@body
+                (inst clc) ; single-value return
+                (inst ret)
 
                 DO-STATIC-FUN
                 (inst pop eax)
                       (make-ea :dword
                                :disp (+ nil-value
                                         (static-fun-offset
-                                         ',(symbolicate "TWO-ARG-" fun)))))
-
-                DO-BODY
-                ,@body)))
+                                         ',(symbolicate "TWO-ARG-" fun))))))))
 
   (define-generic-arith-routine (+ 10)
     (move res x)
index d4b8998..82d37e0 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".)
-"1.0.23.2"
+"1.0.23.3"