From: Nikodemus Siivola Date: Fri, 8 Apr 2005 14:22:54 +0000 (+0000) Subject: 0.8.21.26: provide %SQRT &co as functions on x86 for constant folding X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=55e6ffb0b21df99a1908f1c0bc00f0baf4322f92;p=sbcl.git 0.8.21.26: provide %SQRT &co as functions on x86 for constant folding --- diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp index ef7f6a3..25a5f8b 100644 --- a/src/code/irrat.lisp +++ b/src/code/irrat.lisp @@ -41,6 +41,18 @@ ) ; EVAL-WHEN +#!+x86 ;; for constant folding +(macrolet ((def (name ll) + `(defun ,name ,ll (,name ,@ll)))) + (def %atan2 (x y)) + (def %atan (x)) + (def %tan-quick (x)) + (def %cos-quick (x)) + (def %sin-quick (x)) + (def %sqrt (x)) + (def %log (x)) + (def %exp (x))) + ;;;; stubs for the Unix math library ;;;; ;;;; Many of these are unnecessary on the X86 because they're built @@ -54,9 +66,6 @@ (def-math-rtn "acos" 1) #!-x86 (def-math-rtn "atan" 1) #!-x86 (def-math-rtn "atan2" 2) -#!+x86 ;; for constant folding -(defun %atan2 (x y) - (%atan2 x y)) (def-math-rtn "sinh" 1) (def-math-rtn "cosh" 1) (def-math-rtn "tanh" 1) diff --git a/tests/float.impure.lisp b/tests/float.impure.lisp index 7225011..518a122 100644 --- a/tests/float.impure.lisp +++ b/tests/float.impure.lisp @@ -68,5 +68,32 @@ (compile 'single-float-ppc) (assert (= (single-float-ppc -30) -30f0)) +;;; constant-folding irrational functions +(declaim (inline df)) +(defun df (x) + ;; do not remove the ECASE here: the bug this checks for indeed + ;; depended on this configuration + (ecase x (1 least-positive-double-float))) +(macrolet ((test (fun) + (let ((name (intern (format nil "TEST-CONSTANT-~A" fun)))) + `(progn + (defun ,name () (,fun (df 1))) + (,name))))) + (test sqrt) + (test log) + (test sin) + (test cos) + (test tan) + (test asin) + (test acos) + (test atan) + (test sinh) + (test cosh) + (test tanh) + (test asinh) + (test acosh) + (test atanh) + (test exp)) + ;;; success (quit :unix-status 104) diff --git a/version.lisp-expr b/version.lisp-expr index a8cae07..dd903df 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.21.25" +"0.8.21.26"