From: Stephen Adams Date: Fri, 11 Jul 1997 02:35:04 +0000 (+0000) Subject: FIXNUM->FLONUM is open-coded, but only if argument is a known fixnum. X-Git-Tag: 20090517-FFI~5072 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6ecfad1f4ff2665414f08e5b6bf0ead2f4e091be;p=mit-scheme.git FIXNUM->FLONUM is open-coded, but only if argument is a known fixnum. --- diff --git a/v8/src/compiler/midend/typedb.scm b/v8/src/compiler/midend/typedb.scm index 0ebe54bb4..837a54836 100644 --- a/v8/src/compiler/midend/typedb.scm +++ b/v8/src/compiler/midend/typedb.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: typedb.scm,v 1.13 1996/10/03 14:08:12 adams Exp $ +$Id: typedb.scm,v 1.14 1997/07/11 02:35:04 adams Exp $ Copyright (c) 1996 Massachusetts Institute of Technology @@ -367,6 +367,9 @@ MIT in each case. |# 2 int:= int:< int:> 1 int:zero? int:negative? int:positive?) + ((unchecked-function type:fixnum type:flonum) + (ucode-primitive fixnum->flonum 1)) + (let-syntax ((p (macro spec (apply make-primitive-procedure spec)))) ((checked-function type:number type:number) 2 %+ %- %* %/ (p &+) (p &-) (p &*) (p &/)) diff --git a/v8/src/compiler/midend/typerew.scm b/v8/src/compiler/midend/typerew.scm index 83318802f..a124bb798 100644 --- a/v8/src/compiler/midend/typerew.scm +++ b/v8/src/compiler/midend/typerew.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: typerew.scm,v 1.26 1997/07/09 06:44:01 adams Exp $ +$Id: typerew.scm,v 1.27 1997/07/11 02:34:48 adams Exp $ Copyright (c) 1994-1996 Massachusetts Institute of Technology @@ -1426,6 +1426,7 @@ and we dont do much with that. (def 'TRUNCATE FLO:TRUNCATE)) (let ((INTEGER->FLONUM (ucode-primitive INTEGER->FLONUM 2)) + (FIXNUM->FLONUM (ucode-primitive FIXNUM->FLONUM 1)) (type:false/flonum (type:or type:false type:flonum)) (type:0/1 (type:or type:exact-zero type:exact-one))) (define-typerew-binary-variants-type-method INTEGER->FLONUM @@ -1442,7 +1443,13 @@ and we dont do much with that. ;; [2] if fixnums may not fix in a flonum (e.g. 64 bit machine). (define-typerew-binary-variants-replacement-method INTEGER->FLONUM - type:fixnum type:any type:flonum (typerew/%1 %fixnum->flonum))) + type:fixnum type:any type:flonum (typerew/%1 %fixnum->flonum)) + + (define-typerew-unary-variants-replacement-method FIXNUM->FLONUM + type:fixnum type:flonum %fixnum->flonum)) + + + (define-typerew-unary-variants-type-method 'COS type:number type:number effect:none