0.9.7.8:
authorJuho Snellman <jsnell@iki.fi>
Thu, 1 Dec 2005 04:16:00 +0000 (04:16 +0000)
committerJuho Snellman <jsnell@iki.fi>
Thu, 1 Dec 2005 04:16:00 +0000 (04:16 +0000)
X86-64 floating point changes:

* Create FP zeroes with XORPS/XORPD on instead of MOVQ XMM15.
        * Don't zero XMM15 after every foreign call (not needed anymore
          thanks to previous change)
        * Add SQRTSS/SQRTSD instructions
        * Use SQRTSD for implementing %SQRT, instead of calling to C
        * Replace &REST in SC-CASE lambda list with &BODY (for better
          Slime indentation)

NEWS
src/code/irrat.lisp
src/compiler/meta-vmdef.lisp
src/compiler/x86-64/c-call.lisp
src/compiler/x86-64/float.lisp
src/compiler/x86-64/insts.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index c68199c..e82ef7f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ changes in sbcl-0.9.8 relative to sbcl-0.9.7:
     file-stream.  (thanks to Robert J. Macomber)
   * optimization: improved type inference for arithmetic-for
     index variables in LOOP
+  * optimization: faster floating-point SQRT on x86-64
   * fixed some bugs revealed by Paul Dietz' test suite:
     ** DOCUMENTATION returns NIL instead of "" for method combinations
        that don't have a docstring
index 9b901e8..07faa5c 100644 (file)
   (def %log (x))
   (def %exp (x)))
 
+#!+x86-64 ;; for constant folding
+(macrolet ((def (name ll)
+             `(defun ,name ,ll (,name ,@ll))))
+  (def %sqrt (x)))
+
 ;;;; stubs for the Unix math library
 ;;;;
 ;;;; Many of these are unnecessary on the X86 because they're built
@@ -78,7 +83,7 @@
 #!-x86 (def-math-rtn "log" 1)
 #!-x86 (def-math-rtn "log10" 1)
 (def-math-rtn "pow" 2)
-#!-x86 (def-math-rtn "sqrt" 1)
+#!-(or x86 x86-64) (def-math-rtn "sqrt" 1)
 (def-math-rtn "hypot" 2)
 #!-(or hpux x86) (def-math-rtn "log1p" 1)
 \f
index 5515de7..41270d2 100644 (file)
 ;;; beginning with T specifies a default. If it appears, it must be
 ;;; last. If no default is specified, and no clause matches, then an
 ;;; error is signalled.
-(def!macro sc-case (tn &rest forms)
+(def!macro sc-case (tn &body forms)
   (let ((n-sc (gensym))
         (n-tn (gensym)))
     (collect ((clauses))
index a45217f..b2e4fc3 100644 (file)
                                  'float-registers)))
     (inst call function)
     ;; To give the debugger a clue. XX not really internal-error?
-    (note-this-location vop :internal-error)
-    ;; FLOAT15 needs to contain FP zero in Lispland
-    (let ((float15 (make-random-tn :kind :normal
-                               :sc (sc-or-lose 'double-reg)
-                               :offset float15-offset)))
-      (inst xorpd float15 float15))))
+    (note-this-location vop :internal-error)))
 
 (define-vop (alloc-number-stack-space)
   (:info amount)
index 9f97d65..63ae040 100644 (file)
 (define-move-fun (load-fp-zero 1) (vop x y)
   ((fp-single-zero) (single-reg)
    (fp-double-zero) (double-reg))
-  (identity x) ; KLUDGE: IDENTITY as IGNORABLE...
-  (inst movq y fp-double-zero-tn))
+  (identity x)
+  (sc-case y
+    (single-reg (inst xorps y y))
+    (double-reg (inst xorpd y y))))
 
 (define-move-fun (load-single 2) (vop x y)
   ((single-stack) (single-reg))
   (frob * mulss */single-float 4 mulsd */double-float 5 t)
   (frob / divss //single-float 12 divsd //double-float 19 nil))
 
-
+(define-vop (fsqrt)
+  (:args (x :scs (double-reg)))
+  (:results (y :scs (double-reg)))
+  (:translate %sqrt)
+  (:policy :fast-safe)
+  (:arg-types double-float)
+  (:result-types double-float)
+  (:note "inline float arithmetic")
+  (:vop-var vop)
+  (:save-p :compute-only)
+  (:generator 1
+     (note-this-location vop :internal-error)
+     (inst sqrtsd y x)))
 \f
 (macrolet ((frob ((name translate sc type) &body body)
              `(define-vop (,name)
index 68dbf7f..aeb857e 100644 (file)
   (define-regular-sse-inst mulss    #xf3 #x59)
   (define-regular-sse-inst subsd    #xf2 #x5c)
   (define-regular-sse-inst subss    #xf3 #x5c)
+  (define-regular-sse-inst sqrtsd   #xf2 #x51)
+  (define-regular-sse-inst sqrtss   #xf3 #x51)
   ;; conversion
   (define-regular-sse-inst cvtsd2ss #xf2 #x5a)
   (define-regular-sse-inst cvtss2sd #xf3 #x5a)
index a7034fb..6de96c8 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.9.7.7"
+"0.9.7.8"