From 0a522bd0c8c38f6ee76f0cc2122d9984c4e269aa Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Wed, 26 Nov 2014 10:24:17 -0800 Subject: [PATCH] Use new log2 function in C * code/exports.lisp: * Export %LOG2. * code/irrat.lisp: * Define %log2 * Use %log2 instead of log2. (This needs work) * compiler/float-tran.lisp: * Use %log2 instead of log2 in the deftransforms. --- src/code/exports.lisp | 2 +- src/code/irrat.lisp | 7 ++++--- src/compiler/float-tran.lisp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/code/exports.lisp b/src/code/exports.lisp index e75e5d77b..99e07627e 100644 --- a/src/code/exports.lisp +++ b/src/code/exports.lisp @@ -2095,7 +2095,7 @@ "%CALLER-FRAME-AND-PC" "%CHECK-BOUND" "%CLOSURE-FUNCTION" "%CLOSURE-INDEX-REF" "%COS" "%COSH" "%DEPOSIT-FIELD" "%DOUBLE-FLOAT" "%DPB" "%EXP" "%EXPM1" "%HYPOT" "%LDB" - "%LOG" "%LOGB" "%LOG10" "%LOG1P" "%LONG-FLOAT" + "%LOG" "%LOGB" "%LOG10" "%LOG1P" "%LOG2" "%LONG-FLOAT" "%MAKE-COMPLEX" "%MAKE-FUNCALLABLE-INSTANCE" "%MAKE-RATIO" "%MASK-FIELD" "%NEGATE" "%POW" "%RAW-BITS" "%RAW-REF-COMPLEX-DOUBLE" "%RAW-REF-COMPLEX-LONG" diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp index 11795159c..568fa46b5 100644 --- a/src/code/irrat.lisp +++ b/src/code/irrat.lisp @@ -82,6 +82,7 @@ (def-math-rtn ("__ieee754_exp" %exp) 1) (def-math-rtn ("__ieee754_log" %log) 1) (def-math-rtn ("__ieee754_log10" %log10) 1) +(def-math-rtn ("cmucl_log2" %log2) 1) (def-math-rtn ("__ieee754_pow" %pow) 2) #-(or x86 sparc-v7 sparc-v8 sparc-v9) @@ -665,13 +666,13 @@ (number-dispatch ((number real) (base real)) ((double-float (foreach integer ratio single-float double-float)) - (log2 number)) + (%log2 number)) (((foreach integer ratio single-float) (foreach integer ratio single-float)) - (float (log2 (float number 1d0)) 1f0)) + (float (%log2 (float number 1d0)) 1f0)) (((foreach integer ratio single-float) double-float) - (log2 (float number 1d0))) + (%log2 (float number 1d0))) #+double-double (((foreach integer ratio single-float double-float) double-double-float) diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp index 6efe7019d..c30e3f785 100644 --- a/src/compiler/float-tran.lisp +++ b/src/compiler/float-tran.lisp @@ -865,7 +865,7 @@ (cond ((= y-val 10) `(coerce (kernel:%log10 (float x 1d0)) 'single-float)) ((= y-val 2) - `(coerce (kernel::log2 (float x 1d0)) 'single-float))))) + `(coerce (kernel:%log2 (float x 1d0)) 'single-float))))) (deftransform log ((x y) ((or (member 0d0) (double-float 0d0)) (constant-argument number)) @@ -879,7 +879,7 @@ (cond ((= y-val 10) `(kernel:%log10 (float x 1d0))) ((= y-val 2) - `(kernel::log2 (float x 1d0)))))) + `(kernel:%log2 (float x 1d0)))))) ;;; Handle some simple transformations -- GitLab