Commit 06300c81 authored by Raymond Toy's avatar Raymond Toy
Browse files

Sparc has sincos in its C library. Use it. But note that it has

accurate pi-reduction so we don't have do it ourselves.
parent 881903dd
...@@ -309,10 +309,11 @@ ...@@ -309,10 +309,11 @@
#+(or ppc sse2) #+(or ppc sse2)
(frob %%sin %%cos %%tan)) (frob %%sin %%cos %%tan))
;; Linux has a sincos function in the C library. Use it. But we need ;; Linux and sparc have a sincos function in the C library. Use it.
;; to do pi reduction ourselves because the C library doesn't do ;; But on linux we need to do pi reduction ourselves because the C
;; accurate reduction. ;; library doesn't do accurate reduction. Sparc does accurate pi
#+(or (and linux x86)) ;; reduction, so we don't need to do it ourselves.
#+(or (and linux x86) sparc)
(progn (progn
(declaim (inline %%sincos)) (declaim (inline %%sincos))
(export '%%sincos) (export '%%sincos)
...@@ -321,6 +322,7 @@ ...@@ -321,6 +322,7 @@
(sin double-float :out) (sin double-float :out)
(cos double-float :out)) (cos double-float :out))
#+(and linux x86)
(defun %sincos (theta) (defun %sincos (theta)
(declare (double-float theta)) (declare (double-float theta))
;; Accurately reduce theta. ;; Accurately reduce theta.
...@@ -351,7 +353,16 @@ ...@@ -351,7 +353,16 @@
(3 (3
(values (sin2 s c y1) (values (sin2 s c y1)
(- (cos2 s c y1))))))))) (- (cos2 s c y1)))))))))
#+sparc
(declaim (inline %sinccos))
#+sparc
(defun %sincos (theta)
(multiple-value-bind (ignore s c)
(%%sincos theta)
(values c s)))
) )
;;;; Power functions. ;;;; Power functions.
...@@ -1006,9 +1017,9 @@ ...@@ -1006,9 +1017,9 @@
"Return cos(Theta) + i sin(Theta), AKA exp(i Theta)." "Return cos(Theta) + i sin(Theta), AKA exp(i Theta)."
(if (complexp theta) (if (complexp theta)
(error (intl:gettext "Argument to CIS is complex: ~S") theta) (error (intl:gettext "Argument to CIS is complex: ~S") theta)
#-(or (and linux x86)) #-(or (and linux x86) sparc)
(complex (cos theta) (sin theta)) (complex (cos theta) (sin theta))
#+(or (and linux x86)) #+(or (and linux x86) sparc)
(number-dispatch ((theta real)) (number-dispatch ((theta real))
((rational) ((rational)
(let ((arg (coerce theta 'double-float))) (let ((arg (coerce theta 'double-float)))
......
...@@ -731,7 +731,7 @@ ...@@ -731,7 +731,7 @@
(deftransform name ((x) '(double-float) rtype :eval-name t :when :both) (deftransform name ((x) '(double-float) rtype :eval-name t :when :both)
`(,prim x)))) `(,prim x))))
#+(or (and linux x86)) #+(or (and linux x86) sparc)
(progn (progn
(defknown (kernel::%sincos) (defknown (kernel::%sincos)
(double-float) (values double-float double-float) (double-float) (values double-float double-float)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment