From f5c518398f188decc7fda7f3ef98952cfef6782a Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 13 Jul 2010 12:12:12 -0400 Subject: [PATCH] Enabled optimization of complex conjugate at the top level of complex operations. original commit: fff71e6a1d5746bf30ec7b3d64ec63ccd43f8065 --- .../optimizer/generic/inexact-complex-conjugate-top.rkt | 3 +++ collects/typed-scheme/optimizer/inexact-complex.rkt | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 collects/tests/typed-scheme/optimizer/generic/inexact-complex-conjugate-top.rkt diff --git a/collects/tests/typed-scheme/optimizer/generic/inexact-complex-conjugate-top.rkt b/collects/tests/typed-scheme/optimizer/generic/inexact-complex-conjugate-top.rkt new file mode 100644 index 00000000..3e9b4090 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/generic/inexact-complex-conjugate-top.rkt @@ -0,0 +1,3 @@ +#lang typed/scheme #:optimize +(require racket/unsafe/ops) +(conjugate (+ 1.0+2.0i 2.0+4.0i)) diff --git a/collects/typed-scheme/optimizer/inexact-complex.rkt b/collects/typed-scheme/optimizer/inexact-complex.rkt index a3865450..8c47f7ee 100644 --- a/collects/typed-scheme/optimizer/inexact-complex.rkt +++ b/collects/typed-scheme/optimizer/inexact-complex.rkt @@ -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