From 63780195fabf6c748314cb3eb380048386c588c0 Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Sun, 16 Nov 1997 14:05:23 +0000
Subject: [PATCH] Add transforms for realpart and imagpart given a complex
 rational argument to %realpart and %imagepart respectively.

Enable the realpart and imagpart derive-type optimizers which now work
and are important for these functions to be inlined.
---
 compiler/float-tran.lisp | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/compiler/float-tran.lisp b/compiler/float-tran.lisp
index 41526c128..25d4dffdd 100644
--- a/compiler/float-tran.lisp
+++ b/compiler/float-tran.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.40 1997/10/15 17:01:21 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.41 1997/11/16 14:05:23 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1052,21 +1052,17 @@
 		 
 ) ;end progn for propagate-fun-type
 
+#+complex-float
+(progn
 ;;; Make REALPART and IMAGPART return the appropriate types.  This
 ;;; helps a lot in optimized code.
 
-;;; Doesn't work yet.
-#+nil
-(progn
-(defknown (%realpart)
-    (complex) real
-    (flushable movable))
-
-(defknown (%imagpart)
-    (complex) real
-    (flushable movable))
+(deftransform realpart ((x) ((complex rational)) *)
+  '(kernel:%realpart x))
+(deftransform imagpart ((x) ((complex rational)) *)
+  '(kernel:%imagpart x))
 
-(defoptimizer (%realpart derive-type) ((num))
+(defoptimizer (realpart derive-type) ((num))
   (let ((type (continuation-type num)))
     (cond ((numeric-type-real-p type)
 	   ;; The realpart of a real has the same type and range as the input.
@@ -1085,7 +1081,7 @@
 			      :low (numeric-type-low type)
 			      :high (numeric-type-high type))))))
 
-(defoptimizer (%imagpart derive-type) ((num))
+(defoptimizer (imagpart derive-type) ((num))
   (let ((type (continuation-type num)))
     (cond ((numeric-type-real-p type)
 	   ;; The imagpart of a real has the same type as the input,
@@ -1106,7 +1102,7 @@
 			      :high (numeric-type-high type))))))
 
   
-) ;end progn
+) ;end progn complex-float
 	   
 
 ;;; Here are simple optimizers for sin, cos, and tan.  They do not
-- 
GitLab