From 75ac530193aed53a5c8475dd92ec8da847a577e5 Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Sat, 20 Jul 1996 23:03:03 +0000 Subject: [PATCH] Added constant-folding of %fixnum->flonum. --- v8/src/compiler/midend/cleanup.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- 2.25.1