I just went through the inner loops of a program using CMU lisp's
compiler notes, inserting declarations to enhance code efficiency.
I am left with one case in which I don't seem to be able to get
the optimizer to do what I want.
Consider
(defun plogp (p)
(declare (optimize (speed 3))
(type (single-float 0.0 *) p))
(* p (log p)))
Now, the compiler tells me
In: defun plogp
(log p)
Note: Unable to optimize due to type uncertainty:
The result is a (or float (complex float)), not a float.
(* p (log p))
Note: Unable to optimize due to type uncertainty:
The second argument is a (or float (complex float)), not a double-float.
Obviously, I had inserted the (type (single-float 0.0 *) p) declaration
in hopes that the compiler would figure out that there is no uncertainty
as to the result of (log p) being real. I also tried (satisfies plusp),
but to no avail.
The second note can be gotten rid of with (the single-float (log p)),
but the first one remains.
Any suggestions? thanks in advance.
--
Andreas Stolcke ·······@icsi.berkeley.edu
International Computer Science Institute ·······@ucbicsi.bitnet
1947 Center St., Suite 600, Berkeley, CA 94704 (510) 642-4274 ext. 126