* racompile passes 1.5

This commit is contained in:
Abdulaziz Ghuloum 2007-02-05 22:35:38 -05:00
parent caf234c0c3
commit 7c26c2b19e
4 changed files with 243 additions and 160 deletions

Binary file not shown.

View File

@ -193,18 +193,20 @@
(cond (cond
[(int? n) [(int? n)
(if (fixnum? n) (if (fixnum? n)
(list* (byte n) (list*
(byte n)
(byte (fxsra n 8)) (byte (fxsra n 8))
(byte (fxsra n 16)) (byte (fxsra n 16))
(byte (fxsra n 24)) (byte (fxsra n 24))
ac) ac)
(let ([lo (remainder n 256)] (let* ([lo (remainder n 256)]
[hi (quotient n 256)]) [hi (quotient (if (< n 0) (- n 255) n) 256)])
(list* (byte lo) (list*
(byte lo)
(byte hi) (byte hi)
(byte (fxsra hi 8)) (byte (fxsra hi 8))
(byte (fxsra hi 16)) (byte (fxsra hi 16))
ac)))] ac)))]
[(obj? n) [(obj? n)
(let ([v (cadr n)]) (let ([v (cadr n)])
(if (immediate? v) (if (immediate? v)
@ -476,7 +478,7 @@
(cond (cond
[(and (imm8? src) (reg? dst)) [(and (imm8? src) (reg? dst))
(CODE #x83 (ModRM 3 '/0 dst (IMM8 src ac)))] (CODE #x83 (ModRM 3 '/0 dst (IMM8 src ac)))]
[(and (imm? src) (eq? dst '%eax)) [(and (imm? src) (eq? dst '%eax))
(CODE #x05 (IMM32 src ac))] (CODE #x05 (IMM32 src ac))]
[(and (imm? src) (reg? dst)) [(and (imm? src) (reg? dst))
(CODE #x81 (ModRM 3 '/0 dst (IMM32 src ac)))] (CODE #x81 (ModRM 3 '/0 dst (IMM32 src ac)))]

View File

@ -55,6 +55,16 @@
[boolean? 1 p] [boolean? 1 p]
[char? 1 p] [char? 1 p]
[not 1 not] [not 1 not]
[$fx+ 2 v]
[$fx- 2 v]
[$fx* 2 v]
[$fxlogor 2 v]
[$fxlogand 2 v]
[$fx= 2 p]
[$fx< 2 p]
[$fx<= 2 p]
[$fx> 2 p]
[$fx>= 2 p]
)) ))
;;; ;;;
(define (primitive? x) (define (primitive? x)
@ -202,8 +212,16 @@
(mkprm 'int= (V (car rands)) (immediate-rep 0))] (mkprm 'int= (V (car rands)) (immediate-rep 0))]
[(null?) [(null?)
(mkprm 'int= (V (car rands)) (immediate-rep '()))] (mkprm 'int= (V (car rands)) (immediate-rep '()))]
[(eq?) [(eq? $fx=)
(mkprm 'int= (V (car rands)) (V (cadr rands)))] (mkprm 'int= (V (car rands)) (V (cadr rands)))]
[(eq? $fx<)
(mkprm 'int< (V (car rands)) (V (cadr rands)))]
[(eq? $fx<=)
(mkprm 'int<= (V (car rands)) (V (cadr rands)))]
[(eq? $fx>)
(mkprm 'int> (V (car rands)) (V (cadr rands)))]
[(eq? $fx>=)
(mkprm 'int>= (V (car rands)) (V (cadr rands)))]
[else (error who "invalid value prim ~s" op)])] [else (error who "invalid value prim ~s" op)])]
[else (error who "invalid value ~s" x)])) [else (error who "invalid value ~s" x)]))
(define (V x) (define (V x)
@ -220,6 +238,33 @@
(mkprm 'int+ (V (car rands)) (immediate-rep 1))] (mkprm 'int+ (V (car rands)) (immediate-rep 1))]
[($fxsub1) [($fxsub1)
(mkprm 'int+ (V (car rands)) (immediate-rep -1))] (mkprm 'int+ (V (car rands)) (immediate-rep -1))]
[($fx+)
(mkprm 'int+ (V (car rands)) (V (cadr rands)))]
[($fxlogor)
(mkprm 'intor (V (car rands)) (V (cadr rands)))]
[($fxlogand)
(mkprm 'intand (V (car rands)) (V (cadr rands)))]
[($fx-)
(mkprm 'int- (V (car rands)) (V (cadr rands)))]
[($fx*)
(let ([a (car rands)] [b (cadr rands)])
(let ([ai (record-case a
[(constant i)
(if (fixnum? i) i #f)]
[else #f])]
[bi (record-case b
[(constant i)
(if (fixnum? i) i #f)]
[else #f])])
(cond
[ai
(mkprm 'int* (V b) (mkint ai))]
[bi
(mkprm 'int* (V a) (mkint bi))]
[else
(mkprm 'int* ;;; FIXME GC problem
(mkprm 'intsra (V a) (mkint fixnum-shift))
(V b))])))]
[($fxlognot) [($fxlognot)
(mkprm 'intxor (V (car rands)) (immediate-rep -1))] (mkprm 'intxor (V (car rands)) (immediate-rep -1))]
[($char->fixnum) [($char->fixnum)
@ -262,6 +307,14 @@
(case op (case op
[(int=) [(int=)
(prim 'int= 'int= (car rands) (cadr rands))] (prim 'int= 'int= (car rands) (cadr rands))]
[(int<)
(prim 'int< 'int> (car rands) (cadr rands))]
[(int<=)
(prim 'int<= 'int>= (car rands) (cadr rands))]
[(int>)
(prim 'int> 'int< (car rands) (cadr rands))]
[(int>=)
(prim 'int>= 'int<= (car rands) (cadr rands))]
[else (error who "invalid pred prim ~s" op)])] [else (error who "invalid pred prim ~s" op)])]
[else (error who "invalid pred value ~s" x)])) [else (error who "invalid pred value ~s" x)]))
(define (V x) (define (V x)
@ -283,12 +336,25 @@
(case op (case op
[(int+) [(int+)
(assoc 'int+ (car rands) (cadr rands))] (assoc 'int+ (car rands) (cadr rands))]
[(int*)
(assoc 'int* (car rands) (cadr rands))]
[(intxor) [(intxor)
(assoc 'intxor (car rands) (cadr rands))] (assoc 'intxor (car rands) (cadr rands))]
[(intor) [(intor)
(assoc 'intor (car rands) (cadr rands))] (assoc 'intor (car rands) (cadr rands))]
[(intand) [(intand)
(assoc 'intand (car rands) (cadr rands))] (assoc 'intand (car rands) (cadr rands))]
[(int-)
(let ([a (car rands)] [b (cadr rands)])
(cond
[(simple? b)
(mkseq (V a)
(mkset rv-register (mkprm 'int- rv-register b)))]
[(simple? a)
(mkseq (mkseq (V b)
(mkset rv-register (mkprm 'intneg rv-register)))
(mkset rv-register (mkprm 'int+ rv-register a)))]
[else (error who "two complex operands ~s ~s" a b)]))]
[(intsll intsra) [(intsll intsra)
(let ([a (car rands)] [b (cadr rands)]) (let ([a (car rands)] [b (cadr rands)])
(record-case b (record-case b
@ -421,18 +487,18 @@
(record-case a (record-case a
[(reg ra) [(reg ra)
(cons `(cmpl ,(op b) ,(op a)) (cons `(cmpl ,(op b) ,(op a))
(CJump (revcmp prim) lt lf ac))] (CJump prim lt lf ac))]
[(reg rb) [(reg rb)
(cons `(cmpl ,(op a) ,(op b)) (cons `(cmpl ,(op a) ,(op b))
(CJump prim lt lf ac))] (CJump (revcmp prim) lt lf ac))]
[else (error who "invalid operands in pred ~s ~s" a b)]))] [else (error who "invalid operands in pred ~s ~s" a b)]))]
[else (error who "invalid pred ~s" x)])) [else (error who "invalid pred ~s" x)]))
;;; ;;;
(define (Effect x ac) (define (Effect x ac)
(define (primname x) (define (primname x)
(case x (case x
[(int+) 'addl] [(int+) 'addl]
[(int*) 'imull]
[(intor) 'orl] [(intor) 'orl]
[(intxor) 'xorl] [(intxor) 'xorl]
[(intand) 'andl] [(intand) 'andl]
@ -456,7 +522,7 @@
[(constant c) (cons `(movl (obj ,c) ,(op targ)) ac)] [(constant c) (cons `(movl (obj ,c) ,(op targ)) ac)]
[(primcall prim rands) [(primcall prim rands)
(case prim (case prim
[(int+ intor intxor intand) [(int+ intor intxor intand int*)
(let ([asmprm (primname prim)]) (let ([asmprm (primname prim)])
(let ([a (car rands)] [b (cadr rands)]) (let ([a (car rands)] [b (cadr rands)])
(cond (cond
@ -473,6 +539,18 @@
`(,asmprm ,(op a) ,(op targ)) `(,asmprm ,(op a) ,(op targ))
ac)] ac)]
[else (error who "invalid ops")])))] [else (error who "invalid ops")])))]
[(int-)
(let ([a (car rands)] [b (cadr rands)])
(cond
[(and (same? targ a) (indep? targ b))
(cons `(subl ,(op b) ,(op a)) ac)]
[else (error who "invalid ops int-")]))]
[(intneg)
(let ([a (car rands)])
(cond
[(same? targ a)
(cons `(negl ,(op a)) ac)]
[else (error who "invalid ops intneg")]))]
[(intsll intsra) [(intsll intsra)
(let ([asmprm (primname prim)]) (let ([asmprm (primname prim)])
(let ([a (car rands)] [b (cadr rands)]) (let ([a (car rands)] [b (cadr rands)])
@ -504,7 +582,8 @@
[else (error who "invalid tail prim ~s" op)])] [else (error who "invalid tail prim ~s" op)])]
[else (error who "invalid tail ~s" x)])) [else (error who "invalid tail ~s" x)]))
;;; ;;;
(list (cons 0 (Tail x '())))) (list (list* 0
(Tail x '()))))
;;; ;;;
(define (compile x) (define (compile x)
(let* ([x (parameterize ([expand-mode 'bootstrap] (let* ([x (parameterize ([expand-mode 'bootstrap]
@ -554,5 +633,6 @@
(load "tests/tests-1.2-req.scm") (load "tests/tests-1.2-req.scm")
(load "tests/tests-1.3-req.scm") (load "tests/tests-1.3-req.scm")
(load "tests/tests-1.4-req.scm") (load "tests/tests-1.4-req.scm")
(load "tests/tests-1.5-req.scm")
(printf "ALL IS GOOD :-)\n") (printf "ALL IS GOOD :-)\n")

View File

@ -1,172 +1,173 @@
(add-tests-with-string-output "fx+" (add-tests-with-string-output "$fx+"
[(fx+ 1 2) => "3\n"] [($fx+ 1 2) => "3\n"]
[(fx+ 1 -2) => "-1\n"] [($fx+ 1 -2) => "-1\n"]
[(fx+ -1 2) => "1\n"] [($fx+ -1 2) => "1\n"]
[(fx+ -1 -2) => "-3\n"] [($fx+ -1 -2) => "-3\n"]
[(fx+ 536870911 -1) => "536870910\n"] [($fx+ 536870911 -1) => "536870910\n"]
[(fx+ 536870910 1) => "536870911\n"] [($fx+ 536870910 1) => "536870911\n"]
[(fx+ -536870912 1) => "-536870911\n"] [($fx+ -536870912 1) => "-536870911\n"]
[(fx+ -536870911 -1) => "-536870912\n"] [($fx+ -536870911 0) => "-536870911\n"]
[(fx+ 536870911 -536870912) => "-1\n"] [($fx+ -536870911 -1) => "-536870912\n"]
[(fx+ 1 (fx+ 2 3)) => "6\n"] [($fx+ 536870911 -536870912) => "-1\n"]
[(fx+ 1 (fx+ 2 -3)) => "0\n"] [($fx+ 1 ($fx+ 2 3)) => "6\n"]
[(fx+ 1 (fx+ -2 3)) => "2\n"] [($fx+ 1 ($fx+ 2 -3)) => "0\n"]
[(fx+ 1 (fx+ -2 -3)) => "-4\n"] [($fx+ 1 ($fx+ -2 3)) => "2\n"]
[(fx+ -1 (fx+ 2 3)) => "4\n"] [($fx+ 1 ($fx+ -2 -3)) => "-4\n"]
[(fx+ -1 (fx+ 2 -3)) => "-2\n"] [($fx+ -1 ($fx+ 2 3)) => "4\n"]
[(fx+ -1 (fx+ -2 3)) => "0\n"] [($fx+ -1 ($fx+ 2 -3)) => "-2\n"]
[(fx+ -1 (fx+ -2 -3)) => "-6\n"] [($fx+ -1 ($fx+ -2 3)) => "0\n"]
[(fx+ (fx+ 1 2) 3) => "6\n"] [($fx+ -1 ($fx+ -2 -3)) => "-6\n"]
[(fx+ (fx+ 1 2) -3) => "0\n"] [($fx+ ($fx+ 1 2) 3) => "6\n"]
[(fx+ (fx+ 1 -2) 3) => "2\n"] [($fx+ ($fx+ 1 2) -3) => "0\n"]
[(fx+ (fx+ 1 -2) -3) => "-4\n"] [($fx+ ($fx+ 1 -2) 3) => "2\n"]
[(fx+ (fx+ -1 2) 3) => "4\n"] [($fx+ ($fx+ 1 -2) -3) => "-4\n"]
[(fx+ (fx+ -1 2) -3) => "-2\n"] [($fx+ ($fx+ -1 2) 3) => "4\n"]
[(fx+ (fx+ -1 -2) 3) => "0\n"] [($fx+ ($fx+ -1 2) -3) => "-2\n"]
[(fx+ (fx+ -1 -2) -3) => "-6\n"] [($fx+ ($fx+ -1 -2) 3) => "0\n"]
[(fx+ (fx+ (fx+ (fx+ (fx+ (fx+ (fx+ (fx+ 1 2) 3) 4) 5) 6) 7) 8) 9) => "45\n"] [($fx+ ($fx+ -1 -2) -3) => "-6\n"]
[(fx+ 1 (fx+ 2 (fx+ 3 (fx+ 4 (fx+ 5 (fx+ 6 (fx+ 7 (fx+ 8 9)))))))) => "45\n"] [($fx+ ($fx+ ($fx+ ($fx+ ($fx+ ($fx+ ($fx+ ($fx+ 1 2) 3) 4) 5) 6) 7) 8) 9) => "45\n"]
[($fx+ 1 ($fx+ 2 ($fx+ 3 ($fx+ 4 ($fx+ 5 ($fx+ 6 ($fx+ 7 ($fx+ 8 9)))))))) => "45\n"]
) )
(add-tests-with-string-output "fx-" (add-tests-with-string-output "$fx-"
[(fx- 1 2) => "-1\n"] [($fx- 1 2) => "-1\n"]
[(fx- 1 -2) => "3\n"] [($fx- 1 -2) => "3\n"]
[(fx- -1 2) => "-3\n"] [($fx- -1 2) => "-3\n"]
[(fx- -1 -2) => "1\n"] [($fx- -1 -2) => "1\n"]
[(fx- 536870910 -1) => "536870911\n"] [($fx- 536870910 -1) => "536870911\n"]
[(fx- 536870911 1) => "536870910\n"] [($fx- 536870911 1) => "536870910\n"]
[(fx- -536870911 1) => "-536870912\n"] [($fx- -536870911 1) => "-536870912\n"]
[(fx- -536870912 -1) => "-536870911\n"] [($fx- -536870912 -1) => "-536870911\n"]
[(fx- 1 536870911) => "-536870910\n"] [($fx- 1 536870911) => "-536870910\n"]
[(fx- -1 536870911) => "-536870912\n"] [($fx- -1 536870911) => "-536870912\n"]
[(fx- 1 -536870910) => "536870911\n"] [($fx- 1 -536870910) => "536870911\n"]
[(fx- -1 -536870912) => "536870911\n"] [($fx- -1 -536870912) => "536870911\n"]
[(fx- 536870911 536870911) => "0\n"] [($fx- 536870911 536870911) => "0\n"]
;[(fx- 536870911 -536870912) => "-1\n"] ;[($fx- 536870911 -536870912) => "-1\n"]
[(fx- -536870911 -536870912) => "1\n"] [($fx- -536870911 -536870912) => "1\n"]
[(fx- 1 (fx- 2 3)) => "2\n"] [($fx- 1 ($fx- 2 3)) => "2\n"]
[(fx- 1 (fx- 2 -3)) => "-4\n"] [($fx- 1 ($fx- 2 -3)) => "-4\n"]
[(fx- 1 (fx- -2 3)) => "6\n"] [($fx- 1 ($fx- -2 3)) => "6\n"]
[(fx- 1 (fx- -2 -3)) => "0\n"] [($fx- 1 ($fx- -2 -3)) => "0\n"]
[(fx- -1 (fx- 2 3)) => "0\n"] [($fx- -1 ($fx- 2 3)) => "0\n"]
[(fx- -1 (fx- 2 -3)) => "-6\n"] [($fx- -1 ($fx- 2 -3)) => "-6\n"]
[(fx- -1 (fx- -2 3)) => "4\n"] [($fx- -1 ($fx- -2 3)) => "4\n"]
[(fx- -1 (fx- -2 -3)) => "-2\n"] [($fx- -1 ($fx- -2 -3)) => "-2\n"]
[(fx- 0 (fx- -2 -3)) => "-1\n"] [($fx- 0 ($fx- -2 -3)) => "-1\n"]
[(fx- (fx- 1 2) 3) => "-4\n"] [($fx- ($fx- 1 2) 3) => "-4\n"]
[(fx- (fx- 1 2) -3) => "2\n"] [($fx- ($fx- 1 2) -3) => "2\n"]
[(fx- (fx- 1 -2) 3) => "0\n"] [($fx- ($fx- 1 -2) 3) => "0\n"]
[(fx- (fx- 1 -2) -3) => "6\n"] [($fx- ($fx- 1 -2) -3) => "6\n"]
[(fx- (fx- -1 2) 3) => "-6\n"] [($fx- ($fx- -1 2) 3) => "-6\n"]
[(fx- (fx- -1 2) -3) => "0\n"] [($fx- ($fx- -1 2) -3) => "0\n"]
[(fx- (fx- -1 -2) 3) => "-2\n"] [($fx- ($fx- -1 -2) 3) => "-2\n"]
[(fx- (fx- -1 -2) -3) => "4\n"] [($fx- ($fx- -1 -2) -3) => "4\n"]
[(fx- (fx- (fx- (fx- (fx- (fx- (fx- (fx- 1 2) 3) 4) 5) 6) 7) 8) 9) => "-43\n"] [($fx- ($fx- ($fx- ($fx- ($fx- ($fx- ($fx- ($fx- 1 2) 3) 4) 5) 6) 7) 8) 9) => "-43\n"]
[(fx- 1 (fx- 2 (fx- 3 (fx- 4 (fx- 5 (fx- 6 (fx- 7 (fx- 8 9)))))))) => "5\n"] [($fx- 1 ($fx- 2 ($fx- 3 ($fx- 4 ($fx- 5 ($fx- 6 ($fx- 7 ($fx- 8 9)))))))) => "5\n"]
) )
(add-tests-with-string-output "fx*" (add-tests-with-string-output "$fx*"
[(fx* 2 3) => "6\n"] [($fx* 2 3) => "6\n"]
[(fx* 2 -3) => "-6\n"] [($fx* 2 -3) => "-6\n"]
[(fx* -2 3) => "-6\n"] [($fx* -2 3) => "-6\n"]
[(fx* -2 -3) => "6\n"] [($fx* -2 -3) => "6\n"]
[(fx* 536870911 1) => "536870911\n"] [($fx* 536870911 1) => "536870911\n"]
[(fx* 536870911 -1) => "-536870911\n"] [($fx* 536870911 -1) => "-536870911\n"]
[(fx* -536870912 1) => "-536870912\n"] [($fx* -536870912 1) => "-536870912\n"]
[(fx* -536870911 -1) => "536870911\n"] [($fx* -536870911 -1) => "536870911\n"]
[(fx* 2 (fx* 3 4)) => "24\n"] [($fx* 2 ($fx* 3 4)) => "24\n"]
[(fx* (fx* 2 3) 4) => "24\n"] [($fx* ($fx* 2 3) 4) => "24\n"]
[(fx* (fx* (fx* (fx* (fx* 2 3) 4) 5) 6) 7) => "5040\n"] [($fx* ($fx* ($fx* ($fx* ($fx* 2 3) 4) 5) 6) 7) => "5040\n"]
[(fx* 2 (fx* 3 (fx* 4 (fx* 5 (fx* 6 7))))) => "5040\n"] [($fx* 2 ($fx* 3 ($fx* 4 ($fx* 5 ($fx* 6 7))))) => "5040\n"]
) )
(add-tests-with-string-output "fxlogand and fxlogor" (add-tests-with-string-output "$fxlogand and $fxlogor"
[(fxlogor 3 16) => "19\n"] [($fxlogor 3 16) => "19\n"]
[(fxlogor 3 5) => "7\n"] [($fxlogor 3 5) => "7\n"]
[(fxlogor 3 7) => "7\n"] [($fxlogor 3 7) => "7\n"]
[(fxlognot (fxlogor (fxlognot 7) 1)) => "6\n"] [($fxlognot ($fxlogor ($fxlognot 7) 1)) => "6\n"]
[(fxlognot (fxlogor 1 (fxlognot 7))) => "6\n"] [($fxlognot ($fxlogor 1 ($fxlognot 7))) => "6\n"]
[(fxlogand 3 7) => "3\n"] [($fxlogand 3 7) => "3\n"]
[(fxlogand 3 5) => "1\n"] [($fxlogand 3 5) => "1\n"]
[(fxlogand 2346 (fxlognot 2346)) => "0\n"] [($fxlogand 2346 ($fxlognot 2346)) => "0\n"]
[(fxlogand (fxlognot 2346) 2346) => "0\n"] [($fxlogand ($fxlognot 2346) 2346) => "0\n"]
[(fxlogand 2376 2376) => "2376\n"] [($fxlogand 2376 2376) => "2376\n"]
) )
(add-tests-with-string-output "fx=" (add-tests-with-string-output "$fx="
[(fx= 12 13) => "#f\n"] [($fx= 12 13) => "#f\n"]
[(fx= 12 12) => "#t\n"] [($fx= 12 12) => "#t\n"]
[(fx= 16 (fx+ 13 3)) => "#t\n"] [($fx= 16 ($fx+ 13 3)) => "#t\n"]
[(fx= 16 (fx+ 13 13)) => "#f\n"] [($fx= 16 ($fx+ 13 13)) => "#f\n"]
[(fx= (fx+ 13 3) 16) => "#t\n"] [($fx= ($fx+ 13 3) 16) => "#t\n"]
[(fx= (fx+ 13 13) 16) => "#f\n"] [($fx= ($fx+ 13 13) 16) => "#f\n"]
) )
(add-tests-with-string-output "fx<" (add-tests-with-string-output "$fx<"
[(fx< 12 13) => "#t\n"] [($fx< 12 13) => "#t\n"]
[(fx< 12 12) => "#f\n"] [($fx< 12 12) => "#f\n"]
[(fx< 13 12) => "#f\n"] [($fx< 13 12) => "#f\n"]
[(fx< 16 (fx+ 13 1)) => "#f\n"] [($fx< 16 ($fx+ 13 1)) => "#f\n"]
[(fx< 16 (fx+ 13 3)) => "#f\n"] [($fx< 16 ($fx+ 13 3)) => "#f\n"]
[(fx< 16 (fx+ 13 13)) => "#t\n"] [($fx< 16 ($fx+ 13 13)) => "#t\n"]
[(fx< (fx+ 13 1) 16) => "#t\n"] [($fx< ($fx+ 13 1) 16) => "#t\n"]
[(fx< (fx+ 13 3) 16) => "#f\n"] [($fx< ($fx+ 13 3) 16) => "#f\n"]
[(fx< (fx+ 13 13) 16) => "#f\n"] [($fx< ($fx+ 13 13) 16) => "#f\n"]
) )
(add-tests-with-string-output "fx<=" (add-tests-with-string-output "$fx<="
[(fx<= 12 13) => "#t\n"] [($fx<= 12 13) => "#t\n"]
[(fx<= 12 12) => "#t\n"] [($fx<= 12 12) => "#t\n"]
[(fx<= 13 12) => "#f\n"] [($fx<= 13 12) => "#f\n"]
[(fx<= 16 (fx+ 13 1)) => "#f\n"] [($fx<= 16 ($fx+ 13 1)) => "#f\n"]
[(fx<= 16 (fx+ 13 3)) => "#t\n"] [($fx<= 16 ($fx+ 13 3)) => "#t\n"]
[(fx<= 16 (fx+ 13 13)) => "#t\n"] [($fx<= 16 ($fx+ 13 13)) => "#t\n"]
[(fx<= (fx+ 13 1) 16) => "#t\n"] [($fx<= ($fx+ 13 1) 16) => "#t\n"]
[(fx<= (fx+ 13 3) 16) => "#t\n"] [($fx<= ($fx+ 13 3) 16) => "#t\n"]
[(fx<= (fx+ 13 13) 16) => "#f\n"] [($fx<= ($fx+ 13 13) 16) => "#f\n"]
) )
(add-tests-with-string-output "fx>" (add-tests-with-string-output "$fx>"
[(fx> 12 13) => "#f\n"] [($fx> 12 13) => "#f\n"]
[(fx> 12 12) => "#f\n"] [($fx> 12 12) => "#f\n"]
[(fx> 13 12) => "#t\n"] [($fx> 13 12) => "#t\n"]
[(fx> 16 (fx+ 13 1)) => "#t\n"] [($fx> 16 ($fx+ 13 1)) => "#t\n"]
[(fx> 16 (fx+ 13 3)) => "#f\n"] [($fx> 16 ($fx+ 13 3)) => "#f\n"]
[(fx> 16 (fx+ 13 13)) => "#f\n"] [($fx> 16 ($fx+ 13 13)) => "#f\n"]
[(fx> (fx+ 13 1) 16) => "#f\n"] [($fx> ($fx+ 13 1) 16) => "#f\n"]
[(fx> (fx+ 13 3) 16) => "#f\n"] [($fx> ($fx+ 13 3) 16) => "#f\n"]
[(fx> (fx+ 13 13) 16) => "#t\n"] [($fx> ($fx+ 13 13) 16) => "#t\n"]
) )
(add-tests-with-string-output "fx>=" (add-tests-with-string-output "$fx>="
[(fx>= 12 13) => "#f\n"] [($fx>= 12 13) => "#f\n"]
[(fx>= 12 12) => "#t\n"] [($fx>= 12 12) => "#t\n"]
[(fx>= 13 12) => "#t\n"] [($fx>= 13 12) => "#t\n"]
[(fx>= 16 (fx+ 13 1)) => "#t\n"] [($fx>= 16 ($fx+ 13 1)) => "#t\n"]
[(fx>= 16 (fx+ 13 3)) => "#t\n"] [($fx>= 16 ($fx+ 13 3)) => "#t\n"]
[(fx>= 16 (fx+ 13 13)) => "#f\n"] [($fx>= 16 ($fx+ 13 13)) => "#f\n"]
[(fx>= (fx+ 13 1) 16) => "#f\n"] [($fx>= ($fx+ 13 1) 16) => "#f\n"]
[(fx>= (fx+ 13 3) 16) => "#t\n"] [($fx>= ($fx+ 13 3) 16) => "#t\n"]
[(fx>= (fx+ 13 13) 16) => "#t\n"] [($fx>= ($fx+ 13 13) 16) => "#t\n"]
) )
(add-tests-with-string-output "if" (add-tests-with-string-output "if"
[(if (fx= 12 13) 12 13) => "13\n"] [(if ($fx= 12 13) 12 13) => "13\n"]
[(if (fx= 12 12) 13 14) => "13\n"] [(if ($fx= 12 12) 13 14) => "13\n"]
[(if (fx< 12 13) 12 13) => "12\n"] [(if ($fx< 12 13) 12 13) => "12\n"]
[(if (fx< 12 12) 13 14) => "14\n"] [(if ($fx< 12 12) 13 14) => "14\n"]
[(if (fx< 13 12) 13 14) => "14\n"] [(if ($fx< 13 12) 13 14) => "14\n"]
[(if (fx<= 12 13) 12 13) => "12\n"] [(if ($fx<= 12 13) 12 13) => "12\n"]
[(if (fx<= 12 12) 12 13) => "12\n"] [(if ($fx<= 12 12) 12 13) => "12\n"]
[(if (fx<= 13 12) 13 14) => "14\n"] [(if ($fx<= 13 12) 13 14) => "14\n"]
[(if (fx> 12 13) 12 13) => "13\n"] [(if ($fx> 12 13) 12 13) => "13\n"]
[(if (fx> 12 12) 12 13) => "13\n"] [(if ($fx> 12 12) 12 13) => "13\n"]
[(if (fx> 13 12) 13 14) => "13\n"] [(if ($fx> 13 12) 13 14) => "13\n"]
[(if (fx>= 12 13) 12 13) => "13\n"] [(if ($fx>= 12 13) 12 13) => "13\n"]
[(if (fx>= 12 12) 12 13) => "12\n"] [(if ($fx>= 12 12) 12 13) => "12\n"]
[(if (fx>= 13 12) 13 14) => "13\n"] [(if ($fx>= 13 12) 13 14) => "13\n"]
) )