From: Stephen Adams Date: Sat, 20 Jul 1996 23:03:03 +0000 (+0000) Subject: Added constant-folding of %fixnum->flonum. X-Git-Tag: 20090517-FFI~5466 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=75ac530193aed53a5c8475dd92ec8da847a577e5;p=mit-scheme.git Added constant-folding of %fixnum->flonum. --- diff --git a/v8/src/compiler/midend/cleanup.scm b/v8/src/compiler/midend/cleanup.scm index 0a04366c8..ac6db2e88 100644 --- a/v8/src/compiler/midend/cleanup.scm +++ b/v8/src/compiler/midend/cleanup.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: cleanup.scm,v 1.29 1996/03/09 18:28:42 adams Exp $ +$Id: cleanup.scm,v 1.30 1996/07/20 23:03:03 adams Exp $ Copyright (c) 1994-1996 Massachusetts Institute of Technology @@ -407,6 +407,12 @@ MIT in each case. |# (QUOTE/? e2) `(QUOTE ,(eq? (quote/text e1) (quote/text e2)))))) +(define-cleanup-rewrite %fixnum->flonum 1 + (lambda (expr) + (and (QUOTE/? expr) + (fixnum? (quote/text expr)) + `(QUOTE ,(exact->inexact (quote/text expr)))))) + (let ((NOT-primitive (make-primitive-procedure 'NOT))) (define (form-absorbs-not? form) ;; Assumption: open-coded (non out-of-line) predicates can be compiled