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 0000000000..3e9b409079 --- /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/tests/typed-scheme/optimizer/hand-optimized/inexact-complex-conjugate-top.rkt b/collects/tests/typed-scheme/optimizer/hand-optimized/inexact-complex-conjugate-top.rkt new file mode 100644 index 0000000000..69eda9b9a6 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/hand-optimized/inexact-complex-conjugate-top.rkt @@ -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)) diff --git a/collects/typed-scheme/optimizer/inexact-complex.rkt b/collects/typed-scheme/optimizer/inexact-complex.rkt index a386545082..8c47f7ee88 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