On Tue, Jan 26, 2010 at 9:32 AM, Paul Khuong <pvk@...> wrote:
> On 2010-01-25, at 8:43 PM, Nathan Froyd wrote:
>> The patch below (a little late, but hey...)
>> enables inlining %UNARY-TRUNCATE/*-FLOAT when the argument has an
>> appropriate range. It tests fine; a review would be appreciated.
> Looks fine to me.
Thanks. I wrote a testcase for compiler.pure.lisp's :TRUNCATE-FLOAT
test with the semi-obvious extension from GENERIC to UNARY-TRUNCATE.
I'll include that too.
> There's a similar issue with %unary-round. How does the following look like?
> (defoptimizer (%unary-round derive-type) ((number))
> (one-arg-derive-type number
> (lambda (n)
> (block nil
> (unless (numeric-type-real-p n)
> (return *empty-type*))
> (let* ((interval (numeric-type->interval n))
> (low (interval-low interval))
> (high (interval-high interval)))
> `(integer ,(if low
> (round low)
> ,(if high
> (round high)
I think this looks reasonable.
> While looking at the disassembly, I noticed that we take care not to convert integers to floats from a register on x86-64 (so we only cvtsi2sd xmm, m64, for instance). That seems to be a copy/paste thinko from the x86 backend (x86-64/float.lisp:L1040).
Yeah, I noticed that too. I'll fix that in a separate commit unless
you beat me to it. (Have a patch already, it's pretty easy.)