Enabled optimization of complex conjugate at the top level of complex operations.

This commit is contained in:
Vincent St-Amour 2010-07-13 12:12:12 -04:00
parent 063211d922
commit fff71e6a1d
3 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,3 @@
#lang typed/scheme #:optimize
(require racket/unsafe/ops)
(conjugate (+ 1.0+2.0i 2.0+4.0i))

View File

@ -0,0 +1,12 @@
#lang typed/scheme #:optimize
(require racket/unsafe/ops)
(let* ((unboxed-gensym-1 1.0+2.0i)
(unboxed-gensym-2 (unsafe-flreal-part unboxed-gensym-1))
(unboxed-gensym-3 (unsafe-flimag-part unboxed-gensym-1))
(unboxed-gensym-4 2.0+4.0i)
(unboxed-gensym-5 (unsafe-flreal-part unboxed-gensym-4))
(unboxed-gensym-6 (unsafe-flimag-part unboxed-gensym-4))
(unboxed-gensym-7 (unsafe-fl+ unboxed-gensym-2 unboxed-gensym-5))
(unboxed-gensym-8 (unsafe-fl+ unboxed-gensym-3 unboxed-gensym-6))
(unboxed-gensym-9 (unsafe-fl- 0.0 unboxed-gensym-8)))
(unsafe-make-flrectangular unboxed-gensym-7 unboxed-gensym-9))

View File

@ -139,7 +139,8 @@
#:with opt
(begin (log-optimization "unary inexact complex" #'op)
#'(op.unsafe n.opt)))
(pattern (~and exp (#%plain-app (~var op (float-op binary-inexact-complex-ops))
(pattern (~and exp (#%plain-app (~or (~var op (float-op binary-inexact-complex-ops))
(~and op (~literal conjugate)))
e:inexact-complex-expr ...))
#:with exp*:unboxed-inexact-complex-opt-expr #'exp
#:with opt