Tests for new optimizer additions.

This commit is contained in:
Sam Tobin-Hochstadt 2010-08-26 11:45:44 -04:00
parent c40c48bd97
commit 3e4ddde808
6 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,5 @@
#lang typed/racket/base #:optimize
(require racket/unsafe/ops)
(magnitude 3.0+4.0i)

View File

@ -0,0 +1,10 @@
#lang typed/racket/base #:optimize
(require racket/unsafe/ops)
(ann
(let loop ([v 0.0+1.0i])
(if (> (real-part v) 70000.2)
0
(loop (+ v 3.6))))
Integer)

View File

@ -0,0 +1,12 @@
#lang racket/base
(require racket/unsafe/ops)
(let* ((unboxed-real-1 '3.0)
(unboxed-imag-2 '4.0)
(unboxed-real-3
(unsafe-flsqrt
(unsafe-fl+ (unsafe-fl* unboxed-real-1 unboxed-real-1) (unsafe-fl* unboxed-imag-2 unboxed-imag-2)))))
unboxed-real-3)
(void)

View File

@ -0,0 +1,19 @@
#lang racket/base
(require racket/unsafe/ops)
(let-values (((unboxed-real-1) '0.0))
(let-values (((unboxed-imag-2) '1.0))
((letrec-values (((loop)
(lambda (unboxed-real-1 unboxed-imag-2)
(if (unsafe-fl> (let-values () unboxed-real-1) '70000.2)
'0
(let-values (((unboxed-float-1) '3.6))
(let-values (((unboxed-real-2) (unsafe-fl+ unboxed-real-1 unboxed-float-1)))
(let-values (((unboxed-imag-3) unboxed-imag-2)) (loop unboxed-real-2 unboxed-imag-3))))))))
loop)
unboxed-real-1
unboxed-imag-2)))
(void)

View File

@ -0,0 +1,5 @@
#lang typed/racket/base #:optimize
(require racket/unsafe/ops)
(magnitude 3.0+4.0i)

View File

@ -0,0 +1,8 @@
#lang typed/racket/base
(ann
(let loop ([v 0.0+1.0i])
(if (> (real-part v) 70000.2)
0
(loop (+ v 3.6))))
Integer)