[git] CMU Common Lisp branch master updated. snapshot-2014-08-35-ge38211a

Raymond Toy rtoy at common-lisp.net
Wed Aug 27 03:34:01 UTC 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  e38211a12ceccae3b59938fd4815ab9055d6d5b8 (commit)
      from  1345f3b146c9840447fa7a943daf85f111011a7f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e38211a12ceccae3b59938fd4815ab9055d6d5b8
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Tue Aug 26 20:33:54 2014 -0700

    Implement a simpler (and faster?) algorithm to convert a double to an
    int.

diff --git a/src/compiler/sparc/float.lisp b/src/compiler/sparc/float.lisp
index 013f184..74f279d 100644
--- a/src/compiler/sparc/float.lisp
+++ b/src/compiler/sparc/float.lisp
@@ -1252,17 +1252,13 @@
     (inst fdtox r x)
     (inst fxtod r r)))
 
+;; See Listing 2.2: Conversion from FP to int in in "CR-LIBM: A
+;; library of correctly rounded elementary functions in
+;; double-precision".
 #+sun4
 (deftransform %unary-round ((x) (float) (signed-byte 32))
-  '(let* ((trunc (truly-the (signed-byte 32) (%unary-truncate x)))
-	  (extra (- x trunc))
-	  (absx (abs extra))
-	  (one-half (float 1/2 x)))
-     (if (if (oddp trunc)
-	     (>= absx one-half)
-	     (> absx one-half))
-	 (truly-the (signed-byte 32) (%unary-truncate (+ x extra)))
-	 trunc)))
+   '(kernel:double-float-low-bits (+ x (+ (scale-float 1d0 52)
+					  (scale-float 1d0 51)))))
 
 (define-vop (make-single-float)
   (:args (bits :scs (signed-reg) :target res

-----------------------------------------------------------------------

Summary of changes:
 src/compiler/sparc/float.lisp |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp



More information about the cmucl-cvs mailing list